Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Use cljs.test with consistent alias #162

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions exercises/practice/accumulate/test/accumulate_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns accumulate-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
[clojure.string :refer [upper-case]]
accumulate))

(defn- square [n] (* n n))
Expand All @@ -15,7 +16,7 @@
(deftest accumulate-upcases
(is (= ["HELLO", "WORLD"]
(->> ["hello" "world"]
(accumulate/accumulate clojure.string/upper-case)
(accumulate/accumulate upper-case)
(map to-s)))))

(deftest accumulate-reversed-strings
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/acronym/test/acronym_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns acronym-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
acronym))

(deftest test-acronym-empty-string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns all-your-base-test
(:require [clojure.test :refer [deftest testing is]]
(:require [cljs.test :refer [deftest is testing] :as t :include-macros true]
[all-your-base]))

(deftest test-single-bit-to-one-decimal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns atbash-cipher-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
atbash-cipher))

(deftest encode-no
Expand Down
6 changes: 3 additions & 3 deletions exercises/practice/bank-account/test/bank_account_test.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns bank-account-test
(:require
[clojure.test :refer [deftest testing is use-fixtures]]
[cljs.test :refer [deftest is testing] :as t :include-macros true]
[bank-account]))

(defn pcalls
Expand All @@ -11,8 +11,8 @@
[& fns] (pmap #(%) fns))

#_(defn shutdown-agents-fixture [f]
(f)
(shutdown-agents))
(f)
(shutdown-agents))

;(use-fixtures :once shutdown-agents-fixture)

Expand Down
8 changes: 4 additions & 4 deletions exercises/practice/change/test/change_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns change-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
[change :refer [issue]]))

(deftest single-coin-change
Expand Down Expand Up @@ -27,12 +27,12 @@

(deftest error-testing-for-change-smallet-than-the-smallest-coin
(is (thrown? js/Error #"cannot change"
(issue 3 #{5 10}))))
(issue 3 #{5 10}))))

(deftest cannot-find-negative-change-values
(is (thrown? js/Error #"cannot change"
(issue -5 #{1 2 5}))))
(issue -5 #{1 2 5}))))

(deftest error-testing-for-no-valid-change
(is (thrown? js/Error #"cannot change"
(issue 10 #{20 8 3}))))
(issue 10 #{20 8 3}))))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns collatz-conjecture-test
(:require [clojure.test :refer [deftest is testing]]
(:require [cljs.test :refer [deftest is testing] :as t :include-macros true]
[collatz-conjecture :refer [collatz]]))

(deftest steps-for-1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns complex-numbers-test
(:require [clojure.test :refer [deftest is testing]]
(:require [cljs.test :refer [deftest is testing] :as t :include-macros true]
[complex-numbers :as c]))

;; Tests for Real Part
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/crypto-square/test/crypto_square_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns crypto-square-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
crypto-square))

(deftest normalize-splunk
Expand Down Expand Up @@ -45,4 +45,4 @@
(crypto-square/normalize-ciphertext plaintext)))))
(deftest cipher-6
(is (= "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "
(crypto-square/normalize-ciphertext "If man was meant to stay on the ground, god would have given us roots."))))
(crypto-square/normalize-ciphertext "If man was meant to stay on the ground, god would have given us roots."))))
2 changes: 1 addition & 1 deletion exercises/practice/diamond/test/diamond_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns diamond-test
(:require [clojure.test :refer [deftest is are]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
[diamond :refer [diamond]]))

(deftest single-a-row
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns difference-of-squares-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
[difference-of-squares :as dos]))

(deftest square-of-sum-to-5
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/etl/test/etl_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns etl-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
etl))

(deftest transform-one-value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns flatten-array-test
(:require [clojure.test :refer [deftest is testing]]
(:require [cljs.test :refer [deftest is testing] :as t :include-macros true]
[flatten-array]))

(deftest flattens-array-of-ints
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/gigasecond/test/gigasecond_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns gigasecond-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
gigasecond))

(deftest from-apr-25-2011
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/go-counting/test/go_counting_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns go-counting-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
[go-counting :as g]))

(def example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns grade-school-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
grade-school))

(def db {})
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/grains/test/grains_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns grains-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
grains))

(deftest square-1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns kindergarten-garden-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
kindergarten-garden))

(deftest garden-test
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/meetup/test/meetup_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns meetup-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
meetup))

(deftest monteenth-of-may-2013
Expand Down
3 changes: 1 addition & 2 deletions exercises/practice/minesweeper/test/minesweeper_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns minesweeper-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
[clojure.string :refer [join]]
[minesweeper :refer [draw]]))

Expand Down Expand Up @@ -59,4 +59,3 @@
"*****"
"25*52"
" 2*2 "]))))

2 changes: 1 addition & 1 deletion exercises/practice/nth-prime/test/nth_prime_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns nth-prime-test
(:require [clojure.test :refer [deftest testing is]]
(:require [cljs.test :refer [deftest is testing] :as t :include-macros true]
nth-prime))

(deftest first-prime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns perfect-numbers-test
(:require
[clojure.test :refer [deftest testing is]]
[cljs.test :refer [deftest is testing] :as t :include-macros true]
[perfect-numbers]))

