day-17.lisp (1344B)
1 (defpackage #:aoc-test/day-17 2 (:use #:cl #:lisp-unit2 #:aoc/day-17)) 3 (in-package #:aoc-test/day-17) 4 5 (defun day-17-tests () 6 (let ((registers (make-registers 0 0 9)) 7 (program (make-program (vector 2 6)))) 8 (funcall program registers) 9 (assert= 1 (aref registers 1))) 10 (let ((registers (make-registers 10 0 0)) 11 (program (make-program (vector 5 0 5 1 5 4)))) 12 (assert-equal (list 0 1 2) 13 (nreverse (funcall program registers)))) 14 (let ((registers (make-registers 2024 0 0)) 15 (program (make-program (vector 0 1 5 4 3 0)))) 16 (assert-equal (list 4 2 5 6 7 7 7 7 3 1 0) 17 (nreverse (funcall program registers))) 18 (assert= 0 (aref registers 0))) 19 (let ((registers (make-registers 0 29 0)) 20 (program (make-program (vector 1 7)))) 21 (funcall program registers) 22 (assert= 26 (aref registers 1))) 23 (let ((registers (make-registers 0 2024 43690)) 24 (program (make-program (vector 4 0)))) 25 (funcall program registers) 26 (assert= 44354 (aref registers 1))) 27 (let ((registers (make-registers 729)) 28 (program (make-program (vector 0 1 5 4 3 0)))) 29 (assert-equal (list 4 6 3 5 6 3 5 2 1 0) 30 (nreverse (funcall program registers))))) 31 32 (define-test test-day-17 33 () 34 (day-17-tests) 35 (let ((*use-compiler* t)) 36 (day-17-tests)))