Today is the Fifth Plough of the Plough

Implemented almost the whole of the Myth of the God Incarnate calendar
This commit is contained in:
Simon Brooke 2020-04-14 08:30:41 +01:00
parent bd76e93568
commit 7e7a55c8ec
39 changed files with 2085 additions and 167 deletions

View file

@ -0,0 +1,36 @@
(ns the-great-game.world.location-test
(:require [clojure.test :refer :all]
[the-great-game.world.location :refer :all]))
(deftest get-coords-test
(testing "Get coordinates of location"
(let [expected {:x 5 :y 7}
actual (get-coords {:x 5 :y 7})]
(is (= actual expected)))
(let [expected {:x -4 :y 55}
actual (get-coords [{:x -4 :y 55} :auchencairn :galloway :scotland])]
(is (= actual expected)))
(let [expected nil
actual (get-coords [:auchencairn :galloway :scotland])]
(is (= actual expected)))
))
(deftest distance-test
(testing "Distance between two locations"
(let [expected 4.242640687119285
actual (distance-between {:x 5 :y 5} {:x 2 :y 2})]
(is (= actual expected)))
(let [expected 3
actual (distance-between {:x 5 :y 5} {:x 2 :y 5})]
(is (= actual expected)))
(let [expected 50.80354318352215
actual (distance-between
{:x 5 :y 5}
[{:x -4 :y 55} :auchencairn :galloway :scotland])]
(is (= actual expected)))
(let [expected nil
actual (distance-between
{:x 5 :y 5}
[:auchencairn :galloway :scotland])]
(is (= actual expected)))
))