-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbob_test.rb
More file actions
executable file
·131 lines (99 loc) · 3.18 KB
/
bob_test.rb
File metadata and controls
executable file
·131 lines (99 loc) · 3.18 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
require_relative 'bob'
class BobTest < Minitest::Test
def bob
::Bob.new
end
def feedback(text)
"Bob hears #{text.inspect}, and.."
end
def test_stating_something
remark = 'Tom-ay-to, tom-aaaah-to.'
assert_equal 'Whatever.', bob.hey(remark), feedback(remark)
end
def test_shouting
remark = 'WATCH OUT!'
assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark)
end
def test_shouting_gibberish
remark = ('A'..'Z').to_a.sample(10).join
assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark)
end
def test_asking_a_question
remark = 'Does this cryogenic chamber make me look fat?'
assert_equal 'Sure.', bob.hey(remark), feedback(remark)
end
def test_asking_a_numeric_question
remark = 'You are, what, like 15?'
assert_equal 'Sure.', bob.hey(remark), feedback(remark)
end
def test_asking_gibberish
remark = ('a'..'z').to_a.sample(10).join << '?'
assert_equal 'Sure.', bob.hey(remark), feedback(remark)
end
def test_talking_forcefully
remark = "Let's go make out behind the gym!"
assert_equal 'Whatever.', bob.hey(remark), feedback(remark)
end
def test_using_acronyms_in_regular_speech
remark = "It's OK if you don't want to go to the DMV."
assert_equal 'Whatever.', bob.hey(remark), feedback(remark)
end
def test_forceful_questions
remark = 'WHAT THE HELL WERE YOU THINKING?'
assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark)
end
def test_shouting_numbers
remark = '1, 2, 3 GO!'
assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark)
end
def test_only_numbers
remark = '1, 2, 3'
assert_equal 'Whatever.', bob.hey(remark), feedback(remark)
end
def test_question_with_only_numbers
remark = '4?'
assert_equal 'Sure.', bob.hey(remark), feedback(remark)
end
def test_shouting_with_special_characters
remark = 'ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!'
assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark)
end
def test_shouting_with_no_exclamation_mark
remark = 'I HATE YOU'
assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark)
end
def test_statement_containing_question_mark
remark = 'Ending with ? means a question.'
assert_equal 'Whatever.', bob.hey(remark), feedback(remark)
end
def test_prattling_on
skip
remark = 'Wait! Hang on. Are you going to be OK?'
assert_equal 'Sure.', bob.hey(remark), feedback(remark)
end
def test_silence
skip
remark = ''
assert_equal 'Fine. Be that way!', bob.hey(remark), feedback(remark)
end
def test_prolonged_silence
skip
remark = ' ' * rand(1..10)
assert_equal 'Fine. Be that way!', bob.hey(remark), feedback(remark)
end
def test_alternate_silences
skip
remark = "\t" * rand(1..10)
assert_equal 'Fine. Be that way!', bob.hey(remark), feedback(remark)
end
def test_on_multiple_line_questions
skip
remark = %(
Does this cryogenic chamber make me look fat?
no)
assert_equal 'Whatever.', bob.hey(remark), feedback(remark)
end
end