Exercism: Rust version of the 'Bob' exercise.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
3.8 KiB

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