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
|
require_relative '../test_helper'
class WordListTest < Minitest::Test
def test_size_does_not_count_words_twice
list = ClassifierReborn::WordList.new
assert list.size == 0
list.add_word('hello')
assert list.size == 1
list.add_word('hello')
assert list.size == 1
list.add_word('world')
assert list.size == 2
end
def test_brackets_return_correct_position_based_on_add_order
list = ClassifierReborn::WordList.new
list.add_word('hello')
list.add_word('world')
assert list['hello'] == 0
assert list['world'] == 1
end
def test_word_for_index_returns_correct_word_based_on_add_order
list = ClassifierReborn::WordList.new
list.add_word('hello')
list.add_word('world')
assert list.word_for_index(0) == 'hello'
assert list.word_for_index(1) == 'world'
end
end
|