aoc-cl/tests/2024/day05-test.lisp

32 lines
803 B
Common Lisp

(defpackage :aoc/2024/05/tests
(:use :cl :aoc :aoc/tests :aoc/2024/tests :parachute :aoc/2024/05))
(in-package :aoc/2024/05/tests)
(define-test suite-2024-05
;:parent suite-2024
)
(define-test test-middle-page
:parent suite-2024-05
(is = 61 (middle-page '(75 47 61 53 29)))
)
(define-test test-order-pages
:parent suite-2024-05
(let ((rules (first sample-data)))
(is equalp (sort-with-rules rules '(75 97 47 61 53)) '(97 75 47 61 53))
(is equalp (sort-with-rules rules '(61 13 29)) '(61 29 13))
(is equalp (sort-with-rules rules '(97 13 75 29 47)) '(97 75 47 29 13))))
(define-test+run test-part1
:parent suite-2024-05
(true (equalp "143" (part1 sample-data))))
(define-test+run test-part2
:parent suite-2024-05
(true (equalp nil (part2 sample-data))))