Mercurial > cortex
view org/test.org @ 480:ad76b8b05517
s.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 28 Mar 2014 23:17:10 -0400 |
parents | 4c37d39a3cf6 |
children |
line wrap: on
line source
1 #+title: Test Suite2 #+author: Robert McIntyre3 #+email: rlm@mit.edu4 #+description: Simulating a body (movement, touch, proprioception) in jMonkeyEngine3.5 #+SETUPFILE: ../../aurellem/org/setup.org6 #+INCLUDE: ../../aurellem/org/level-0.org8 * Tests10 #+name: body-main11 #+begin_src clojure12 (ns cortex.test13 (:use cortex.util)14 (:require [cortex.test15 body16 vision17 hearing18 touch19 proprioception20 movement21 integration])23 (:import com.jme3.app.state.AppState24 com.jme3.system.AppSettings)25 (:import (com.jme3.math Triangle Vector3f Vector2f Ray Matrix4f)))27 (defn run-world28 "run the simulation and wait until it closes properly."29 [world]30 (let [lock (promise)]31 (.enqueue32 world33 (partial34 (fn [world]35 (.attach36 (.getStateManager world)37 (proxy [AppState] []38 (cleanup [] (deliver lock nil))39 (initialize [_ _])40 (isEnabled [] true)41 (setEnabled [_] )42 (stateAttached [_])43 (stateDetached [_])44 (update [_])45 (render [_])46 (isInitialized [] true)47 (postRender []))))48 world))49 (.start world)50 (deref lock)))52 (defn run-test53 "print the docstring for the test, then run the simulation which it54 yields, waiting until it is terminated."55 [test-fn-var]56 (println-repl (:doc (meta test-fn-var)))57 (println-repl "\n ****************\n")58 (run-world ((deref test-fn-var))))60 (def test-suite61 "The full test suite for all sensors/effectors."62 [#'cortex.test.body/test-worm64 #'cortex.test.vision/test-pipeline65 #'cortex.test.vision/test-worm-vision67 #'cortex.test.hearing/test-java-hearing68 #'cortex.test.hearing/test-worm-hearing70 #'cortex.test.touch/test-basic-touch71 #'cortex.test.touch/test-worm-touch73 #'cortex.test.proprioception/test-proprioception75 #'cortex.test.movement/test-worm-movement77 #'cortex.test.integration/test-integration78 ])82 (defn run-suite83 "Run the entire test-suite."84 []85 (load-bullet)86 (println-repl "\n ****************\n")87 (dorun (map run-test test-suite))88 (println "all tests complete."))91 #+end_src93 #+results: body-main94 : #'cortex.test/run-suite97 * COMMENT generate Source.98 #+begin_src clojure :tangle ../src/cortex/test.clj99 <<body-main>>100 #+end_src