Facebook
From Whipped Lion, 2 Years ago, written in Clojure.
Embed
Download Paste or View Raw
Hits: 73
  1. (ns reverse-string-test
  2.   (:require [clojure.test :refer [deftest is]]
  3.             reverse-string))
  4.  
  5. (deftest empty-string-test
  6.   (is (= "" (reverse-string/reverse-string ""))))
  7.  
  8. (deftest a-letter-test
  9.   (is (= "I" (reverse-string/reverse-string "I"))))
  10.  
  11. (deftest a-word-test
  12.   (is (= "tobor" (reverse-string/reverse-string "robot"))))
  13.  
  14. (deftest capitalised-word-test
  15.   (is (= "nemaR" (reverse-string/reverse-string "Ramen"))))
  16.  
  17. (deftest sentence-with-punctuation-test
  18.   (is (= "!yrgnuh m'I" (reverse-string/reverse-string "I'm hungry!"))))
  19.  
  20. (deftest palindrome-test
  21.   (is (= "racecar" (reverse-string/reverse-string "racecar"))))
  22.  
  23. (deftest even-sized-word-test
  24.   (is (= "reward" (reverse-string/reverse-string "drawer"))))
  25.  
  26. (deftest long-string-test
  27.   (let [s (reduce str (repeat 1000 "overflow?"))
  28.         rs (reduce str (repeat 1000 "?wolfrevo"))]
  29.     (is (= rs (reverse-string/reverse-string s)))))