Sha256: 9f0a8d5f447ff2bdd88febddce5d402169712d31f89d51abb4ff152f71858d57

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

require "helper"

class LunarScoringTest < Test::Unit::TestCase
  describe "scores of 'the quick brown fox jumps over the lazy dog'" do
    should "return a hash of the words with score 1 except the, with score 2" do
      scoring = Lunar::Scoring.new("the quick brown fox jumps over the lazy dog")
      assert_equal 2, scoring.scores["the"]
      assert_equal 1, scoring.scores["quick"]
      assert_equal 1, scoring.scores["brown"]
      assert_equal 1, scoring.scores["fox"]
      assert_equal 1, scoring.scores["jumps"]
      assert_equal 1, scoring.scores["over"]
      assert_equal 1, scoring.scores["lazy"]
      assert_equal 1, scoring.scores["dog"]
    end
  end

  describe "scores of 'tHe qUick bRowN the quick brown THE QUICK BROWN'" do
    should "return a hash of each of the words the quick brown with score 3" do
      scoring = Lunar::Scoring.new('tHe qUick bRowN the quick brown THE QUICK BROWN')
      assert_equal 3, scoring.scores['the']
      assert_equal 3, scoring.scores['quick']
      assert_equal 3, scoring.scores['brown']
    end     
  end

  describe 'scores of apple macbook pro 17"' do
    should "return a hash of apple macbook pro 17" do
      scoring = Lunar::Scoring.new('apple macbook pro 17"')
      assert_equal 1, scoring.scores['apple']
      assert_equal 1, scoring.scores['macbook']
      assert_equal 1, scoring.scores['pro']
      assert_equal 1, scoring.scores['17']
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lunar-0.4.1 test/test_lunar_scoring.rb
lunar-0.4.0 test/test_lunar_scoring.rb
lunar-0.3.0 test/test_lunar_scoring.rb
lunar-0.2.3 test/test_lunar_scoring.rb
lunar-0.2.2 test/test_lunar_scoring.rb
lunar-0.2.1 test/test_lunar_scoring.rb
lunar-0.2.0 test/test_lunar_scoring.rb
lunar-0.1.1 test/test_lunar_scoring.rb