diff org/test.org @ 58:25142dad240a

created test suite
author Robert McIntyre <rlm@mit.edu>
date Sat, 19 Nov 2011 23:42:21 -0700
parents
children 1381a6ebd08b
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/org/test.org	Sat Nov 19 23:42:21 2011 -0700
     1.3 @@ -0,0 +1,78 @@
     1.4 +#+title: The BODY!!!
     1.5 +#+author: Robert McIntyre
     1.6 +#+email: rlm@mit.edu
     1.7 +#+description: Simulating a body (movement, touch, propioception) in jMonkeyEngine3.
     1.8 +#+SETUPFILE: ../../aurellem/org/setup.org
     1.9 +#+INCLUDE: ../../aurellem/org/level-0.org
    1.10 +
    1.11 +* Body  
    1.12 +
    1.13 +#+srcname: body-main
    1.14 +#+begin_src clojure 
    1.15 +(ns test.all
    1.16 +  (:require [test touch vision])
    1.17 +  (:import com.jme3.app.state.AppState
    1.18 +           com.jme3.system.AppSettings))
    1.19 +
    1.20 +(defn run-world
    1.21 +  "run the simulation and wait until it closes proprely"
    1.22 +  [world]
    1.23 +  (let [lock (promise)]
    1.24 +    (.enqueue
    1.25 +     world 
    1.26 +     (partial
    1.27 +      (fn [world]
    1.28 +        (.attach
    1.29 +         (.getStateManager world)
    1.30 +         (proxy [AppState] []
    1.31 +           (cleanup [] (deliver lock nil))
    1.32 +           (initialize [_ _])
    1.33 +           (isEnabled [] true)
    1.34 +           (setEnabled [_] )
    1.35 +           (stateAttached [_])
    1.36 +           (stateDetached [_])
    1.37 +           (update [_])
    1.38 +           (render [_])
    1.39 +           (isInitialized [] true)
    1.40 +           (postRender []))))
    1.41 +      world))
    1.42 +    (.start world)
    1.43 +    (deref lock)))
    1.44 +
    1.45 +(defn test-all []
    1.46 +  (println
    1.47 +   "***************\n"
    1.48 +   "Testing touch:\n"
    1.49 +   "you should see a ball which responds to the table\n"
    1.50 +   "and whatever balls hit it.\n")
    1.51 +  (run-world (test.touch/test-skin))
    1.52 +  (println
    1.53 +   "***************\n"
    1.54 +   "Testing vision:\n"
    1.55 +   "You should see a rotating cube, and two windows,\n"
    1.56 +   "each displaying a different view of the cube.\n")
    1.57 +  (run-world (test.vision/test-two-eyes))
    1.58 +  (println
    1.59 +   "***************\n"
    1.60 +   "Testing hearing:\n"
    1.61 +   "You should see a blue sphere flying around several\n"
    1.62 +   "cubes.  As the sphere approaches each cube, it turns\n"
    1.63 +   "green.\n")
    1.64 +  (run-world
    1.65 +   (doto (com.aurellem.capture.examples.Advanced.)
    1.66 +     (.setSettings
    1.67 +      (doto (AppSettings. true)
    1.68 +        (.setAudioRenderer "Send")))
    1.69 +     (.setShowSettings false)
    1.70 +     (.setPauseOnLostFocus false))))
    1.71 +#+end_src
    1.72 +
    1.73 +
    1.74 +
    1.75 +
    1.76 +* COMMENT generate Source.
    1.77 +#+begin_src clojure :tangle ../src/test/all.clj
    1.78 +<<body-main>>
    1.79 +#+end_src
    1.80 +
    1.81 +