From 708ed21ef98343bf39c2426c762f6ce930955460 Mon Sep 17 00:00:00 2001 From: Andinus Date: Sun, 5 Sep 2021 23:16:32 +0530 Subject: Clojure: Reverse String: Add solution --- .../reverse-string/test/reverse_string_test.clj | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 clojure/reverse-string/test/reverse_string_test.clj (limited to 'clojure/reverse-string/test') 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))))) -- cgit 1.4.1-2-gfad0