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

49 lines
1.2 KiB
Common Lisp
Raw Normal View History

2024-12-10 22:21:36 +01:00
(defpackage :aoc/2024/11/tests
(:use :cl :aoc :aoc/tests :aoc/2024/tests :parachute :aoc/2024/11))
(in-package :aoc/2024/11/tests)
(define-test suite-2024-11
;:parent suite-2024
)
2024-12-11 09:05:46 +01:00
(define-test test-parse-line
:parent suite-2024-11
(is equal '(125 17) (parse-line "125 17"))
)
2024-12-10 22:21:36 +01:00
2024-12-11 09:05:46 +01:00
(defparameter example-evolution
'((125 17)
(253000 1 7)
(253 0 2024 14168)
(512072 1 20 24 28676032)
(512 72 2024 2 0 2 4 2867 6032)
(1036288 7 2 20 24 4048 1 4048 8096 28 67 60 32)
(2097446912 14168 4048 2 0 2 4 40 48 2024 40 48 80 96 2 8 6 7 6 0 3 2)))
(define-test test-evolve-stone
:parent suite-2024-11
(is equal '(1) (evolve-stone 0))
(is equal '(9 9) (evolve-stone 99))
(is equal '(2024) (evolve-stone 1)))
(define-test test-evolve-stones
:parent suite-2024-11
(loop
for case in example-evolution
for expected in (subseq example-evolution 1)
do (is equal expected (evolve-stones case)) )
)
2024-12-10 22:21:36 +01:00
(define-test+run test-part1
2024-12-11 09:05:46 +01:00
:parent suite-2024-11
(is equal "55312" (part1 sample-data)))
2024-12-10 22:21:36 +01:00
(define-test+run test-part2
:parent suite-2024-11
(is equal nil (part2 sample-data)))