Sha256: 94dbdec10a13bdf3725d01c7029fcc01274d4ac42276668f5f6fb65b0c576937

Contents?: true

Size: 1.94 KB

Versions: 396

Compression:

Stored size: 1.94 KB

Contents

(ns crypto-square-test
  (:require [clojure.test :refer [deftest is]]
            crypto-square))

(deftest normalize-splunk
  (is (= "splunk" (crypto-square/normalize-plaintext "s#!@$%plunk"))))
(deftest normalize-with-punctuation
  (is (= "123go" (crypto-square/normalize-plaintext "1, 2, 3 GO!"))))

(deftest square-2
  (is (= 2 (crypto-square/square-size "1234"))))
(deftest square-3
  (is (= 3 (crypto-square/square-size "123456789"))))
(deftest square-4
  (is (= 4 (crypto-square/square-size "123456789abc"))))

(deftest segments
  (is (= ["neverv", "exthin", "eheart", "withid", "lewoes"]
         (crypto-square/plaintext-segments "Never vex thine heart with idle woes."))))
(deftest segments-2
  (is (= ["zomg", "zomb", "ies"]
         (crypto-square/plaintext-segments "ZOMG! ZOMBIES!!!"))))

(deftest cipher-1
  (is (= "tasneyinicdsmiohooelntuillibsuuml"
         (crypto-square/ciphertext "Time is an illusion. Lunchtime doubly so."))))
(deftest cipher-2
  (is (= "wneiaweoreneawssciliprerlneoidktcms"
         (crypto-square/ciphertext "We all know interspecies romance is weird."))))
(deftest cipher-3
  (is (= "msemo aanin dnin ndla etlt shui"
         (crypto-square/normalize-ciphertext "Madness, and then illumination."))))
(deftest cipher-4
  (is (= "vrel aepe mset paoo irpo"
         (crypto-square/normalize-ciphertext "Vampires are people too!"))))
(deftest cipher-5
  (is (= (str "ageihdsednsh lsagtoonaepe lannswnccair hrditeaetnrh "
              "ueethdnatoio mbqyewdnotto aouayicdwhod nranatosaef "
              "bnldrhnhrrb efirersodir irnieecusno nedgnailoat")
         (let [plaintext (str "All human beings are born free "
                              "and equal in dignity and rights. "
                              "They are endowed with reason and conscience "
                              "and should act towards one another "
                              "in a spirit of brotherhood.")]
           (crypto-square/normalize-ciphertext plaintext)))))

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.179 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.178 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.177 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.176 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.175 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.174 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.173 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.172 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.171 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.170 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.169 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.167 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.166 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.165 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.164 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.163 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.162 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.161 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj
trackler-2.2.1.160 tracks/clojure/exercises/crypto-square/test/crypto_square_test.clj