(defpackage :aoc/2024/18/tests (:use :cl :aoc :aoc/maze :aoc/tests :aoc/2024/tests :parachute :aoc/2024/18)) (in-package :aoc/2024/18/tests) (define-test suite-2024-18 ;:parent suite-2024 ) (define-test test-in-bounds-p :parent suite-2024-18 (true (in-bounds-p sample-data (make-pos :x 0 :y 0))) (true (in-bounds-p sample-data (make-pos :x 6 :y 6))) (true (in-bounds-p sample-data (make-pos :x 3 :y 3))) (false (in-bounds-p sample-data (make-pos :x -1 :y 3))) (false (in-bounds-p sample-data (make-pos :x 3 :y -1))) (false (in-bounds-p sample-data (make-pos :x 7 :y 3))) (false (in-bounds-p sample-data (make-pos :x 3 :y 7))) ) (define-test test-next-moves :parent suite-2024-18 (is equalp (list (make-pos :x 0 :y 1) (make-pos :x 1 :y 0) ) (next-moves sample-data (make-pos :x 0 :y 0) 12)) (is equalp (list (make-pos :x 4 :y 0) (make-pos :x 3 :y 1) ) (next-moves sample-data (make-pos :x 4 :y 1) 12)) ) (define-test+run test-part1 :parent suite-2024-18 (is equal "22" (part1 sample-data 12))) (define-test+run test-part2 :parent suite-2024-18 (is equal "6,1" (part2 sample-data)))