Class: TestCW
- Inherits:
-
MiniTest::Test
- Object
- MiniTest::Test
- TestCW
- Defined in:
- /Users/martyn/cw/cw_clone/test/test_cw.rb,
/Users/martyn/cw/cw_clone/test/test_filtering.rb
Constant Summary
- ROOT =
File. File.dirname(__FILE__) + '/../'
Instance Method Summary (collapse)
- - (Object) setup
- - (Object) teardown
- - (Object) test_alphabet_generates_alphabet
- - (Object) test_alphabet_generates_reversed_alphabet
- - (Object) test_alphabet_shuffles_alphabet
- - (Object) test_beginning_with_a
- - (Object) test_beginning_with_ab
- - (Object) test_beginning_with_range
- - (Object) test_beginning_with_returns_words_beginning_with_letter
- - (Object) test_beginning_with_will_take_two_letters
- - (Object) test_beginning_with_with_empty_string_returns_all
- - (Object) test_beginning_with_with_no_match
- - (Object) test_beginning_with_z
- - (Object) test_build_build_cl_ignores_invalid_tone_type
- - (Object) test_build_command_includes_custom_commands_via_build_cl
- - (Object) test_cl_echo_returns_correct_string
- - (Object) test_containing_abc
- - (Object) test_containing_with_range
- - (Object) test_cw_class
- - (Object) test_CW_takes_a_block
- - (Object) test_dictionary_defaults_to_COMMON_WORDS
- - (Object) test_dont_load_common_words_if_passed_in_block
- - (Object) test_double_words
- - (Object) test_effective_wpm_defaults_to_nil
- - (Object) test_effective_wpm_is_settable
- - (Object) test_ending_with_a
- - (Object) test_ending_with_range
- - (Object) test_ending_with_returns_words_ending_with_letter
- - (Object) test_ending_with_tion
- - (Object) test_ending_with_will_take_two_letters
- - (Object) test_ending_with_with_empty_string_returns_all
- - (Object) test_ending_with_with_no_match
- - (Object) test_ending_with_z
-
- (Object) test_frequency_returns_frequency
def test_run_converts_and_plays @cw.dry_run = true @cw.words = [“some”, “words”] assert_equal 'played', @cw.run end.
- - (Object) test_having_size_of_1
- - (Object) test_having_size_of_2
- - (Object) test_having_size_of_3
- - (Object) test_including_a
- - (Object) test_including_range
- - (Object) test_including_returns_words_including_letter
- - (Object) test_including_tion
- - (Object) test_including_will_take_two_letters
- - (Object) test_including_with_empty_string_returns_all
- - (Object) test_including_with_no_match
- - (Object) test_including_z
- - (Object) test_load_common_words_loads_common_words
- - (Object) test_load_words_loads_passed_filename
- - (Object) test_loads_words_by_default
-
- (Object) test_method_aliases
todo def test_dot_ms_returns_correct_time_in_milliseconds assert_in_delta(0.1, @cw.dot_ms(12), 0.001) end.
- - (Object) test_name_can_be_set
- - (Object) test_name_is_unnamed_if_unnamed
- - (Object) test_no_longer_than_1
- - (Object) test_no_longer_than_2
- - (Object) test_no_longer_than_will_return_words_no_longer_than_x
- - (Object) test_no_longer_than_with_no_match
- - (Object) test_no_run_aliases_no_run
- - (Object) test_no_shorter_than_1
- - (Object) test_no_shorter_than_2
- - (Object) test_no_shorter_than_3
- - (Object) test_no_shorter_than_will_return_words_no_shorter_than_x
- - (Object) test_no_shorter_than_with_no_match
- - (Object) test_play_command_returns_play_command
- - (Object) test_random_letters_can_take_count_option
- - (Object) test_random_letters_can_take_size_and_count_option
- - (Object) test_random_letters_can_take_size_option
- - (Object) test_random_letters_numbers_can_take_size_and_count_option
- - (Object) test_random_letters_numbers_includes_letter
- - (Object) test_random_letters_numbers_includes_number
- - (Object) test_random_letters_returns_random_letters
- - (Object) test_random_letters_returns_word_count_of_50_by_default
- - (Object) test_random_letters_returns_words_of_size_4_by_default
- - (Object) test_random_numbers_can_take_size_and_count_option
- - (Object) test_random_numbers_returns_random_numbers
- - (Object) test_reload_reloads_dictionary
- - (Object) test_reload_reuploads_new_words_ie_dictionary_updated
- - (Object) test_repeat_none
- - (Object) test_repeat_once
- - (Object) test_repeat_twice
- - (Object) test_reverse_reverses_words
- - (Object) test_set_audio_filename_to_given_name
- - (Object) test_set_author_param
- - (Object) test_set_B_param_in_noise_mode
- - (Object) test_set_default_filename
- - (Object) test_set_ewpm_param
- - (Object) test_set_freq_f_param
- - (Object) test_set_high_quality
- - (Object) test_set_low_quality
- - (Object) test_set_medium_quality
- - (Object) test_set_N_param_in_noise_mode
- - (Object) test_set_q_param_when_numeric_quality
- - (Object) test_set_sawtooth_param
- - (Object) test_set_sinewave_param
- - (Object) test_set_squarewave_param
- - (Object) test_set_title_param
- - (Object) test_set_word_spacing_W_param
- - (Object) test_set_wpm_param
- - (Object) test_shuffle_shuffles_words
- - (Object) test_something
- - (Object) test_to_s_outputs_relevant_params_if_set
- - (Object) test_to_s_outputs_test_run_header_if_no_rund
- - (Object) test_true
- - (Object) test_word_count_returns_x_words
- - (Object) test_word_filename_defaults_to_words
- - (Object) test_word_length_1
- - (Object) test_word_length_2
- - (Object) test_word_length_3
- - (Object) test_word_size_1
- - (Object) test_word_size_2
- - (Object) test_word_size_3
- - (Object) test_word_size_returns_words_of_such_size
- - (Object) test_word_spacing_is_settable_and_readable
- - (Object) test_words_beginning_with_a
- - (Object) test_words_beginning_with_ab
- - (Object) test_words_beginning_with_range
- - (Object) test_words_beginning_with_with_empty_string_returns_all
- - (Object) test_words_beginning_with_with_no_match
- - (Object) test_words_beginning_with_z
- - (Object) test_words_ending_with_a
- - (Object) test_words_ending_with_range
- - (Object) test_words_ending_with_tion
- - (Object) test_words_ending_with_with_empty_string_returns_all
- - (Object) test_words_ending_with_with_no_match
- - (Object) test_words_ending_with_z
- - (Object) test_words_exist
- - (Object) test_words_fn_adds_words
- - (Object) test_words_fn_passes_in_an_array_of_words_as_is
- - (Object) test_words_including_a
- - (Object) test_words_including_range
- - (Object) test_words_including_tion
- - (Object) test_words_including_with_empty_string_returns_all
- - (Object) test_words_including_with_no_match
- - (Object) test_words_including_z
- - (Object) test_words_no_longer_than_0
- - (Object) test_words_no_longer_than_1
- - (Object) test_words_no_longer_than_2
- - (Object) test_words_no_longer_than_with_words_no_match
- - (Object) test_words_no_shorter_than_0
- - (Object) test_words_no_shorter_than_1
- - (Object) test_words_no_shorter_than_2
- - (Object) test_words_no_shorter_than_3
- - (Object) test_words_no_shorter_than_with_words_no_match
- - (Object) test_wpm_defaults_to_25_if_unset
- - (Object) test_wpm_is_settable
Instance Method Details
- (Object) setup
13 14 15 16 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 13 def setup @cw = CW.new @cw.no_run end |
- (Object) teardown
18 19 20 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 18 def teardown @cw = nil end |
- (Object) test_alphabet_generates_alphabet
313 314 315 316 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 313 def test_alphabet_generates_alphabet @cw.alphabet assert_equal ["a b c d e f g h i j k l m n o p q r s t u v w x y z"], @cw.words end |
- (Object) test_alphabet_generates_reversed_alphabet
318 319 320 321 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 318 def test_alphabet_generates_reversed_alphabet @cw.alphabet(reverse: true) assert_equal ['z y x w v u t s r q p o n m l k j i h g f e d c b a'], @cw.words end |
- (Object) test_alphabet_shuffles_alphabet
323 324 325 326 327 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 323 def test_alphabet_shuffles_alphabet @cw.alphabet(shuffle: true) refute_equal ["a b c d e f g h i j k l m n o p q r s t u v w x y z"], @cw.words assert_equal "abcdefghijklmnopqrstuvwxyz", @cw.words.first.chars.sort.join.strip end |
- (Object) test_beginning_with_a
26 27 28 29 30 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 26 def test_beginning_with_a @cw.words = ['able', 'zero'] @cw.beginning_with('a') assert_equal ['able'], @cw.words end |
- (Object) test_beginning_with_ab
38 39 40 41 42 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 38 def test_beginning_with_ab @cw.words = ['ardvark', 'able', 'zero'] @cw.beginning_with('ab') assert_equal ['able'], @cw.words end |
- (Object) test_beginning_with_range
44 45 46 47 48 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 44 def test_beginning_with_range @cw.words = ['able', 'delta', 'zero'] @cw.beginning_with('a'..'d') assert_equal ['able', 'delta'], @cw.words end |
- (Object) test_beginning_with_returns_words_beginning_with_letter
188 189 190 191 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 188 def test_beginning_with_returns_words_beginning_with_letter @cw.beginning_with 'l' assert_equal ["like", "look", "long", "little", "large"] , @cw.words.first(5) end |
- (Object) test_beginning_with_will_take_two_letters
193 194 195 196 197 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 193 def test_beginning_with_will_take_two_letters @cw.beginning_with 'q','b' assert_equal ["question", "quickly", "quite", "quiet", "be", "by"] , @cw.words.first(6) end |
- (Object) test_beginning_with_with_empty_string_returns_all
56 57 58 59 60 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 56 def test_beginning_with_with_empty_string_returns_all @cw.words = ['able', 'zero'] @cw.beginning_with('') assert_equal ['able', 'zero'], @cw.words end |
- (Object) test_beginning_with_with_no_match
50 51 52 53 54 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 50 def test_beginning_with_with_no_match @cw.words = ['able', 'zero'] @cw.beginning_with('b') assert_equal [], @cw.words end |
- (Object) test_beginning_with_z
32 33 34 35 36 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 32 def test_beginning_with_z @cw.words = ['able', 'zero'] @cw.beginning_with('z') assert_equal ['zero'], @cw.words end |
- (Object) test_build_build_cl_ignores_invalid_tone_type
425 426 427 428 429 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 425 def test_build_build_cl_ignores_invalid_tone_type @cw.set_tone_type :sinewave @cw.set_tone_type :invalid assert @cw.cl.cl_sinewave == '-T 0 ', 'not ignoring invalid tone type' end |
- (Object) test_build_command_includes_custom_commands_via_build_cl
480 481 482 483 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 480 def test_build_command_includes_custom_commands_via_build_cl @cw.command_line '-x "some custom command"' assert @cw.cl.cl_command_line.include?( '-x "some custom command"'), 'custom command invalid' end |
- (Object) test_cl_echo_returns_correct_string
485 486 487 488 489 490 491 492 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 485 def test_cl_echo_returns_correct_string str = '' CW.new do str = @cl.cl_echo('some words') no_run end assert str.include?('echo some words | ebook2cw -w 25') end |
- (Object) test_containing_abc
427 428 429 430 431 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 427 def test_containing_abc @cw.words = ['abd', 'abc', 'acb', 'cba', '123', 'ab', 'ad', 'cb'] @cw.containing ['a','b','c'] assert_equal ['abc', 'acb', 'cba', 'ab', 'cb'], @cw.words end |
- (Object) test_containing_with_range
433 434 435 436 437 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 433 def test_containing_with_range @cw.words = ['abd', 'abc', 'acb', 'cba', '123', 'ab', 'ad', 'cb'] @cw.containing ['a'..'c'] assert_equal ['abc', 'acb', 'cba', 'ab', 'cb'], @cw.words end |
- (Object) test_cw_class
26 27 28 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 26 def test_cw_class assert_equal CW, @cw.class end |
- (Object) test_CW_takes_a_block
52 53 54 55 56 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 52 def test_CW_takes_a_block CW.new { no_run } end |
- (Object) test_dictionary_defaults_to_COMMON_WORDS
43 44 45 46 47 48 49 50 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 43 def test_dictionary_defaults_to_COMMON_WORDS temp = nil CW.new { no_run temp = CWG::Params.dictionary } assert_equal File.(ROOT + '/data/text/common_words.txt'), File.(temp) end |
- (Object) test_dont_load_common_words_if_passed_in_block
58 59 60 61 62 63 64 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 58 def test_dont_load_common_words_if_passed_in_block cw = CW.new { no_run } cw.words = ["some", "words"] assert_equal ["some", "words"], cw.words end |
- (Object) test_double_words
350 351 352 353 354 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 350 def test_double_words @cw.words = ['1', '12', '123'] @cw.double_words assert_equal ['1', '1', '12', '12', '123', '123'], @cw.words end |
- (Object) test_effective_wpm_defaults_to_nil
156 157 158 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 156 def test_effective_wpm_defaults_to_nil assert_nil @cw.effective_wpm end |
- (Object) test_effective_wpm_is_settable
166 167 168 169 170 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 166 def test_effective_wpm_is_settable effective_wpm = rand(50) @cw.effective_wpm effective_wpm assert_equal effective_wpm, @cw.effective_wpm end |
- (Object) test_ending_with_a
98 99 100 101 102 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 98 def test_ending_with_a @cw.words = ['else', 'antenna', 'alba', 'zero'] @cw.ending_with('a') assert_equal ['antenna', 'alba'], @cw.words end |
- (Object) test_ending_with_range
116 117 118 119 120 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 116 def test_ending_with_range @cw.words = ['may', 'kay', 'yam', 'eye', 'pizazz'] @cw.ending_with('y'..'z') assert_equal ['may', 'kay', 'pizazz'], @cw.words end |
- (Object) test_ending_with_returns_words_ending_with_letter
199 200 201 202 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 199 def test_ending_with_returns_words_ending_with_letter @cw.ending_with 'l' assert_equal ["all", "will", "call", "oil", "well"] , @cw.words.first(5) end |
- (Object) test_ending_with_tion
110 111 112 113 114 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 110 def test_ending_with_tion @cw.words = ['tiona', 'lion', 'station', 'creation'] @cw.ending_with('tion') assert_equal ['station', 'creation'], @cw.words end |
- (Object) test_ending_with_will_take_two_letters
204 205 206 207 208 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 204 def test_ending_with_will_take_two_letters @cw.ending_with 'x', 'a' assert_equal ["box", "six", "suffix", "a", "America", "sea"] , @cw.words.first(6) end |
- (Object) test_ending_with_with_empty_string_returns_all
128 129 130 131 132 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 128 def test_ending_with_with_empty_string_returns_all @cw.words = ['able', 'zero'] @cw.ending_with('') assert_equal ['able', 'zero'], @cw.words end |
- (Object) test_ending_with_with_no_match
122 123 124 125 126 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 122 def test_ending_with_with_no_match @cw.words = ['able', 'zero'] @cw.ending_with('b') assert_equal [], @cw.words end |
- (Object) test_ending_with_z
104 105 106 107 108 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 104 def test_ending_with_z @cw.words = ['joy', 'pazazz'] @cw.ending_with('z') assert_equal ['pazazz'], @cw.words end |
- (Object) test_frequency_returns_frequency
def test_run_converts_and_plays
@cw.dry_run = true
@cw.words = ["some", "words"]
assert_equal 'played', @cw.run
end
348 349 350 351 352 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 348 def test_frequency_returns_frequency assert_equal 567, @cw.frequency(567) @cw.frequency 456 assert_equal 456, @cw.frequency end |
- (Object) test_having_size_of_1
391 392 393 394 395 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 391 def test_having_size_of_1 @cw.words = ['1', '12', '123'] @cw.having_size_of 1 assert_equal ['1'], @cw.words end |
- (Object) test_having_size_of_2
397 398 399 400 401 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 397 def test_having_size_of_2 @cw.words = ['1', '12', '23', '123'] @cw.having_size_of 2 assert_equal ['12','23'], @cw.words end |
- (Object) test_having_size_of_3
403 404 405 406 407 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 403 def test_having_size_of_3 @cw.words = ['1', '12', '23', '123'] @cw.having_size_of 3 assert_equal ['123'], @cw.words end |
- (Object) test_including_a
170 171 172 173 174 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 170 def test_including_a @cw.words = ['else', 'banter', 'alt', 'zero'] @cw.including('a') assert_equal ['banter', 'alt'], @cw.words end |
- (Object) test_including_range
188 189 190 191 192 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 188 def test_including_range @cw.words = ['may', 'kay', 'yam', 'eye', 'pizazz'] @cw.including('g'..'k') assert_equal ['pizazz', 'kay'], @cw.words end |
- (Object) test_including_returns_words_including_letter
215 216 217 218 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 215 def test_including_returns_words_including_letter @cw.including 'l' assert_equal ["all", "will", "would", "like", "look"] , @cw.words.first(5) end |
- (Object) test_including_tion
182 183 184 185 186 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 182 def test_including_tion @cw.words = ['tiona', 'lion', 'station', 'creation'] @cw.including('tion') assert_equal ['tiona', 'station', 'creation'], @cw.words end |
- (Object) test_including_will_take_two_letters
220 221 222 223 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 220 def test_including_will_take_two_letters @cw.including 'q', 'a' assert_equal ["question", "quickly", "equation", "square", "quite", "quiet", "equal", "and"] ,@cw.words.first(8) end |
- (Object) test_including_with_empty_string_returns_all
200 201 202 203 204 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 200 def test_including_with_empty_string_returns_all @cw.words = ['able', 'zero'] @cw.including('') assert_equal ['able', 'zero'], @cw.words end |
- (Object) test_including_with_no_match
194 195 196 197 198 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 194 def test_including_with_no_match @cw.words = ['able', 'zero'] @cw.including('c') assert_equal [], @cw.words end |
- (Object) test_including_z
176 177 178 179 180 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 176 def test_including_z @cw.words = ['joy', 'amaze', '123'] @cw.including('z') assert_equal ['amaze'], @cw.words end |
- (Object) test_load_common_words_loads_common_words
93 94 95 96 97 98 99 100 101 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 93 def test_load_common_words_loads_common_words cw = CW.new { no_run } cw.words = ["some", "words"] assert_equal ["some", "words"], cw.words cw.load_common_words assert_equal ["the", "of", "and", "a", "to"] , cw.words.first(5) end |
- (Object) test_load_words_loads_passed_filename
103 104 105 106 107 108 109 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 103 def test_load_words_loads_passed_filename temp = Tempfile.new("words.tmp") temp << "some words" temp.close @cw.load_words(temp) assert_equal ["some", "words"], @cw.words end |
- (Object) test_loads_words_by_default
39 40 41 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 39 def test_loads_words_by_default assert_equal ["the", "of", "and", "a", "to"] , @cw.words.first(5) end |
- (Object) test_method_aliases
todo
def test_dot_ms_returns_correct_time_in_milliseconds
assert_in_delta(0.1, @cw.dot_ms(12), 0.001)
end
def test_space_ms_returns_correct_time_in_milliseconds
assert_in_delta(0.3, @cw.space_ms(12), 0.001)
end
376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 376 def test_method_aliases assert @cw.method(:word_length), @cw.method(:word_size) assert @cw.method(:having_size_of), @cw.method(:word_size) assert @cw.method(:word_shuffle), @cw.method(:shuffle) assert @cw.method(:words_beginning_with), @cw.method(:beginning_with) assert @cw.method(:words_ending_with), @cw.method(:ending_with) assert @cw.method(:number_of_words), @cw.method(:word_count) assert @cw.method(:words_including), @cw.method(:including) assert @cw.method(:words_no_longer_than), @cw.method(:no_longer_than) assert @cw.method(:words_no_shorter_than), @cw.method(:no_shorter_than) assert @cw.method(:random_alphanumeric), @cw.method(:random_letters_numbers) assert @cw.method(:comment), @cw.method(:name) end |
- (Object) test_name_can_be_set
34 35 36 37 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 34 def test_name_can_be_set @cw.name 'testing' assert_equal 'testing', @cw.name end |
- (Object) test_name_is_unnamed_if_unnamed
30 31 32 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 30 def test_name_is_unnamed_if_unnamed assert_equal 'unnamed', @cw.name end |
- (Object) test_no_longer_than_1
242 243 244 245 246 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 242 def test_no_longer_than_1 @cw.words = ['1', '12', '123'] @cw.no_longer_than(1) assert_equal ['1'], @cw.words end |
- (Object) test_no_longer_than_2
248 249 250 251 252 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 248 def test_no_longer_than_2 @cw.words = ['1', '12', '123'] @cw.no_longer_than(2) assert_equal ['1', '12'], @cw.words end |
- (Object) test_no_longer_than_will_return_words_no_longer_than_x
225 226 227 228 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 225 def test_no_longer_than_will_return_words_no_longer_than_x @cw.no_longer_than 4 assert_equal ["the", "of", "and", "a", "to"] , @cw.words.first(5) end |
- (Object) test_no_longer_than_with_no_match
254 255 256 257 258 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 254 def test_no_longer_than_with_no_match @cw.words = ['123', '1234', '12345'] @cw.no_longer_than(2) assert_equal [], @cw.words end |
- (Object) test_no_run_aliases_no_run
74 75 76 77 78 79 80 81 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 74 def test_no_run_aliases_no_run time = Time.now cw = CW.new { no_run } cw.words = ["some", " words"] assert (Time.now - time) < 1 end |
- (Object) test_no_shorter_than_1
290 291 292 293 294 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 290 def test_no_shorter_than_1 @cw.words = ['1', '12', '123'] @cw.no_shorter_than(1) assert_equal ['1', '12', '123'], @cw.words end |
- (Object) test_no_shorter_than_2
296 297 298 299 300 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 296 def test_no_shorter_than_2 @cw.words = ['1', '12', '123'] @cw.no_shorter_than(2) assert_equal ['12', '123'], @cw.words end |
- (Object) test_no_shorter_than_3
302 303 304 305 306 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 302 def test_no_shorter_than_3 @cw.words = ['1', '12', '123'] @cw.no_shorter_than(3) assert_equal ['123'], @cw.words end |
- (Object) test_no_shorter_than_will_return_words_no_shorter_than_x
230 231 232 233 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 230 def test_no_shorter_than_will_return_words_no_shorter_than_x @cw.no_shorter_than 4 assert_equal ["that", "with", "they", "this", "have"] , @cw.words.first(5) end |
- (Object) test_no_shorter_than_with_no_match
308 309 310 311 312 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 308 def test_no_shorter_than_with_no_match @cw.words = ['123', '1234', '12345'] @cw.no_shorter_than(4) assert_equal ['1234', '12345'], @cw.words end |
- (Object) test_play_command_returns_play_command
354 355 356 357 358 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 354 def test_play_command_returns_play_command assert_equal 567, @cw.play_command(567) @cw.play_command 456 assert_equal 456, @cw.play_command end |
- (Object) test_random_letters_can_take_count_option
260 261 262 263 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 260 def test_random_letters_can_take_count_option @cw.random_letters(count: 5) assert_equal 5, @cw.words.size end |
- (Object) test_random_letters_can_take_size_and_count_option
265 266 267 268 269 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 265 def test_random_letters_can_take_size_and_count_option @cw.random_letters(count: 3, size: 4) assert_equal 3, @cw.words.size @cw.words.each { |w| assert_equal 4, w.length} end |
- (Object) test_random_letters_can_take_size_option
255 256 257 258 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 255 def test_random_letters_can_take_size_option @cw.random_letters(size: 5) @cw.words.each { |w| assert_equal 5, w.length} end |
- (Object) test_random_letters_numbers_can_take_size_and_count_option
291 292 293 294 295 296 297 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 291 def test_random_letters_numbers_can_take_size_and_count_option @cw.random_letters_numbers(count: 3, size: 4) assert_equal 3, @cw.words.size @cw.words.each { |w| assert_equal 4, w.length } end |
- (Object) test_random_letters_numbers_includes_letter
299 300 301 302 303 304 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 299 def test_random_letters_numbers_includes_letter @cw.random_letters_numbers @cw.words.each { |w| assert_match( /[a-zA-Z]+/, w) } end |
- (Object) test_random_letters_numbers_includes_number
306 307 308 309 310 311 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 306 def test_random_letters_numbers_includes_number @cw.random_letters_numbers @cw.words.each do |w| assert_match(/[0-9]+/, w) end end |
- (Object) test_random_letters_returns_random_letters
271 272 273 274 275 276 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 271 def test_random_letters_returns_random_letters @cw.random_letters @cw.words.each { |w| assert_match(/^(?=.*\D)[-\w]+$/, w) } end |
- (Object) test_random_letters_returns_word_count_of_50_by_default
250 251 252 253 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 250 def test_random_letters_returns_word_count_of_50_by_default @cw.random_letters assert_equal 50, @cw.words.size end |
- (Object) test_random_letters_returns_words_of_size_4_by_default
245 246 247 248 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 245 def test_random_letters_returns_words_of_size_4_by_default @cw.random_letters @cw.words.each { |w| assert_equal 4, w.length} end |
- (Object) test_random_numbers_can_take_size_and_count_option
278 279 280 281 282 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 278 def test_random_numbers_can_take_size_and_count_option @cw.random_numbers(count: 3, size: 4) assert_equal 3, @cw.words.size @cw.words.each { |w| assert_equal 4, w.length} end |
- (Object) test_random_numbers_returns_random_numbers
284 285 286 287 288 289 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 284 def test_random_numbers_returns_random_numbers @cw.random_numbers @cw.words.each { |w| assert_match(/\A[-+]?\d+\z/ , w) } end |
- (Object) test_reload_reloads_dictionary
83 84 85 86 87 88 89 90 91 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 83 def test_reload_reloads_dictionary cw = CW.new { no_run } cw.words = ["some", "words"] assert_equal ["some", "words"], cw.words cw.reload assert_equal ["the", "of", "and", "a", "to"] , cw.words.first(5) end |
- (Object) test_reload_reuploads_new_words_ie_dictionary_updated
111 112 113 114 115 116 117 118 119 120 121 122 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 111 def test_reload_reuploads_new_words_ie_dictionary_updated temp = Tempfile.new("words.tmp") temp << "some more words" temp.close @cw.load_words(temp) assert_equal ["some", "more", "words"], @cw.words @cw.words = '' @cw.reload assert_equal ["some", "more", "words"], @cw.words @cw.load_common_words assert_equal ["the", "of", "and", "a", "to"] , @cw.words.first(5) end |
- (Object) test_repeat_none
367 368 369 370 371 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 367 def test_repeat_none @cw.words = ['1', '12', '123'] @cw.repeat 0 assert_equal ['1', '12', '123'], @cw.words end |
- (Object) test_repeat_once
356 357 358 359 360 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 356 def test_repeat_once @cw.words = ['1', '12', '123'] @cw.repeat 1 assert_equal ['1', '12', '123', '1', '12', '123'], @cw.words end |
- (Object) test_repeat_twice
362 363 364 365 366 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 362 def test_repeat_twice @cw.words = ['1', '12', '123'] @cw.repeat 2 assert_equal ['1', '12', '123', '1', '12', '123', '1', '12', '123'], @cw.words end |
- (Object) test_reverse_reverses_words
329 330 331 332 333 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 329 def test_reverse_reverses_words @cw.words = 'first then last' @cw.reverse assert_equal 'tsal neht tsrif', @cw.words end |
- (Object) test_set_audio_filename_to_given_name
455 456 457 458 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 455 def test_set_audio_filename_to_given_name @cw.audio_filename('some name') assert @cw.cl.cl_audio_filename.include?("some name"), 'default audio filename invalid' end |
- (Object) test_set_author_param
431 432 433 434 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 431 def @cw. 'some author' assert @cw.cl. == '-a "some author" ', 'author param invalid' end |
- (Object) test_set_B_param_in_noise_mode
446 447 448 449 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 446 def test_set_B_param_in_noise_mode @cw.noise assert @cw.cl.cl_noise.include?('-B 1000 '), 'noise B param invalid' end |
- (Object) test_set_default_filename
451 452 453 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 451 def test_set_default_filename assert @cw.cl.cl_audio_filename.include?('audio_output'), 'default audio output filename invalid' end |
- (Object) test_set_ewpm_param
395 396 397 398 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 395 def test_set_ewpm_param @cw.effective_wpm 33 assert @cw.cl.cl_effective_wpm == '-e 33 ', 'effective_wpm param invalid' end |
- (Object) test_set_freq_f_param
405 406 407 408 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 405 def test_set_freq_f_param @cw.frequency 800 assert @cw.cl.cl_frequency == '-f 800 ', 'frequency param invalid' end |
- (Object) test_set_high_quality
475 476 477 478 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 475 def test_set_high_quality @cw.quality :high assert @cw.cl.cl_quality.include?('-q 1 '), 'audio high quality invalid' end |
- (Object) test_set_low_quality
465 466 467 468 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 465 def test_set_low_quality @cw.quality :low assert @cw.cl.cl_quality.include?('-q 9 '), 'audio low quality invalid' end |
- (Object) test_set_medium_quality
470 471 472 473 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 470 def test_set_medium_quality @cw.quality :medium assert @cw.cl.cl_quality.include?('-q 5 '), 'audio medium quality invalid' end |
- (Object) test_set_N_param_in_noise_mode
441 442 443 444 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 441 def test_set_N_param_in_noise_mode @cw.noise assert @cw.cl.cl_noise.include?('-N 5 '), 'noise N param invalid' end |
- (Object) test_set_q_param_when_numeric_quality
460 461 462 463 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 460 def test_set_q_param_when_numeric_quality @cw.quality 5 assert @cw.cl.cl_quality.include?('-q 5 '), 'audio quality invalid' end |
- (Object) test_set_sawtooth_param
415 416 417 418 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 415 def test_set_sawtooth_param @cw.set_tone_type :sawtooth assert @cw.cl.cl_sawtooth == '-T 1 ', 'sawtooth param invalid' end |
- (Object) test_set_sinewave_param
420 421 422 423 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 420 def test_set_sinewave_param @cw.set_tone_type :sinewave assert @cw.cl.cl_sinewave == '-T 0 ', 'sinewave param invalid' end |
- (Object) test_set_squarewave_param
410 411 412 413 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 410 def test_set_squarewave_param @cw.set_tone_type :squarewave assert @cw.cl.cl_squarewave == '-T 2 ', 'squarewave param invalid' end |
- (Object) test_set_title_param
436 437 438 439 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 436 def test_set_title_param @cw.title 'some title' assert @cw.cl.cl_title == '-t "some title" ', 'title param invalid' end |
- (Object) test_set_word_spacing_W_param
400 401 402 403 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 400 def test_set_word_spacing_W_param @cw.word_spacing 2 assert @cw.cl.cl_word_spacing == '-W 2 ', 'word_spacing param invalid' end |
- (Object) test_set_wpm_param
390 391 392 393 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 390 def test_set_wpm_param @cw.wpm 33 assert @cw.cl.cl_wpm == '-w 33 ', 'wpm param invalid' end |
- (Object) test_shuffle_shuffles_words
178 179 180 181 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 178 def test_shuffle_shuffles_words @cw.shuffle refute_equal ["the", "of", "and", "a", "to"] , @cw.words.first(5) end |
- (Object) test_something
22 23 24 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 22 def test_something assert true end |
- (Object) test_to_s_outputs_relevant_params_if_set
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 134 def test_to_s_outputs_relevant_params_if_set temp = %q(unnamed ======= WPM: 25 Word count: 2 Word size: 3 Beginning: l Ending: x ======= ) @cw.word_count 2 @cw.word_size 3 @cw.ending_with('x') @cw.beginning_with('l') assert_equal temp, @cw.to_s end |
- (Object) test_to_s_outputs_test_run_header_if_no_rund
124 125 126 127 128 129 130 131 132 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 124 def test_to_s_outputs_test_run_header_if_no_rund temp = %q(unnamed ======= WPM: 25 ======= ) assert_equal temp, @cw.to_s end |
- (Object) test_true
22 23 24 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 22 def test_true assert true end |
- (Object) test_word_count_returns_x_words
210 211 212 213 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 210 def test_word_count_returns_x_words @cw.word_count 3 assert_equal ["the", "of", "and"] , @cw.words end |
- (Object) test_word_filename_defaults_to_words
66 67 68 69 70 71 72 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 66 def test_word_filename_defaults_to_words cw = CW.new { no_run } cw.words = ["some", "words"] assert_equal ["some","words"], cw.words end |
- (Object) test_word_length_1
409 410 411 412 413 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 409 def test_word_length_1 @cw.words = ['1', '12', '123'] @cw.word_length 1 assert_equal ['1'], @cw.words end |
- (Object) test_word_length_2
415 416 417 418 419 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 415 def test_word_length_2 @cw.words = ['1', '12', '23', '123'] @cw.word_length 2 assert_equal ['12','23'], @cw.words end |
- (Object) test_word_length_3
421 422 423 424 425 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 421 def test_word_length_3 @cw.words = ['1', '12', '23', '123'] @cw.word_length 3 assert_equal ['123'], @cw.words end |
- (Object) test_word_size_1
373 374 375 376 377 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 373 def test_word_size_1 @cw.words = ['1', '12', '123'] @cw.word_size 1 assert_equal ['1'], @cw.words end |
- (Object) test_word_size_2
379 380 381 382 383 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 379 def test_word_size_2 @cw.words = ['1', '12', '23', '123'] @cw.word_size 2 assert_equal ['12','23'], @cw.words end |
- (Object) test_word_size_3
385 386 387 388 389 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 385 def test_word_size_3 @cw.words = ['1', '12', '23', '123'] @cw.word_size 3 assert_equal ['123'], @cw.words end |
- (Object) test_word_size_returns_words_of_such_size
183 184 185 186 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 183 def test_word_size_returns_words_of_such_size @cw.word_size 2 assert_equal ["of", "to", "in", "is", "it"] , @cw.words.first(5) end |
- (Object) test_word_spacing_is_settable_and_readable
172 173 174 175 176 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 172 def test_word_spacing_is_settable_and_readable word_spacing = rand(50) @cw.word_spacing word_spacing assert_equal word_spacing, @cw.word_spacing end |
- (Object) test_words_beginning_with_a
62 63 64 65 66 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 62 def test_words_beginning_with_a @cw.words = ['able', 'zero'] @cw.words_beginning_with('a') assert_equal ['able'], @cw.words end |
- (Object) test_words_beginning_with_ab
74 75 76 77 78 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 74 def test_words_beginning_with_ab @cw.words = ['ardvark', 'able', 'zero'] @cw.words_beginning_with('ab') assert_equal ['able'], @cw.words end |
- (Object) test_words_beginning_with_range
80 81 82 83 84 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 80 def test_words_beginning_with_range @cw.words = ['able', 'delta', 'zero'] @cw.words_beginning_with('a'..'d') assert_equal ['able', 'delta'], @cw.words end |
- (Object) test_words_beginning_with_with_empty_string_returns_all
92 93 94 95 96 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 92 def test_words_beginning_with_with_empty_string_returns_all @cw.words = ['able', 'zero'] @cw.words_beginning_with('') assert_equal ['able', 'zero'], @cw.words end |
- (Object) test_words_beginning_with_with_no_match
86 87 88 89 90 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 86 def test_words_beginning_with_with_no_match @cw.words = ['able', 'zero'] @cw.words_beginning_with('b') assert_equal [], @cw.words end |
- (Object) test_words_beginning_with_z
68 69 70 71 72 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 68 def test_words_beginning_with_z @cw.words = ['able', 'zero'] @cw.words_beginning_with('z') assert_equal ['zero'], @cw.words end |
- (Object) test_words_ending_with_a
134 135 136 137 138 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 134 def test_words_ending_with_a @cw.words = ['else', 'antenna', 'alba', 'zero'] @cw.words_ending_with('a') assert_equal ['antenna', 'alba'], @cw.words end |
- (Object) test_words_ending_with_range
152 153 154 155 156 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 152 def test_words_ending_with_range @cw.words = ['may', 'kay', 'yam', 'eye', 'pizazz'] @cw.words_ending_with('y'..'z') assert_equal ['may', 'kay', 'pizazz'], @cw.words end |
- (Object) test_words_ending_with_tion
146 147 148 149 150 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 146 def test_words_ending_with_tion @cw.words = ['tiona', 'lion', 'station', 'creation'] @cw.words_ending_with('tion') assert_equal ['station', 'creation'], @cw.words end |
- (Object) test_words_ending_with_with_empty_string_returns_all
164 165 166 167 168 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 164 def test_words_ending_with_with_empty_string_returns_all @cw.words = ['able', 'zero'] @cw.words_ending_with('') assert_equal ['able', 'zero'], @cw.words end |
- (Object) test_words_ending_with_with_no_match
158 159 160 161 162 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 158 def test_words_ending_with_with_no_match @cw.words = ['able', 'zero'] @cw.words_ending_with('b') assert_equal [], @cw.words end |
- (Object) test_words_ending_with_z
140 141 142 143 144 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 140 def test_words_ending_with_z @cw.words = ['joy', 'pazazz'] @cw.words_ending_with('z') assert_equal ['pazazz'], @cw.words end |
- (Object) test_words_exist
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 494 def test_words_exist temp = nil CW.new do words = 'some words added here' temp = words no_run end assert_equal(4, temp.split.size) CW.new do @words.add 'a couple of words' temp = words no_run end assert_equal(4, temp.split.size) CW.new do @words.add nil temp = words no_run end assert_nil(temp) end |
- (Object) test_words_fn_adds_words
235 236 237 238 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 235 def test_words_fn_adds_words @cw.words = "one two three four" assert_equal "one two three four", @cw.words end |
- (Object) test_words_fn_passes_in_an_array_of_words_as_is
240 241 242 243 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 240 def test_words_fn_passes_in_an_array_of_words_as_is @cw.words = ["one", "two", "three", "four"] assert_equal ["one", "two", "three", "four"] , @cw.words end |
- (Object) test_words_including_a
206 207 208 209 210 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 206 def test_words_including_a @cw.words = ['else', 'banter', 'alt', 'zero'] @cw.words_including('a') assert_equal ['banter', 'alt'], @cw.words end |
- (Object) test_words_including_range
224 225 226 227 228 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 224 def test_words_including_range @cw.words = ['may', 'kay', 'yam', 'eye', 'pizazz'] @cw.words_including('g'..'k') assert_equal ['pizazz', 'kay'], @cw.words end |
- (Object) test_words_including_tion
218 219 220 221 222 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 218 def test_words_including_tion @cw.words = ['tiona', 'lion', 'station', 'creation'] @cw.words_including('tion') assert_equal ['tiona', 'station', 'creation'], @cw.words end |
- (Object) test_words_including_with_empty_string_returns_all
236 237 238 239 240 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 236 def test_words_including_with_empty_string_returns_all @cw.words = ['able', 'zero'] @cw.words_including('') assert_equal ['able', 'zero'], @cw.words end |
- (Object) test_words_including_with_no_match
230 231 232 233 234 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 230 def test_words_including_with_no_match @cw.words = ['able', 'zero'] @cw.words_including('c') assert_equal [], @cw.words end |
- (Object) test_words_including_z
212 213 214 215 216 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 212 def test_words_including_z @cw.words = ['joy', 'amaze', '123'] @cw.words_including('z') assert_equal ['amaze'], @cw.words end |
- (Object) test_words_no_longer_than_0
260 261 262 263 264 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 260 def test_words_no_longer_than_0 @cw.words = ['1', '12', '123'] @cw.words_no_longer_than(0) assert_equal [], @cw.words end |
- (Object) test_words_no_longer_than_1
266 267 268 269 270 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 266 def test_words_no_longer_than_1 @cw.words = ['1', '12', '123'] @cw.words_no_longer_than(1) assert_equal ['1'], @cw.words end |
- (Object) test_words_no_longer_than_2
272 273 274 275 276 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 272 def test_words_no_longer_than_2 @cw.words = ['1', '12', '123'] @cw.words_no_longer_than(2) assert_equal ['1', '12'], @cw.words end |
- (Object) test_words_no_longer_than_with_words_no_match
278 279 280 281 282 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 278 def test_words_no_longer_than_with_words_no_match @cw.words = ['123', '1234', '12345'] @cw.words_no_longer_than(2) assert_equal [], @cw.words end |
- (Object) test_words_no_shorter_than_0
314 315 316 317 318 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 314 def test_words_no_shorter_than_0 @cw.words = ['1', '12', '123'] @cw.words_no_shorter_than(0) assert_equal ['1', '12', '123'], @cw.words end |
- (Object) test_words_no_shorter_than_1
320 321 322 323 324 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 320 def test_words_no_shorter_than_1 @cw.words = ['1', '12', '123'] @cw.words_no_shorter_than(1) assert_equal ['1', '12', '123'], @cw.words end |
- (Object) test_words_no_shorter_than_2
326 327 328 329 330 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 326 def test_words_no_shorter_than_2 @cw.words = ['1', '12', '123'] @cw.words_no_shorter_than(2) assert_equal ['12', '123'], @cw.words end |
- (Object) test_words_no_shorter_than_3
332 333 334 335 336 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 332 def test_words_no_shorter_than_3 @cw.words = ['1', '12', '123'] @cw.words_no_shorter_than(3) assert_equal ['123'], @cw.words end |
- (Object) test_words_no_shorter_than_with_words_no_match
338 339 340 341 342 |
# File '/Users/martyn/cw/cw_clone/test/test_filtering.rb', line 338 def test_words_no_shorter_than_with_words_no_match @cw.words = ['123', '1234', '12345'] @cw.words_no_shorter_than(4) assert_equal ['1234', '12345'], @cw.words end |
- (Object) test_wpm_defaults_to_25_if_unset
152 153 154 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 152 def test_wpm_defaults_to_25_if_unset assert_equal '25', @cw.wpm.to_s end |
- (Object) test_wpm_is_settable
160 161 162 163 164 |
# File '/Users/martyn/cw/cw_clone/test/test_cw.rb', line 160 def test_wpm_is_settable wpm = rand(50) @cw.wpm wpm assert_equal wpm, @cw.wpm end |