;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This file is part of "NOVA": NOVA = search + COCOMO tools ; Copyright, 2008, Tim Menzies tim@menzies.us ; ; NOVA is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; NOVA is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; You should have received a copy of the GNU General Public License ; a long with NOVA. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package :wvu-lib-test.tricks) (deftestsuite line-lib-test-suite (wvu-lib-tests) ()) (addtest check-point-to-line (let ((l (ensure-no-warning (point-to-line 1 1 3 3)))) (ensure-same (line-m l) 1) (ensure-same (line-b l) 0) (ensure-null (line-verticalp l)))) (addtest check-point-to-line-horizonal (let ((l (ensure-no-warning (point-to-line 1 1 3 1)))) (ensure-same (line-m l) 0) (ensure-same (line-b l) 1) (ensure-null (line-verticalp l)))) (addtest check-point-to-line-vertical (let ((l (ensure-no-warning (point-to-line 1 1 1 3)))) (ensure-null (line-m l)) (ensure-null (line-b l)) (ensure (line-verticalp l)))) (addtest check-line-y (let ((l (point-to-line 1 1 3 3))) (ensure-same (ensure-no-warning (line-y 2 l)) 2) (ensure-same (ensure-no-warning (line-y 5 l)) 5))) (addtest check-line-y-horizonal (let ((l (point-to-line 1 1 3 1))) (ensure-same (ensure-no-warning (line-y 2 l)) 1) (ensure-same (ensure-no-warning (line-y 5 l)) 1))) (addtest check-line-y-vertical (let ((l (point-to-line 1 1 1 3))) (ensure-error (line-y 2 l)) (ensure-error (line-y 3 l)))) (addtest check-interpolates (let ((points '((0 . 0) (5 . 5) (10 . 15)))) (ensure-same (interpolates -1 points) 0 :test #'equalp) (ensure-same (interpolates 0 points) 0 :test #'equalp) (ensure-same (interpolates 2 points) 2 :test #'equalp) (ensure-same (interpolates 5 points) 5 :test #'equalp) (ensure-same (interpolates 8 points) 11 :test #'equalp) (ensure-same (interpolates 10 points) 15 :test #'equalp) (ensure-same (interpolates 12 points) 15 :test #'equalp)))