Blob


1 (defpackage #:aoc-test/day-2
2 (:use #:cl #:lisp-unit2)
3 (:import-from aoc/day-2))
4 (in-package #:aoc-test/day-2)
6 (define-test test-day-2
7 ()
8 ;;; Test resets
9 ;; Report where the first item needs to be skipped
10 (assert (aoc/day-2:report-safe-p (list 30 24 25 28 31 33 35) :allow-skip t))
11 ;; Report where the second item needs to be skipped
12 (assert (aoc/day-2:report-safe-p (list 24 21 25 28 31 33 35) :allow-skip t))
13 ;; Report where reset target needs to be removed
14 (assert (aoc/day-2:report-safe-p (list 25 22 19 21 20 17 14 13) :allow-skip t))
15 ;;; Test task 1 & 2
16 (multiple-value-bind (task-1 task-2)
17 (aoc:run-day 2 "7 6 4 2 1
18 1 2 7 8 9
19 9 7 6 2 1
20 1 3 2 4 5
21 8 6 4 4 1
22 1 3 6 7 9")
23 (assert= 2 task-1)
24 (assert= 4 task-2)))