aboutsummaryrefslogtreecommitdiff
path: root/rust/bob/tests
diff options
context:
space:
mode:
Diffstat (limited to 'rust/bob/tests')
-rw-r--r--rust/bob/tests/bob.rs179
1 files changed, 179 insertions, 0 deletions
diff --git a/rust/bob/tests/bob.rs b/rust/bob/tests/bob.rs
new file mode 100644
index 0000000..b6221eb
--- /dev/null
+++ b/rust/bob/tests/bob.rs
@@ -0,0 +1,179 @@
1fn process_response_case(phrase: &str, expected_response: &str) {
2 assert_eq!(bob::reply(phrase), expected_response);
3}
4
5#[test]
6/// stating something
7fn test_stating_something() {
8 process_response_case("Tom-ay-to, tom-aaaah-to.", "Whatever.");
9}
10
11
12#[test]
13/// ending with whitespace
14fn test_ending_with_whitespace() {
15 process_response_case("Okay if like my spacebar quite a bit? ", "Sure.");
16}
17
18
19#[test]
20/// shouting numbers
21fn test_shouting_numbers() {
22 process_response_case("1, 2, 3 GO!", "Whoa, chill out!");
23}
24
25
26#[test]
27/// other whitespace
28fn test_other_whitespace() {
29 process_response_case("\r\r ", "Fine. Be that way!");
30}
31
32
33#[test]
34/// shouting with special characters
35fn test_shouting_with_special_characters() {
36 process_response_case("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!", "Whoa, chill out!");
37}
38
39
40#[test]
41/// talking forcefully
42fn test_talking_forcefully() {
43 process_response_case("Hi there!", "Whatever.");
44}
45
46
47#[test]
48/// prattling on
49fn test_prattling_on() {
50 process_response_case("Wait! Hang on. Are you going to be OK?", "Sure.");
51}
52
53
54#[test]
55/// forceful question
56fn test_forceful_question() {
57 process_response_case("WHAT'S GOING ON?", "Calm down, I know what I'm doing!");
58}
59
60
61#[test]
62/// shouting with no exclamation mark
63fn test_shouting_with_no_exclamation_mark() {
64 process_response_case("I HATE THE DENTIST", "Whoa, chill out!");
65}
66
67
68#[test]
69/// asking gibberish
70fn test_asking_gibberish() {
71 process_response_case("fffbbcbeab?", "Sure.");
72}
73
74
75#[test]
76/// question with no letters
77fn test_question_with_no_letters() {
78 process_response_case("4?", "Sure.");
79}
80
81
82#[test]
83/// no letters
84fn test_no_letters() {
85 process_response_case("1, 2, 3", "Whatever.");
86}
87
88
89#[test]
90/// statement containing question mark
91fn test_statement_containing_question_mark() {
92 process_response_case("Ending with ? means a question.", "Whatever.");
93}
94
95
96//NEW
97#[test]
98/// multiple line question
99fn test_multiple_line_question() {
100 process_response_case("\rDoes this cryogenic chamber make me look fat?\rNo.", "Whatever.");
101}
102
103
104#[test]
105/// non-question ending with whitespace
106fn test_nonquestion_ending_with_whitespace() {
107 process_response_case("This is a statement ending with whitespace ", "Whatever.");
108}
109
110
111#[test]
112/// shouting
113fn test_shouting() {
114 process_response_case("WATCH OUT!", "Whoa, chill out!");
115}
116
117
118#[test]
119/// non-letters with question
120fn test_nonletters_with_question() {
121 process_response_case(":) ?", "Sure.");
122}
123
124
125#[test]
126/// shouting gibberish
127fn test_shouting_gibberish() {
128 process_response_case("FCECDFCAAB", "Whoa, chill out!");
129}
130
131
132#[test]
133/// asking a question
134fn test_asking_a_question() {
135 process_response_case("Does this cryogenic chamber make me look fat?", "Sure.");
136}
137
138
139#[test]
140/// asking a numeric question
141fn test_asking_a_numeric_question() {
142 process_response_case("You are, what, like 15?", "Sure.");
143}
144
145
146#[test]
147/// silence
148fn test_silence() {
149 process_response_case("", "Fine. Be that way!");
150}
151
152
153#[test]
154/// starting with whitespace
155fn test_starting_with_whitespace() {
156 process_response_case(" hmmmmmmm...", "Whatever.");
157}
158
159
160#[test]
161/// using acronyms in regular speech
162fn test_using_acronyms_in_regular_speech() {
163 process_response_case("It's OK if you don't want to go work for NASA.", "Whatever.");
164}
165
166
167#[test]
168/// alternate silence
169fn test_alternate_silence() {
170 process_response_case(" ", "Fine. Be that way!");
171}
172
173
174#[test]
175/// prolonged silence
176fn test_prolonged_silence() {
177 process_response_case(" ", "Fine. Be that way!");
178}
179