26 lines
766 B
Common Lisp
26 lines
766 B
Common Lisp
(defpackage :aoc/2018/06/tests
|
|
(:use :cl :aoc :aoc/2018/06 :parachute))
|
|
|
|
(in-package :aoc/2018/06/tests)
|
|
|
|
(define-test suite-2018-06)
|
|
|
|
(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)))
|
|
))
|