Skip to content

Instantly share code, notes, and snippets.

@Sose

Sose/test.cljs Secret

Created May 26, 2021 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sose/5c4440f85b317e9f322c8b4fdca7d28d to your computer and use it in GitHub Desktop.
Save Sose/5c4440f85b317e9f322c8b4fdca7d28d to your computer and use it in GitHub Desktop.
(def test-script-2 [[:start 0 0 0] [:move 10] [:turn 90] [:move 20]])
(def my-test-steps
[[:coords [0 0]]
[:coords [10 0]]
[:angle 1337]
[:coords [0 20]]])
(defn test-at-steps [script all-tests]
(loop [[[getter correct] & tests] all-tests
turtle (turtle/turtle-at-start script)]
(when-not (turtle/reached-end? turtle script)
(is (= correct (getter turtle)))
(recur tests (turtle/step-turtle turtle script)))))
(deftest more-tests
(testing "test-at-steps-3"
(test-at-steps test-script-2 my-test-steps)))
; FAIL in (more-tests) (kilppari/core_test.cljs:44:11)
; "test-at-steps-3"
; expected: (=
; correct
; (getter turtle))
; actual: (=
; 1337
; 90)
; diff: - 1337
; + 90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment