# HG changeset patch # User Robert McIntyre # Date 1323493888 21600 # Node ID 39e4e1542e4a8c0e4b7e85832eee40342a0c2272 # Parent 6cd5a034d85598b444534c3fb457859ca8169b08 updated test-suite diff -r 6cd5a034d855 -r 39e4e1542e4a org/body.org --- a/org/body.org Fri Dec 09 21:33:05 2011 -0600 +++ b/org/body.org Fri Dec 09 23:11:28 2011 -0600 @@ -131,9 +131,9 @@ * Examples -#+srcname: test-body +#+name: test-body #+begin_src clojure -(ns test.body +(ns cortex.test.body (:use (cortex world util body)) (:import com.jme3.math.Vector3f @@ -200,7 +200,8 @@ Vector3f/ZERO])) (defn test-motor-control - "You should see a multi-segmented worm-like object fall onto the + "Testing motor-control: + You should see a multi-segmented worm-like object fall onto the table and begin writhing and moving." [] (let [worm (eve-worm) @@ -227,7 +228,8 @@ (worm-pattern @time))))))) (defn test-proprioception - "You should see two foating bars, and a printout of pitch, yaw, and + "Testing proprioception: + You should see two foating bars, and a printout of pitch, yaw, and roll. Pressing key-r/key-t should move the blue bar up and down and change only the value of pitch. key-f/key-g moves it side to side and changes yaw. key-v/key-b will spin the blue segment clockwise @@ -269,9 +271,7 @@ (set-gravity world (Vector3f. 0 0 0)) (.setMoveSpeed (.getFlyByCamera world) 50) (.setRotationSpeed (.getFlyByCamera world) 50) - (light-up-everything world) - (.setTimer world (NanoTimer.)) - ) + (light-up-everything world)) (fn [_ _] (if @move-up? (.applyTorque control @@ -300,7 +300,6 @@ (if (= 0 (rem (swap! time inc) 2000)) (do - (apply (comp println-repl @@ -752,7 +751,7 @@ <> #+end_src -#+begin_src clojure :tangle ../src/test/body.clj +#+begin_src clojure :tangle ../src/cortex/test/body.clj <> #+end_src diff -r 6cd5a034d855 -r 39e4e1542e4a org/eyes.org --- a/org/eyes.org Fri Dec 09 21:33:05 2011 -0600 +++ b/org/eyes.org Fri Dec 09 23:11:28 2011 -0600 @@ -126,9 +126,13 @@ (.repaint panel)))) (defn test-two-eyes - "Tests the vision system by creating two views of the same rotating - object from different angles and displaying both of those views in - JFrames." + "Testing vision: + Tests the vision system by creating two views of the same rotating + object from different angles and displaying both of those views in + JFrames. + + You should see a rotating cube, and two windows, + each displaying a different view of the cube." [] (let [candy (box 1 1 1 :physical? false :color ColorRGBA/Blue)] diff -r 6cd5a034d855 -r 39e4e1542e4a org/skin.org --- a/org/skin.org Fri Dec 09 21:33:05 2011 -0600 +++ b/org/skin.org Fri Dec 09 23:11:28 2011 -0600 @@ -228,7 +228,11 @@ (.setBlendMode RenderState$BlendMode/Alpha)) (.setQueueBucket RenderQueue$Bucket/Transparent))) -(defn test-skin [] +(defn test-skin + "Testing touch: + you should see a ball which responds to the table + and whatever balls hit it." + [] (let [b ;;(transparent-box) (transparent-sphere) diff -r 6cd5a034d855 -r 39e4e1542e4a org/test.org --- a/org/test.org Fri Dec 09 21:33:05 2011 -0600 +++ b/org/test.org Fri Dec 09 23:11:28 2011 -0600 @@ -10,9 +10,11 @@ #+name: body-main #+begin_src clojure (ns cortex.test - (:require [cortex.test touch vision]) + (:use cortex.util) + (:use clojure.contrib.def) + (:require [cortex.test touch vision body hearing]) (:import com.jme3.app.state.AppState - com.jme3.system.AppSettings)) + com.jme3.system.AppSettings)) (defn run-world "run the simulation and wait until it closes proprely" @@ -39,34 +41,33 @@ (.start world) (deref lock))) -(defn test-all [] - (println - "***************\n" - "Testing touch:\n" - "you should see a ball which responds to the table\n" - "and whatever balls hit it.\n") - (run-world (test.touch/test-skin)) - (println - "***************\n" - "Testing vision:\n" - "You should see a rotating cube, and two windows,\n" - "each displaying a different view of the cube.\n") - (run-world (test.vision/test-two-eyes)) - (println - "***************\n" - "Testing hearing:\n" - "You should see a blue sphere flying around several\n" - "cubes. As the sphere approaches each cube, it turns\n" - "green.\n") - (run-world - (doto (com.aurellem.capture.examples.Advanced.) - (.setSettings - (doto (AppSettings. true) - (.setAudioRenderer "Send"))) - (.setShowSettings false) - (.setPauseOnLostFocus false)))) +(defn run-test + "print the docstring for the test, then run the simulation which it + yields, waiting until it is terminated." + [test-fn-var] + (println-repl "\n ****************\n") + (println-repl (:doc (meta test-fn-var))) + (run-world ((deref test-fn-var)))) + +(defvar test-suite + [#'cortex.test.touch/test-skin + #'cortex.test.vision/test-two-eyes + #'cortex.test.hearing/test-advanced-hearing + #'cortex.test.body/test-proprioception + #'cortex.test.body/test-motor-control] + "The full test suite for all sensors/effectors.") + +(defn run-test-suite + "Run the entire test-suite." + [] + (dorun (map run-test test-suite))) + #+end_src +#+results: body-main +: #'cortex.test/run-test-suite + + * COMMENT generate Source. #+begin_src clojure :tangle ../src/cortex/test.clj <>