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@321: (:require [cortex.test rlm@321: body rlm@321: vision rlm@321: hearing rlm@321: touch rlm@321: proprioception rlm@321: movement rlm@388: integration]) rlm@321: rlm@58: (:import com.jme3.app.state.AppState rlm@321: com.jme3.system.AppSettings) rlm@321: (:import (com.jme3.math Triangle Vector3f Vector2f Ray Matrix4f))) 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@321: (println-repl (:doc (meta test-fn-var))) rlm@69: (println-repl "\n ****************\n") rlm@69: (run-world ((deref test-fn-var)))) rlm@69: rlm@317: (def test-suite rlm@317: "The full test suite for all sensors/effectors." rlm@321: [#'cortex.test.body/test-worm rlm@69: rlm@321: #'cortex.test.vision/test-pipeline rlm@321: #'cortex.test.vision/test-worm-vision rlm@321: rlm@321: #'cortex.test.hearing/test-java-hearing rlm@321: #'cortex.test.hearing/test-worm-hearing rlm@321: rlm@321: #'cortex.test.touch/test-basic-touch rlm@321: #'cortex.test.touch/test-worm-touch rlm@321: rlm@321: #'cortex.test.proprioception/test-proprioception rlm@321: rlm@321: #'cortex.test.movement/test-worm-movement rlm@388: rlm@388: #'cortex.test.integration/test-integration rlm@321: ]) rlm@321: rlm@321: rlm@321: rlm@71: (defn run-suite rlm@69: "Run the entire test-suite." rlm@69: [] rlm@323: (load-bullet) rlm@321: (println-repl "\n ****************\n") rlm@323: (dorun (map run-test test-suite)) rlm@323: (println "all tests complete.")) rlm@323: 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: