diff options
author | Yann Herklotz <git@yannherklotz.com> | 2021-12-14 00:49:28 +0000 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2021-12-14 00:49:28 +0000 |
commit | 1a03751a1968eadf0be4397fd6940a39774aa681 (patch) | |
tree | ce5a7dc31e0bdcf4adab35720b81e49fb6a2e43b /test/02.lisp | |
parent | ad5a08a4c86237b9fabaee78ce8fe48a93570dd1 (diff) | |
download | aoc21-1a03751a1968eadf0be4397fd6940a39774aa681.tar.gz aoc21-1a03751a1968eadf0be4397fd6940a39774aa681.zip |
Add tests
Diffstat (limited to 'test/02.lisp')
-rw-r--r-- | test/02.lisp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/02.lisp b/test/02.lisp new file mode 100644 index 0000000..fd1a7ea --- /dev/null +++ b/test/02.lisp @@ -0,0 +1,34 @@ +(ql:quickload "clunit") +(load "../src/02.lisp") + +(use-package :clunit) + +(defsuite 02/aoc ()) + +(defvar 02/default-input nil) + +(setf 02/default-input + '("forward 5" + "down 5" + "forward 8" + "up 3" + "down 8" + "forward 2")) + +(deftest 02/test-ex-a (02/aoc) + (let ((result (02/part-a (02/parse-input-direct 02/default-input)))) + (assert-equalp 150 result))) + +(deftest 02/test-ex-b (02/aoc) + (let ((result (02/part-b (02/parse-input-direct 02/default-input)))) + (assert-equalp 900 result))) + +(deftest 02/test-a (02/aoc) + (let ((result (02/part-a (02/parse-input "../inputs/02.txt")))) + (assert-equalp 1561344 result))) + +(deftest 02/test-b (02/aoc) + (let ((result (02/part-b (02/parse-input "../inputs/02.txt")))) + (assert-equalp 1848454425 result))) + +(run-suite '02/aoc) |