summary refs log tree commit diff stats
path: root/clojure/reverse-string/test
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-09-05 23:16:32 +0530
committerAndinus <andinus@nand.sh>2021-09-05 23:16:32 +0530
commit708ed21ef98343bf39c2426c762f6ce930955460 (patch)
treebe220aa2684eac99c6f5986b6d658d769cecb105 /clojure/reverse-string/test
parent0fc602466192345311ba632da3ff456f20b9913c (diff)
downloadexercism-708ed21ef98343bf39c2426c762f6ce930955460.tar.gz
Clojure: Reverse String: Add solution
Diffstat (limited to 'clojure/reverse-string/test')
-rw-r--r--clojure/reverse-string/test/reverse_string_test.clj29
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)))))