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

33 lines
924 B
Common Lisp

(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
:parent suite-2018)
(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)))
))