Skip to content
This repository was archived by the owner on Feb 11, 2018. It is now read-only.

Commit

Permalink
Update bob test to exit non-zero on failures
Browse files Browse the repository at this point in the history
  • Loading branch information
mbertheau committed May 22, 2015
1 parent 89493f7 commit b89e1b9
Showing 1 changed file with 46 additions and 40 deletions.
86 changes: 46 additions & 40 deletions bob/bob-test.rkt
Original file line number Diff line number Diff line change
@@ -1,64 +1,70 @@
#lang racket

(require rackunit
rackunit/text-ui
"bob.rkt")

(check-equal? (hey "Tom-ay-to, tom-aaaah-to.")
"Whatever." "stating something")
(define suite
(test-suite
"Tests for the bob exercise"
(check-equal? (hey "Tom-ay-to, tom-aaaah-to.")
"Whatever." "stating something")

(check-equal? (hey "WATCH OUT!")
"Whoa, chill out!" "shouting")
(check-equal? (hey "WATCH OUT!")
"Whoa, chill out!" "shouting")

(check-equal? (hey "Does this cryogenic chamber make me look fat?")
"Sure." "asking a question")
(check-equal? (hey "Does this cryogenic chamber make me look fat?")
"Sure." "asking a question")

(check-equal? (hey "You are, what, like 15?")
"Sure." "asking a numeric question")
(check-equal? (hey "You are, what, like 15?")
"Sure." "asking a numeric question")

(check-equal? (hey "Let's go make out behind the gym!")
"Whatever." "talking forcefully")
(check-equal? (hey "Let's go make out behind the gym!")
"Whatever." "talking forcefully")

(check-equal? (hey "It's OK if you don't want to go to the DMV.")
"Whatever." "using acronyms in regular speech")
(check-equal? (hey "It's OK if you don't want to go to the DMV.")
"Whatever." "using acronyms in regular speech")

(check-equal? (hey "WHAT THE HELL WERE YOU THINKING?")
"Whoa, chill out!" "forceful questions")
(check-equal? (hey "WHAT THE HELL WERE YOU THINKING?")
"Whoa, chill out!" "forceful questions")

(check-equal? (hey "1, 2, 3 GO!")
"Whoa, chill out!" "shouting numbers")
(check-equal? (hey "1, 2, 3 GO!")
"Whoa, chill out!" "shouting numbers")

(check-equal? (hey "1, 2, 3")
"Whatever." "only numbers")
(check-equal? (hey "1, 2, 3")
"Whatever." "only numbers")

(check-equal? (hey "4?")
"Sure." "question with only numbers")
(check-equal? (hey "4?")
"Sure." "question with only numbers")

(check-equal? (hey "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")
"Whoa, chill out!" "shouting with special characters")
(check-equal? (hey "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")
"Whoa, chill out!" "shouting with special characters")

(check-equal? (hey "ÜMLÄÜTS!")
"Whoa, chill out!" "shouting with umlauts")
(check-equal? (hey "ÜMLÄÜTS!")
"Whoa, chill out!" "shouting with umlauts")

(check-equal? (hey "ÜMLäÜTS!")
"Whatever." "calmly speaking with umlauts")
(check-equal? (hey "ÜMLäÜTS!")
"Whatever." "calmly speaking with umlauts")

(check-equal? (hey "I HATE YOU")
"Whoa, chill out!" "shouting with no exclamation mark")
(check-equal? (hey "I HATE YOU")
"Whoa, chill out!" "shouting with no exclamation mark")

(check-equal? (hey "Ending with ? means a question.")
"Whatever." "statement containing question mark")
(check-equal? (hey "Ending with ? means a question.")
"Whatever." "statement containing question mark")

(check-equal? (hey "Wait! Hang on. Are you going to be OK?")
"Sure." "prattling on")
(check-equal? (hey "Wait! Hang on. Are you going to be OK?")
"Sure." "prattling on")

(check-equal? (hey "")
"Fine. Be that way!" "silence")
(check-equal? (hey "")
"Fine. Be that way!" "silence")

(check-equal? (hey " \t")
"Fine. Be that way!" "prolonged silence")
(check-equal? (hey " \t")
"Fine. Be that way!" "prolonged silence")

(check-equal? (hey " hmmmmmmm...")
"Whatever." "starts with whitespace")
(check-equal? (hey " hmmmmmmm...")
"Whatever." "starts with whitespace")

(check-equal? (hey "What if we end with whitespace? ")
"Sure." "ends with whitespace")
(check-equal? (hey "What if we end with whitespace? ")
"Sure." "ends with whitespace")))

(exit (if (zero? (run-tests suite)) 0 1))

0 comments on commit b89e1b9

Please sign in to comment.