;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 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 :nova-test.apps) (deftestsuite results-apps-test-suite (nova-tests) () :dynamic-variables (*default-result-cache*) :setup (setf *default-result-cache* (make-memory-result-cache)) :teardown (setf *default-result-cache* nil)) (addtest check-make-result-from-path (with-new-db (register-db-default-configuration-list 'test (list (cons 'a (make-bag :range '(1 2 3 4 5 6))))) (init-db) (let* ((first-state (make-state :ignore nil :open '((a 1) (a 2) (a 3)) :closed '((a 5) (a 6)) :scores '((test-score . 4)))) (second-state (make-state :ignore nil :open '((a 1) (a 2)) :closed '((a 3) (a 5) (a 6)) :scores '((test-score . 3)))) (best-state (make-state :ignore nil :open '((a 1)) :closed '((a 2) (a 3) (a 5) (a 6)) :scores '((test-score . 2)))) (path (make-path :states (list first-state second-state best-state)))) (finalize-path path :reverse-states nil) (let ((result (make-result-from-path path #'(lambda (p) (last-state? p))))) ;;states (ensure-same (result-init-state result) first-state) (ensure-same (result-init-state-scores result) (state-scores first-state)) (ensure-same (result-best-state result) best-state) (ensure-same (result-best-state-scores result) (state-scores best-state)) ;;constraints (ensure-same (result-num-features result) (constraint-count best-state :which :features)) (ensure-same (result-num-ranges result) (constraint-count best-state :which :ranges)) ;;times (ensure (result-time-to-best result)) (ensure (result-time-to-end result)) ;;path (ensure-same (result-path result) path))))) (addtest check-result-ticks2seconds (let ((ticks 1000)) (ensure-same (result-ticks2seconds ticks) (/ ticks internal-time-units-per-second)))) (addtest check-nova-store-result-and-retrieve-result (let ((result (make-result)) (score "score") (case-study 'case-study) (policy 'policy) (search-engine nil)) (ensure-no-warning (nova-store-result-in-cache *default-result-cache* result score case-study policy search-engine)) (ensure-no-warning (nova-retrieve-result-from-cache *default-result-cache* score case-study policy search-engine)) (ensure-same (nova-retrieve-result-from-cache *default-result-cache* score case-study policy search-engine) result :test #'equalp))) (addtest check-describe-result (ensure-no-warning (describe (make-result))))