Sha256: 4edd5ee124386308a6a06fb0cd41b1089dd5766d2a6f0175f8e4389d8cb96932

Contents?: true

Size: 1.74 KB

Versions: 240

Compression:

Stored size: 1.74 KB

Contents

(ns secret-handshake-test
  (:require [clojure.test :refer [deftest testing is]]
            secret-handshake))

(deftest wink
  (testing "a wink is returned for binary 1"
    (is (= ["wink"] (secret-handshake/commands 1)))))

(deftest double-blink
  (testing "a double blink is returned for a binary 10"
    (is (= ["double blink"] (secret-handshake/commands 2)))))

(deftest close-your-eyes
  (testing "a close your eyes is returned for a binary 100"
    (is (= ["close your eyes"] (secret-handshake/commands 4)))))

(deftest jump
  (testing "a jump is returned for a binary 1000"
    (is (= ["jump"] (secret-handshake/commands 8)))))

(deftest two-actions
  (testing "commands returns multiple actions"
    (is (= ["wink" "double blink"] (secret-handshake/commands 3)))))

(deftest reversing
  (testing "giving a binary 10000 reverses actions"
    (is (= ["double blink" "wink"] (secret-handshake/commands 19)))))

(deftest reversing-one-action
  (testing "reversing one action returns the same action"
    (is (= ["jump"] (secret-handshake/commands 24)))))

(deftest reverse-nothing
  (testing "reversing nothing still gives nothing"
    (is (= [] (secret-handshake/commands 16)))))

(deftest all-actions
  (testing "all actions together"
    (is (=
         ["wink" "double blink" "close your eyes" "jump"]
         (secret-handshake/commands 15)))))

(deftest reverse-all-actions
  (testing "reversing all actions together"
    (is (=
         ["jump" "close your eyes" "double blink" "wink"]
         (secret-handshake/commands 31)))))

(deftest nothing
  (testing "do nothing for 0"
    (is (= [] (secret-handshake/commands 0)))))

(deftest lower-5-bits-zero
  (testing "do nothing for high numbers if lower 5 bits not set"
    (is (= [] (secret-handshake/commands 32)))))

Version data entries

240 entries across 240 versions & 1 rubygems

Version Path
trackler-2.1.0.20 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.19 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.18 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.17 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.16 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.15 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.14 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.13 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.12 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.11 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.10 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.9 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.8 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.7 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.6 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.5 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.4 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.3 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.2 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj
trackler-2.1.0.1 tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj