;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 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.guess) (deftestsuite guess-test-suite (wvu-lib-tests) () ) (addtest ?quantity-check (ensure (<= 10 (?quantity 10 20) 20) :report "guessing a random number using ?quantity")) (addtest ?elt-check (ensure (member (?elt '(a b c d e)) '(a b c d e)) :report "guessing a random list item using ?elt")) (addtest check-?elt-nil (ensure-null (?elt nil) :report "?elt nil didn't return nil")) (addtest check-?elts-nil (ensure-null (?elts nil 0) :report "?elts nil didn't return nil")) ;;; num (addtest discretize-check (ensure-same (discretize (make-num :min 1 :max 5 :discretize-bins 5)) '(1 2 3 4 5) :test #'equalp :report "check that discretize works")) (addtest discretize-values-check (ensure-same (discretize (make-num :min 1 :max 5 :discretize-bins 5) :min-max '(6 10)) '(6 7 8 9 10) :test #'equalp :report "check that discretize works with values")) (addtest guess-num-check (ensure (<= 10 (guess (make-num :min 10 :max 20)) 20) :report "guessing a random number using a num struct")) ;;; bag (addtest guess-bag-check (ensure (member (guess (make-bag :range '(1 2 3 4))) '(1 2 3 4)) :report "guessing a random list item using a bag struct"))