;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 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 lib-test-suite (wvu-lib-tests) () ) ;;; misc stuff (deftestsuite misc-lib-test-suite (lib-test-suite) ()) (addtest check-numlimit (let ((upper 10) (lower 5) (too-big 11) (too-small 3) (just-right 8)) (ensure-same (numlimit too-big lower upper) upper :report "upper limit didn't work") (ensure-same (numlimit too-small lower upper) lower :report "lower limit didn't work") (ensure-same (numlimit just-right lower upper) just-right :report "with-in limits didn't work"))) (addtest check-date-stamp (let ((time 3430312826)) (ensure-same (date-stamp :time time) "2008-09-13") (ensure-same (date-stamp :time time :seperator "") "20080913"))) (addtest check-noop (ensure-null (noop)) (ensure-null (noop 1)) (ensure-null (noop "eggs")) (ensure-null (noop "23" 23 'test))) (addtest euclidean (ensure-same (euclidean 1 1) (sqrt 2) :test #'equalp :report "calculating distance to the origin in 2-space") (ensure-same (euclidean 10 10 10 10) 20 :test #'equalp :report "calculating distance to the origin in 4-space")) (addtest check-chars ;; chars to standard output (ensure-same (with-output-to-string (*standard-output*) (chars 5)) "*****") ;; chars to standard output with specified char (ensure-same (with-output-to-string (*standard-output*) (chars 3 "$")) "$$$") ;; chars to specified output (ensure-same (with-output-to-string (s) (chars 7 "%" s)) "%%%%%%%")) (addtest check-sym-prim (ensure-same (symbol-name (sym-prim '(nose))) "NOSE") (ensure-same (symbol-name (sym-prim '("nose"))) "nose") (ensure-same (symbol-name (sym-prim '(yellow hat))) "YELLOW-HAT") (ensure-same (symbol-name (sym-prim '("yellow" "hat"))) "yellow-hat") (ensure-same (symbol-name (sym-prim '(num 2 "color"))) "NUM-2-color") (ensure-null (sym-prim nil))) (addtest check-sym (ensure-same (symbol-name (sym eggs)) "EGGS") (ensure-same (symbol-name (sym "ears" 2 eggs)) "ears-2-EGGS") (ensure-null (sym))) #| (addtest prevision-digits (ensure-same (precision-digits 10) 0) (ensure-same (precision-digits 10.0) 0) (ensure-same (precision-digits 1) 0) (ensure-same (precision-digits 1.0) 0) (ensure-same (precision-digits 0.5) 1) (ensure-same (precision-digits 0.33) 2) (ensure-same (precision-digits 0.1428) 4)) |# (addtest check-expand-range-min-max-switched (ensure-error (expand-range 5 2))) (addtest check-expand-range-min-max (ensure-same (expand-range 2 5) '(2 3 4 5) :test #'equalp) (ensure-same (expand-range 1 2) '(1 2) :test #'equalp)) (addtest check-expand-range-min-max-interval-decimal (ensure-same (expand-range 2 5 0.5 1) '(2 2.5 3 3.5 4 4.5 5) :test #'equalp) (ensure-same (expand-range 1 2 0.5 1) '(1 1.5 2) :test #'equalp)) (addtest check-unless-timeout (ensure-null (unless-timeout 1 (sleep 2) t) :report "sleep finished, so timeout didn't work"))