Mercurial > cortex
diff org/test.org @ 69:39e4e1542e4a
updated test-suite
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 09 Dec 2011 23:11:28 -0600 |
parents | 6cd5a034d855 |
children | 0235c32152af |
line wrap: on
line diff
1.1 --- a/org/test.org Fri Dec 09 21:33:05 2011 -0600 1.2 +++ b/org/test.org Fri Dec 09 23:11:28 2011 -0600 1.3 @@ -10,9 +10,11 @@ 1.4 #+name: body-main 1.5 #+begin_src clojure 1.6 (ns cortex.test 1.7 - (:require [cortex.test touch vision]) 1.8 + (:use cortex.util) 1.9 + (:use clojure.contrib.def) 1.10 + (:require [cortex.test touch vision body hearing]) 1.11 (:import com.jme3.app.state.AppState 1.12 - com.jme3.system.AppSettings)) 1.13 + com.jme3.system.AppSettings)) 1.14 1.15 (defn run-world 1.16 "run the simulation and wait until it closes proprely" 1.17 @@ -39,34 +41,33 @@ 1.18 (.start world) 1.19 (deref lock))) 1.20 1.21 -(defn test-all [] 1.22 - (println 1.23 - "***************\n" 1.24 - "Testing touch:\n" 1.25 - "you should see a ball which responds to the table\n" 1.26 - "and whatever balls hit it.\n") 1.27 - (run-world (test.touch/test-skin)) 1.28 - (println 1.29 - "***************\n" 1.30 - "Testing vision:\n" 1.31 - "You should see a rotating cube, and two windows,\n" 1.32 - "each displaying a different view of the cube.\n") 1.33 - (run-world (test.vision/test-two-eyes)) 1.34 - (println 1.35 - "***************\n" 1.36 - "Testing hearing:\n" 1.37 - "You should see a blue sphere flying around several\n" 1.38 - "cubes. As the sphere approaches each cube, it turns\n" 1.39 - "green.\n") 1.40 - (run-world 1.41 - (doto (com.aurellem.capture.examples.Advanced.) 1.42 - (.setSettings 1.43 - (doto (AppSettings. true) 1.44 - (.setAudioRenderer "Send"))) 1.45 - (.setShowSettings false) 1.46 - (.setPauseOnLostFocus false)))) 1.47 +(defn run-test 1.48 + "print the docstring for the test, then run the simulation which it 1.49 + yields, waiting until it is terminated." 1.50 + [test-fn-var] 1.51 + (println-repl "\n ****************\n") 1.52 + (println-repl (:doc (meta test-fn-var))) 1.53 + (run-world ((deref test-fn-var)))) 1.54 + 1.55 +(defvar test-suite 1.56 + [#'cortex.test.touch/test-skin 1.57 + #'cortex.test.vision/test-two-eyes 1.58 + #'cortex.test.hearing/test-advanced-hearing 1.59 + #'cortex.test.body/test-proprioception 1.60 + #'cortex.test.body/test-motor-control] 1.61 + "The full test suite for all sensors/effectors.") 1.62 + 1.63 +(defn run-test-suite 1.64 + "Run the entire test-suite." 1.65 + [] 1.66 + (dorun (map run-test test-suite))) 1.67 + 1.68 #+end_src 1.69 1.70 +#+results: body-main 1.71 +: #'cortex.test/run-test-suite 1.72 + 1.73 + 1.74 * COMMENT generate Source. 1.75 #+begin_src clojure :tangle ../src/cortex/test.clj 1.76 <<body-main>>