aoc-cl/tests/2024/day12-test.lisp
2024-12-12 14:22:21 +01:00

48 lines
1.3 KiB
Common Lisp

(defpackage :aoc/2024/12/tests
(:use :cl :aoc :aoc/tests :aoc/2024/tests :parachute :aoc/2024/12))
(in-package :aoc/2024/12/tests)
(define-test suite-2024-12
;
;:parent suite-2024
;)
)
(define-test test-find-same-neighbors
:parent suite-2024-12
(is equal '((1 . 0) (0 . 1)) (find-same-neighbors sample-data 0 0))
(is equal '((2 . 2) (3 . 1) (4 . 2)) (find-same-neighbors sample-data 3 2))
)
(define-test test-bar
:parent suite-2024-12)
(define-test test-top-side-p
:parent suite-2024-12
(true (top-side-p (make-array '(3 3) :initial-contents '((0 0 0)
(0 0 0)
(0 0 0))) 1 1))
(true (top-side-p (make-array '(3 3) :initial-contents '((1 0 0)
(1 1 1)
(1 1 1))) 1 1))
(false (top-side-p (make-array '(3 3) :initial-contents '((0 0 0)
(1 1 1)
(1 1 1))) 1 1))
(true (top-side-p (make-array '(3 3) :initial-contents '((0 0 0)
(0 1 1)
(1 1 1))) 1 1))
(false (top-side-p (make-array '(3 3) :initial-contents '((0 1 0)
(0 1 1)
(1 1 1))) 1 1)))
(define-test+run test-part1
:parent suite-2024-12
(is equal "1930" (part1 sample-data)))
(define-test+run test-part2
:parent suite-2024-12
(is equal "1206" (part2 sample-data)))