-
Notifications
You must be signed in to change notification settings - Fork 6
/
scrabble_score_test.rb
54 lines (42 loc) · 1.29 KB
/
scrabble_score_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
require_relative 'scrabble_score'
class ScrabbleTest < Minitest::Test
def test_empty_word_scores_zero
assert_equal 0, Scrabble.new('').score
end
def test_whitespace_scores_zero
assert_equal 0, Scrabble.new(" \t\n").score
end
def test_nil_scores_zero
assert_equal 0, Scrabble.new(nil).score
end
def test_scores_very_short_word
assert_equal 1, Scrabble.new('a').score
end
def test_scores_other_very_short_word
assert_equal 4, Scrabble.new('f').score
end
def test_simple_word_scores_the_number_of_letters
assert_equal 6, Scrabble.new('street').score
end
def test_complicated_word_scores_more
assert_equal 22, Scrabble.new('quirky').score
end
def test_scores_are_case_insensitive
assert_equal 41, Scrabble.new('OXYPHENBUTAZONE').score
end
def test_convenient_scoring
assert_equal 13, Scrabble.score('alacrity')
end
def test_scores_very_short_word_double
assert_equal 2, Scrabble.new('a', Multiplier.new(2)).score
end
def test_complicated_word_scores_double
assert_equal 44, Scrabble.new('quirky', Multiplier.new(2)).score
end
def test_complicated_word_scores_triple
assert_equal 66, Scrabble.new('quirky', Multiplier.new(3)).score
end
end