Mercurial > cortex
view org/test.org @ 325:9ba3959b261b
modify winston-intro
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 19 Jul 2012 11:12:26 -0500 |
parents | 5c398b65d01b |
children | 4c37d39a3cf6 |
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 movement22 ])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-movement76 ])80 (defn run-suite81 "Run the entire test-suite."82 []83 (load-bullet)84 (println-repl "\n ****************\n")85 (dorun (map run-test test-suite))86 (println "all tests complete."))89 #+end_src91 #+results: body-main92 : #'cortex.test/run-suite95 * COMMENT generate Source.96 #+begin_src clojure :tangle ../src/cortex/test.clj97 <<body-main>>98 #+end_src