rlm@66: #+title: Test Suite rlm@58: #+author: Robert McIntyre rlm@58: #+email: rlm@mit.edu rlm@306: #+description: Simulating a body (movement, touch, proprioception) in jMonkeyEngine3. rlm@58: #+SETUPFILE: ../../aurellem/org/setup.org rlm@58: #+INCLUDE: ../../aurellem/org/level-0.org rlm@58: rlm@66: * Tests rlm@58: rlm@66: #+name: body-main rlm@58: #+begin_src clojure rlm@68: (ns cortex.test rlm@69: (:use cortex.util) rlm@69: (:use clojure.contrib.def) rlm@69: (:require [cortex.test touch vision body hearing]) rlm@58: (:import com.jme3.app.state.AppState rlm@69: com.jme3.system.AppSettings)) rlm@58: rlm@58: (defn run-world rlm@306: "run the simulation and wait until it closes properly." rlm@58: [world] rlm@58: (let [lock (promise)] rlm@58: (.enqueue rlm@58: world rlm@58: (partial rlm@58: (fn [world] rlm@58: (.attach rlm@58: (.getStateManager world) rlm@58: (proxy [AppState] [] rlm@58: (cleanup [] (deliver lock nil)) rlm@58: (initialize [_ _]) rlm@58: (isEnabled [] true) rlm@58: (setEnabled [_] ) rlm@58: (stateAttached [_]) rlm@58: (stateDetached [_]) rlm@58: (update [_]) rlm@58: (render [_]) rlm@58: (isInitialized [] true) rlm@58: (postRender [])))) rlm@58: world)) rlm@58: (.start world) rlm@58: (deref lock))) rlm@58: rlm@69: (defn run-test rlm@69: "print the docstring for the test, then run the simulation which it rlm@69: yields, waiting until it is terminated." rlm@69: [test-fn-var] rlm@69: (println-repl "\n ****************\n") rlm@69: (println-repl (:doc (meta test-fn-var))) rlm@69: (run-world ((deref test-fn-var)))) rlm@69: rlm@69: (defvar test-suite rlm@69: [#'cortex.test.touch/test-skin rlm@69: #'cortex.test.vision/test-two-eyes rlm@69: #'cortex.test.hearing/test-advanced-hearing rlm@69: #'cortex.test.body/test-proprioception rlm@69: #'cortex.test.body/test-motor-control] rlm@69: "The full test suite for all sensors/effectors.") rlm@69: rlm@71: (defn run-suite rlm@69: "Run the entire test-suite." rlm@69: [] rlm@69: (dorun (map run-test test-suite))) rlm@69: rlm@58: #+end_src rlm@58: rlm@69: #+results: body-main rlm@71: : #'cortex.test/run-suite rlm@69: rlm@69: rlm@58: * COMMENT generate Source. rlm@68: #+begin_src clojure :tangle ../src/cortex/test.clj rlm@58: <> rlm@58: #+end_src rlm@58: rlm@58: