]> localhost Git - adventofcode2019.git/blob - test/adventofcode2019/day18_test.clj
Add broken day16pt2
[adventofcode2019.git] / test / adventofcode2019 / day18_test.clj
1 (ns adventofcode2019.day18-test
2 (:require [clojure.test :refer :all]
3 [adventofcode2019.day18 :refer :all]))
4
5 (deftest test-build-world
6 (is (= {:p [5 1]
7 :t #{[1 1] [2 1] [4 1] [5 1] [6 1] [7 1]}
8 :k {\a [7 1], \b [1 1]}
9 :d {\A [3 1]}}
10 (build-world ["#########"
11 "#b.A.@.a#"
12 "#########"]))))
13
14 (deftest test-pathing
15 (is (= 2 (path-between ((build-world ["#########"
16 "#b.A.@.a#"
17 "#########"]) :t)
18 [5 1] [7 1]))))
19
20 (deftest test-accessible
21 (is (= {\a 2}
22 (accessible (build-world ["#########"
23 "#b.A.@.a#"
24 "#########"])))))
25
26 (deftest examples
27 (is (= 8 (acquire-all-keys (build-world ["#########"
28 "#b.A.@.a#"
29 "#########"]))))
30 (is (= 86 (acquire-all-keys (build-world ["########################"
31 "#f.D.E.e.C.b.A.@.a.B.c.#"
32 "######################.#"
33 "#d.....................#"
34 "########################"]))))
35 (is (= 132 (acquire-all-keys (build-world ["########################"
36 "#...............b.C.D.f#"
37 "#.######################"
38 "#.....@.a.B.c.d.A.e.F.g#"
39 "########################"]))))
40 #_(is (= 136 (acquire-all-keys (build-world ["#################"
41 "#i.G..c...e..H.p#"
42 "########.########"
43 "#j.A..b...f..D.o#"
44 "########@########"
45 "#k.E..a...g..B.n#"
46 "########.########"
47 "#l.F..d...h..C.m#"
48 "#################"]))))
49 (is (= 81 (acquire-all-keys (build-world ["########################"
50 "#@..............ac.GI.b#"
51 "###d#e#f################"
52 "###A#B#C################"
53 "###g#h#i################"
54 "########################"])))))