Sha256: 75ddee0c3fd08e8f3f361c21002ee8ceb1d76b435659adbe0ce9ce11a328ab0b

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

(ns rotational-cipher-test
  (:require  [clojure.test :refer [deftest is testing]]
             rotational-cipher))

(deftest rotational-cipher-test
  (testing "rotate a by 1"
    (is (= (rotational-cipher/rotate "a" 1) "b")))

  (testing "rotate a by 26, same output as input"
    (is (= (rotational-cipher/rotate "a" 26) "a")))

  (testing "rotate a by 0, same output as input"
    (is (= (rotational-cipher/rotate "a" 0) "a")))

  (testing "rotate m by 13"
    (is (= (rotational-cipher/rotate "m" 13) "z")))

  (testing "rotate n by 13 with wrap around alphabet"
    (is (= (rotational-cipher/rotate "n" 13) "a")))

  (testing "rotate capital letters"
    (is (= (rotational-cipher/rotate "OMG" 5) "TRL")))

  (testing "rotate spaces"
    (is (= (rotational-cipher/rotate "O M G" 5) "T R L")))
  
  (testing "rotate numbers"
    (is (= (rotational-cipher/rotate "Testing 1 2 3 testing" 4) "Xiwxmrk 1 2 3 xiwxmrk")))

  (testing "rotate punctuation"
    (is (= (rotational-cipher/rotate "Let's eat, Grandma!" 21) "Gzo'n zvo, Bmviyhv!")))

  (testing "rotate all letters"
    (is (= (rotational-cipher/rotate "The quick brown fox jumps over the lazy dog." 13) "Gur dhvpx oebja sbk whzcf bire gur ynml qbt."))))

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
trackler-2.1.0.53 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.52 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.51 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.50 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.49 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.48 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.47 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.46 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.45 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.44 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj
trackler-2.1.0.43 tracks/clojure/exercises/rotational-cipher/test/rotational_cipher_test.clj