2024-12-17 22:23:45 +01:00
|
|
|
(defpackage :aoc/2024/18/tests
|
2024-12-22 07:08:37 +01:00
|
|
|
(:use :cl :aoc :aoc/maze :aoc/tests :aoc/2024/tests :parachute :aoc/2024/18))
|
2024-12-17 22:23:45 +01:00
|
|
|
|
|
|
|
(in-package :aoc/2024/18/tests)
|
|
|
|
|
|
|
|
(define-test suite-2024-18
|
|
|
|
;:parent suite-2024
|
|
|
|
)
|
|
|
|
|
2024-12-18 08:28:34 +01:00
|
|
|
(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))
|
|
|
|
)
|
2024-12-17 22:23:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-test+run test-part1
|
2024-12-18 08:28:34 +01:00
|
|
|
:parent suite-2024-18
|
|
|
|
(is equal "22" (part1 sample-data 12)))
|
2024-12-17 22:23:45 +01:00
|
|
|
|
|
|
|
(define-test+run test-part2
|
2024-12-18 08:28:34 +01:00
|
|
|
:parent suite-2024-18
|
|
|
|
(is equal "6,1" (part2 sample-data)))
|