|
1 | 1 | extern crate bob;
|
2 | 2 |
|
| 3 | +fn process_response_case(phrase: &str, expected_response: &str) { |
| 4 | + assert_eq!(bob::reply(phrase), expected_response); |
| 5 | +} |
| 6 | + |
3 | 7 | #[test]
|
4 | 8 | fn test_stating_something() {
|
5 |
| - assert_eq!("Whatever.", bob::reply("Tom-ay-to, tom-aaaah-to.")); |
| 9 | + process_response_case("Tom-ay-to, tom-aaaah-to.", "Whatever."); |
6 | 10 | }
|
7 | 11 |
|
8 | 12 | #[test]
|
9 | 13 | #[ignore]
|
10 | 14 | fn test_shouting() {
|
11 |
| - assert_eq!("Whoa, chill out!", bob::reply("WATCH OUT!")); |
| 15 | + process_response_case("WATCH OUT!", "Whoa, chill out!"); |
12 | 16 | }
|
13 | 17 |
|
14 | 18 | #[test]
|
15 | 19 | #[ignore]
|
16 | 20 | fn test_shouting_gibberish() {
|
17 |
| - assert_eq!("Whoa, chill out!", bob::reply("FCECDFCAAB")); |
| 21 | + process_response_case("FCECDFCAAB", "Whoa, chill out!"); |
18 | 22 | }
|
19 | 23 |
|
20 | 24 | #[test]
|
21 | 25 | #[ignore]
|
22 |
| -fn test_asking() { |
23 |
| - assert_eq!( |
24 |
| - "Sure.", |
25 |
| - bob::reply("Does this cryogenic chamber make me look fat?") |
26 |
| - ); |
| 26 | +fn test_asking_a_question() { |
| 27 | + process_response_case("Does this cryogenic chamber make me look fat?", "Sure."); |
27 | 28 | }
|
28 | 29 |
|
29 | 30 | #[test]
|
30 | 31 | #[ignore]
|
31 |
| -fn test_ask_numeric_question() { |
32 |
| - assert_eq!("Sure.", bob::reply("You are, what, like 15?")); |
| 32 | +fn test_asking_a_numeric_question() { |
| 33 | + process_response_case("You are, what, like 15?", "Sure."); |
33 | 34 | }
|
34 | 35 |
|
35 | 36 | #[test]
|
36 | 37 | #[ignore]
|
37 | 38 | fn test_asking_gibberish() {
|
38 |
| - assert_eq!("Sure.", bob::reply("fffbbcbeab?")); |
| 39 | + process_response_case("fffbbcbeab?", "Sure."); |
39 | 40 | }
|
40 | 41 |
|
41 | 42 | #[test]
|
42 | 43 | #[ignore]
|
43 |
| -fn test_exclaiming() { |
44 |
| - assert_eq!("Whatever.", bob::reply("Let's go make out behind the gym!")); |
| 44 | +fn test_talking_forcefully() { |
| 45 | + process_response_case("Let's go make out behind the gym!", "Whatever."); |
45 | 46 | }
|
46 | 47 |
|
47 | 48 | #[test]
|
48 | 49 | #[ignore]
|
49 | 50 | fn test_using_acronyms_in_regular_speech() {
|
50 |
| - assert_eq!( |
51 |
| - "Whatever.", |
52 |
| - bob::reply("It's OK if you don't want to go to the DMV.") |
53 |
| - ); |
| 51 | + process_response_case("It's OK if you don't want to go to the DMV.", "Whatever."); |
54 | 52 | }
|
55 | 53 |
|
56 | 54 | #[test]
|
57 | 55 | #[ignore]
|
58 | 56 | fn test_forceful_question() {
|
59 |
| - assert_eq!( |
| 57 | + process_response_case( |
| 58 | + "WHAT THE HELL WERE YOU THINKING?", |
60 | 59 | "Calm down, I know what I'm doing!",
|
61 |
| - bob::reply("WHAT THE HELL WERE YOU THINKING?") |
62 | 60 | );
|
63 | 61 | }
|
64 | 62 |
|
65 | 63 | #[test]
|
66 | 64 | #[ignore]
|
67 | 65 | fn test_shouting_numbers() {
|
68 |
| - assert_eq!("Whoa, chill out!", bob::reply("1, 2, 3 GO!")); |
| 66 | + process_response_case("1, 2, 3 GO!", "Whoa, chill out!"); |
69 | 67 | }
|
70 | 68 |
|
71 | 69 | #[test]
|
72 | 70 | #[ignore]
|
73 |
| -fn test_only_numbers() { |
74 |
| - assert_eq!("Whatever.", bob::reply("1, 2, 3")); |
| 71 | +fn test_no_letters() { |
| 72 | + process_response_case("1, 2, 3", "Whatever."); |
75 | 73 | }
|
76 | 74 |
|
77 | 75 | #[test]
|
78 | 76 | #[ignore]
|
79 |
| -fn test_question_with_only_numbers() { |
80 |
| - assert_eq!("Sure.", bob::reply("4?")); |
| 77 | +fn test_question_with_no_letters() { |
| 78 | + process_response_case("4?", "Sure."); |
81 | 79 | }
|
82 | 80 |
|
83 | 81 | #[test]
|
84 | 82 | #[ignore]
|
85 | 83 | fn test_shouting_with_special_characters() {
|
86 |
| - assert_eq!( |
| 84 | + process_response_case( |
| 85 | + "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!", |
87 | 86 | "Whoa, chill out!",
|
88 |
| - bob::reply("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!") |
89 | 87 | );
|
90 | 88 | }
|
91 | 89 |
|
92 | 90 | #[test]
|
93 | 91 | #[ignore]
|
94 | 92 | fn test_shouting_with_no_exclamation_mark() {
|
95 |
| - assert_eq!("Whoa, chill out!", bob::reply("I HATE YOU")); |
| 93 | + process_response_case("I HATE THE DMV", "Whoa, chill out!"); |
96 | 94 | }
|
97 | 95 |
|
98 | 96 | #[test]
|
99 | 97 | #[ignore]
|
100 | 98 | fn test_statement_containing_question_mark() {
|
101 |
| - assert_eq!("Whatever.", bob::reply("Ending with ? means a question.")); |
| 99 | + process_response_case("Ending with ? means a question.", "Whatever."); |
102 | 100 | }
|
103 | 101 |
|
104 | 102 | #[test]
|
105 | 103 | #[ignore]
|
106 |
| -fn test_non_letters_with_question() { |
107 |
| - assert_eq!("Sure.", bob::reply(":) ?")); |
| 104 | +fn test_nonletters_with_question() { |
| 105 | + process_response_case(":) ?", "Sure."); |
108 | 106 | }
|
109 | 107 |
|
110 | 108 | #[test]
|
111 | 109 | #[ignore]
|
112 | 110 | fn test_prattling_on() {
|
113 |
| - assert_eq!( |
114 |
| - "Sure.", |
115 |
| - bob::reply("Wait! Hang on. Are you going to be OK?") |
116 |
| - ); |
| 111 | + process_response_case("Wait! Hang on. Are you going to be OK?", "Sure."); |
117 | 112 | }
|
118 | 113 |
|
119 | 114 | #[test]
|
120 | 115 | #[ignore]
|
121 | 116 | fn test_silence() {
|
122 |
| - assert_eq!("Fine. Be that way!", bob::reply("")); |
| 117 | + process_response_case("", "Fine. Be that way!"); |
123 | 118 | }
|
124 | 119 |
|
125 | 120 | #[test]
|
126 | 121 | #[ignore]
|
127 | 122 | fn test_prolonged_silence() {
|
128 |
| - assert_eq!("Fine. Be that way!", bob::reply(" ")); |
| 123 | + process_response_case(" ", "Fine. Be that way!"); |
129 | 124 | }
|
130 | 125 |
|
131 | 126 | #[test]
|
132 | 127 | #[ignore]
|
133 | 128 | fn test_alternate_silence() {
|
134 |
| - assert_eq!("Fine. Be that way!", bob::reply("\t\t\t\t\t\t\t\t\t\t")); |
| 129 | + process_response_case("\t\t\t\t\t\t\t\t\t\t", "Fine. Be that way!"); |
135 | 130 | }
|
136 | 131 |
|
137 | 132 | #[test]
|
138 | 133 | #[ignore]
|
139 | 134 | fn test_multiple_line_question() {
|
140 |
| - assert_eq!( |
| 135 | + process_response_case( |
| 136 | + "\nDoes this cryogenic chamber make me look fat?\nNo.", |
141 | 137 | "Whatever.",
|
142 |
| - bob::reply("\nDoes this cryogenic chamber make me look fat?\nno") |
143 | 138 | );
|
144 | 139 | }
|
145 | 140 |
|
146 | 141 | #[test]
|
147 | 142 | #[ignore]
|
148 | 143 | fn test_starting_with_whitespace() {
|
149 |
| - assert_eq!("Whatever.", bob::reply(" hmmmmmmm...")); |
| 144 | + process_response_case(" hmmmmmmm...", "Whatever."); |
150 | 145 | }
|
151 | 146 |
|
152 | 147 | #[test]
|
153 | 148 | #[ignore]
|
154 | 149 | fn test_ending_with_whitespace() {
|
155 |
| - assert_eq!( |
156 |
| - "Sure.", |
157 |
| - bob::reply("Okay if like my spacebar quite a bit? ") |
158 |
| - ); |
| 150 | + process_response_case("Okay if like my spacebar quite a bit? ", "Sure."); |
159 | 151 | }
|
160 | 152 |
|
161 | 153 | #[test]
|
162 | 154 | #[ignore]
|
163 | 155 | fn test_other_whitespace() {
|
164 |
| - assert_eq!("Fine. Be that way!", bob::reply("\n\r \t")); |
| 156 | + process_response_case("\n\r \t", "Fine. Be that way!"); |
165 | 157 | }
|
166 | 158 |
|
167 | 159 | #[test]
|
168 | 160 | #[ignore]
|
169 |
| -fn test_non_question_ending_with_whitespace() { |
170 |
| - assert_eq!( |
| 161 | +fn test_nonquestion_ending_with_whitespace() { |
| 162 | + process_response_case( |
| 163 | + "This is a statement ending with whitespace ", |
171 | 164 | "Whatever.",
|
172 |
| - bob::reply("This is a statement ending with whitespace ") |
173 | 165 | );
|
174 | 166 | }
|
0 commit comments