Sha256: a1940ec907a2b08ba8f8b6837ca0e8d3b197dc55a8a162e71fac370cf3157343

Contents?: true

Size: 1.27 KB

Versions: 377

Compression:

Stored size: 1.27 KB

Contents

(ns robot-name-test
  (:require [clojure.test :refer [deftest is testing]]
            robot-name))

(deftest robot-name
  (let [a-robot (robot-name/robot)
        its-name (robot-name/robot-name a-robot)]
    (testing "robot-name"
      (is (re-seq #"[A-Z]{2}\d{3}" its-name)
          "name matches expected pattern")
      (is (= its-name (robot-name/robot-name a-robot))
          "name doesn't change until you reset it")
      (is (not= its-name (-> (robot-name/robot) robot-name/robot-name))
          "different robots have different names"))))

(deftest reset-name
  (let [a-robot (robot-name/robot)
        its-original-name (robot-name/robot-name a-robot)
        its-new-name (do (robot-name/reset-name a-robot)
                         (robot-name/robot-name a-robot))]

    (testing "reset-name"
      (is (re-seq #"[A-Z]{2}\d{3}" its-new-name)
          "new name matches expected pattern")
      (is (not= its-original-name its-new-name)
          "new name is different from old name")
      (is (= its-new-name (robot-name/robot-name a-robot))
          "new name doesn't change until you reset it")
      (is (not= its-new-name (do (robot-name/reset-name a-robot)
                                 (robot-name/robot-name a-robot)))
          "new names are different each time"))))

Version data entries

377 entries across 377 versions & 1 rubygems

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