(deftest test-initialize-perfect-number
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/pig-latin/test/pig_latin_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns pig-latin-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
pig-latin))

;; ay is added to words that start with vowels
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/poker/test/poker_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns poker-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
[poker :refer [best-hands]]))

(defn f [xs ys] (= (sort (best-hands xs)) (sort ys)))
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/pov/test/pov_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns pov-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
pov))

;;; Inputs.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns prime-factors-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
prime-factors))

(deftest one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns protein-translation-test
(:require [clojure.test :refer [deftest is are]]
(:require [cljs.test :refer [deftest is are] :as t :include-macros true]
protein-translation))

(deftest AUG-translates-to-Methionine
Expand Down
36 changes: 18 additions & 18 deletions exercises/practice/proverb/test/proverb_test.cljs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
(ns proverb-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
[proverb :refer [recite]]
[clojure.string :as str]))

(deftest zero-pieces
(is (=
(recite ())
"")))
(recite ())
"")))

(deftest one-piece
(is (=
(recite '("nail"))
"And all for the want of a nail.")))
(recite '("nail"))
"And all for the want of a nail.")))

(deftest two-pieces
(is (=
(recite '("nail" "shoe"))
(str/join "\n" ["For want of a nail the shoe was lost."
"And all for the want of a nail."]))))
(recite '("nail" "shoe"))
(str/join "\n" ["For want of a nail the shoe was lost."
"And all for the want of a nail."]))))

(deftest three-pieces
(is (=
(recite '("nail" "shoe" "horse"))
(str/join "\n" ["For want of a nail the shoe was lost."
"For want of a shoe the horse was lost."
"And all for the want of a nail."]))))
(recite '("nail" "shoe" "horse"))
(str/join "\n" ["For want of a nail the shoe was lost."
"For want of a shoe the horse was lost."
"And all for the want of a nail."]))))

(deftest full-proverb
(is (= (recite '("nail" "shoe" "horse" "rider" "message" "battle" "kingdom"))
Expand All @@ -38,8 +38,8 @@

(deftest four-pieces-modernized
(is (=
(recite '("pin" "gun" "soldier" "battle"))
(str/join "\n" ["For want of a pin the gun was lost."
"For want of a gun the soldier was lost."
"For want of a soldier the battle was lost."
"And all for the want of a pin."]))))
(recite '("pin" "gun" "soldier" "battle"))
(str/join "\n" ["For want of a pin the gun was lost."
"For want of a gun the soldier was lost."
"For want of a soldier the battle was lost."
"And all for the want of a pin."]))))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns queen-attack-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
queen-attack))

(def empty-board
Expand Down
24 changes: 12 additions & 12 deletions exercises/practice/robot-name/test/robot_name_test.cljs
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
(ns robot-name-test
(:require [clojure.test :refer [deftest is testing]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
robot-name))

(deftest robot-name
(let [a-robot (robot-name/robot)
its-name (robot-name/robot-name a-robot)]
(is (re-seq #"[A-Z]{2}\d{3}" its-name))))
(is (re-seq #"[A-Z]{2}\d{3}" its-name))))

(deftest name-matches-pattern
(let [a-robot (robot-name/robot)
its-name (robot-name/robot-name a-robot)]
(is (= its-name (robot-name/robot-name a-robot)))))
(let [a-robot (robot-name/robot)
its-name (robot-name/robot-name a-robot)]
(is (= its-name (robot-name/robot-name a-robot)))))

(deftest different-robots-different-names
(let [a-robot (robot-name/robot)
(let [a-robot (robot-name/robot)
its-name (robot-name/robot-name a-robot)]
(is (not= its-name (-> (robot-name/robot) robot-name/robot-name)))))
(is (not= its-name (-> (robot-name/robot) robot-name/robot-name)))))

(deftest new-name-matches
(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))]
(is (re-seq #"[A-Z]{2}\d{3}" its-new-name))))
(is (re-seq #"[A-Z]{2}\d{3}" its-new-name))))

(deftest new-name-different
(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))]
(is (not= its-original-name its-new-name))))
(is (not= its-original-name its-new-name))))

(deftest new-name-does-not-change-until-reset
(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))]
(is (= its-new-name (robot-name/robot-name a-robot)))))
(is (= its-new-name (robot-name/robot-name a-robot)))))

(deftest new-names-different-each-time
(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))]
(is (not= its-new-name (do (robot-name/reset-name a-robot)
(robot-name/robot-name a-robot))))))
(is (not= its-new-name (do (robot-name/reset-name a-robot)
(robot-name/robot-name a-robot))))))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns robot-simulator-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
robot-simulator))

(def robbie (robot-simulator/robot {:x -2 :y 1} :east))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns roman-numerals-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
roman-numerals))

(deftest one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns rotational-cipher-test
(:require [clojure.test :refer [deftest is testing]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
rotational-cipher))

(deftest rotate-a-by-1
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/say/test/say_test.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns say-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
say))

(deftest zero-test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns scrabble-score-test
(:require [clojure.test :refer [deftest is]]
(:require [cljs.test :refer [deftest is] :as t :include-macros true]
scrabble-score))

(deftest lower-case-letter
Expand Down
Loading