diff options
Diffstat (limited to 'clojure/reverse-string/test')
-rw-r--r-- | clojure/reverse-string/test/reverse_string_test.clj | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/clojure/reverse-string/test/reverse_string_test.clj b/clojure/reverse-string/test/reverse_string_test.clj new file mode 100644 index 0000000..f80d06a --- /dev/null +++ b/clojure/reverse-string/test/reverse_string_test.clj @@ -0,0 +1,29 @@ +(ns reverse-string-test + (:require [clojure.test :refer [deftest is]] + reverse-string)) + +(deftest empty-string-test + (is (= "" (reverse-string/reverse-string "")))) + +(deftest a-letter-test + (is (= "I" (reverse-string/reverse-string "I")))) + +(deftest a-word-test + (is (= "tobor" (reverse-string/reverse-string "robot")))) + +(deftest capitalised-word-test + (is (= "nemaR" (reverse-string/reverse-string "Ramen")))) + +(deftest sentence-with-punctuation-test + (is (= "!yrgnuh m'I" (reverse-string/reverse-string "I'm hungry!")))) + +(deftest palindrome-test + (is (= "racecar" (reverse-string/reverse-string "racecar")))) + +(deftest even-sized-word-test + (is (= "reward" (reverse-string/reverse-string "drawer")))) + +(deftest long-string-test + (let [s (reduce str (repeat 1000 "overflow?")) + rs (reduce str (repeat 1000 "?wolfrevo"))] + (is (= rs (reverse-string/reverse-string s))))) |