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

45 lines
954 B
Common Lisp
Raw Permalink Normal View History

2024-12-22 07:08:37 +01:00
(defpackage :aoc/2024/22/tests
(:use :cl :aoc :aoc/tests :aoc/2024/tests :parachute :aoc/2024/22))
(in-package :aoc/2024/22/tests)
(define-test suite-2024-22
;:parent suite-2024
)
2024-12-22 13:46:27 +01:00
(define-test test-next-random
:parent suite-2024-22
(let ((rnd 123))
(loop
for expected in '(15887950
16495136
527345
704524
1553684
12683156
11100544
12249484
7753432
5908254)
do (setf rnd (next-random rnd))
do (is = expected rnd))))
(define-test test-buyers-end-of-day
:parent suite-2024-22
(loop
for buyer in '((1 . 8685429)
(10 . 4700978)
(100 . 15273692)
(2024 . 8667524))
do (is = (cdr buyer) (repeat-random (car buyer) 2000))))
2024-12-22 07:08:37 +01:00
(define-test+run test-part1
2024-12-22 13:46:27 +01:00
:parent suite-2024-22
(is equal 37327623 (part1 sample-data)))
2024-12-22 07:08:37 +01:00
(define-test+run test-part2
2024-12-22 13:46:27 +01:00
:parent suite-2024-22
(is equal 23 (part2 sample-data2)))