aoc-cl/tests/2018/day06-test.lisp

35 lines
931 B
Common Lisp
Raw Normal View History

2024-12-01 12:04:03 +01:00
(defpackage :aoc/2018/06/tests
(:use :cl :aoc :aoc/tests :parachute :aoc/2018/06)
(:export
#:suite-2018-06
#:test-find-top-left
#:test-find-bottom-right
#:test-manhattan-distance
))
(in-package :aoc/2018/06/tests)
(define-test suite-2018-06
2024-12-04 15:10:05 +01:00
;:parent suite-2018
)
2024-12-01 12:04:03 +01:00
(define-test+run test-find-top-left
:parent suite-2018-06
(let ((result (top-left sample-points)))
(true (equalp (make-vector-2d :x 1 :y 1) result))))
(define-test+run test-find-bottom-right
:parent suite-2018-06
(let ((result (bottom-right sample-points)))
(true (equalp (make-vector-2d :x 8 :y 9) result))))
(define-test test-manhattan-distance
:parent suite-2018-06
(let ((p0 (make-vector-2d :x 0 :y 0))
(p1 (make-vector-2d :x 1 :y 1))
(p2 (make-vector-2d :x 3 :y 2)))
(true (eq 0 (manhattan-distance p0 p0)))
(true (eq 2 (manhattan-distance p0 p1)))
(true (eq 5 (manhattan-distance p0 p2)))
))