annotate org/test.org @ 411:a331d5ff73e0

saving progress for the night. completed self-organizing touch, still working on stream predicates.
author Robert McIntyre <rlm@mit.edu>
date Tue, 18 Mar 2014 23:04:48 -0400
parents 4c37d39a3cf6
children
rev   line source
rlm@66 1 #+title: Test Suite
rlm@58 2 #+author: Robert McIntyre
rlm@58 3 #+email: rlm@mit.edu
rlm@306 4 #+description: Simulating a body (movement, touch, proprioception) in jMonkeyEngine3.
rlm@58 5 #+SETUPFILE: ../../aurellem/org/setup.org
rlm@58 6 #+INCLUDE: ../../aurellem/org/level-0.org
rlm@58 7
rlm@66 8 * Tests
rlm@58 9
rlm@66 10 #+name: body-main
rlm@58 11 #+begin_src clojure
rlm@68 12 (ns cortex.test
rlm@69 13 (:use cortex.util)
rlm@321 14 (:require [cortex.test
rlm@321 15 body
rlm@321 16 vision
rlm@321 17 hearing
rlm@321 18 touch
rlm@321 19 proprioception
rlm@321 20 movement
rlm@388 21 integration])
rlm@321 22
rlm@58 23 (:import com.jme3.app.state.AppState
rlm@321 24 com.jme3.system.AppSettings)
rlm@321 25 (:import (com.jme3.math Triangle Vector3f Vector2f Ray Matrix4f)))
rlm@58 26
rlm@58 27 (defn run-world
rlm@306 28 "run the simulation and wait until it closes properly."
rlm@58 29 [world]
rlm@58 30 (let [lock (promise)]
rlm@58 31 (.enqueue
rlm@58 32 world
rlm@58 33 (partial
rlm@58 34 (fn [world]
rlm@58 35 (.attach
rlm@58 36 (.getStateManager world)
rlm@58 37 (proxy [AppState] []
rlm@58 38 (cleanup [] (deliver lock nil))
rlm@58 39 (initialize [_ _])
rlm@58 40 (isEnabled [] true)
rlm@58 41 (setEnabled [_] )
rlm@58 42 (stateAttached [_])
rlm@58 43 (stateDetached [_])
rlm@58 44 (update [_])
rlm@58 45 (render [_])
rlm@58 46 (isInitialized [] true)
rlm@58 47 (postRender []))))
rlm@58 48 world))
rlm@58 49 (.start world)
rlm@58 50 (deref lock)))
rlm@58 51
rlm@69 52 (defn run-test
rlm@69 53 "print the docstring for the test, then run the simulation which it
rlm@69 54 yields, waiting until it is terminated."
rlm@69 55 [test-fn-var]
rlm@321 56 (println-repl (:doc (meta test-fn-var)))
rlm@69 57 (println-repl "\n ****************\n")
rlm@69 58 (run-world ((deref test-fn-var))))
rlm@69 59
rlm@317 60 (def test-suite
rlm@317 61 "The full test suite for all sensors/effectors."
rlm@321 62 [#'cortex.test.body/test-worm
rlm@69 63
rlm@321 64 #'cortex.test.vision/test-pipeline
rlm@321 65 #'cortex.test.vision/test-worm-vision
rlm@321 66
rlm@321 67 #'cortex.test.hearing/test-java-hearing
rlm@321 68 #'cortex.test.hearing/test-worm-hearing
rlm@321 69
rlm@321 70 #'cortex.test.touch/test-basic-touch
rlm@321 71 #'cortex.test.touch/test-worm-touch
rlm@321 72
rlm@321 73 #'cortex.test.proprioception/test-proprioception
rlm@321 74
rlm@321 75 #'cortex.test.movement/test-worm-movement
rlm@388 76
rlm@388 77 #'cortex.test.integration/test-integration
rlm@321 78 ])
rlm@321 79
rlm@321 80
rlm@321 81
rlm@71 82 (defn run-suite
rlm@69 83 "Run the entire test-suite."
rlm@69 84 []
rlm@323 85 (load-bullet)
rlm@321 86 (println-repl "\n ****************\n")
rlm@323 87 (dorun (map run-test test-suite))
rlm@323 88 (println "all tests complete."))
rlm@323 89
rlm@69 90
rlm@58 91 #+end_src
rlm@58 92
rlm@69 93 #+results: body-main
rlm@71 94 : #'cortex.test/run-suite
rlm@69 95
rlm@69 96
rlm@58 97 * COMMENT generate Source.
rlm@68 98 #+begin_src clojure :tangle ../src/cortex/test.clj
rlm@58 99 <<body-main>>
rlm@58 100 #+end_src
rlm@58 101
rlm@58 102