aoc-cl/test/2018/day06-test.lisp
2024-11-29 22:09:54 +01:00

27 lines
779 B
Common Lisp

(defpackage :aoc/2018/06
(:use :cl :aoc :aoc/tests :parachute))
(in-package :aoc/2018/06/tests)
(define-test suite-2018-06
:parent suite-2018)
(define-test+run 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 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)))
))