rlm@66
|
1 #+title: Test Suite
|
rlm@58
|
2 #+author: Robert McIntyre
|
rlm@58
|
3 #+email: rlm@mit.edu
|
rlm@58
|
4 #+description: Simulating a body (movement, touch, propioception) 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@58
|
12 (ns test.all
|
rlm@58
|
13 (:require [test touch vision])
|
rlm@58
|
14 (:import com.jme3.app.state.AppState
|
rlm@58
|
15 com.jme3.system.AppSettings))
|
rlm@58
|
16
|
rlm@58
|
17 (defn run-world
|
rlm@58
|
18 "run the simulation and wait until it closes proprely"
|
rlm@58
|
19 [world]
|
rlm@58
|
20 (let [lock (promise)]
|
rlm@58
|
21 (.enqueue
|
rlm@58
|
22 world
|
rlm@58
|
23 (partial
|
rlm@58
|
24 (fn [world]
|
rlm@58
|
25 (.attach
|
rlm@58
|
26 (.getStateManager world)
|
rlm@58
|
27 (proxy [AppState] []
|
rlm@58
|
28 (cleanup [] (deliver lock nil))
|
rlm@58
|
29 (initialize [_ _])
|
rlm@58
|
30 (isEnabled [] true)
|
rlm@58
|
31 (setEnabled [_] )
|
rlm@58
|
32 (stateAttached [_])
|
rlm@58
|
33 (stateDetached [_])
|
rlm@58
|
34 (update [_])
|
rlm@58
|
35 (render [_])
|
rlm@58
|
36 (isInitialized [] true)
|
rlm@58
|
37 (postRender []))))
|
rlm@58
|
38 world))
|
rlm@58
|
39 (.start world)
|
rlm@58
|
40 (deref lock)))
|
rlm@58
|
41
|
rlm@58
|
42 (defn test-all []
|
rlm@58
|
43 (println
|
rlm@58
|
44 "***************\n"
|
rlm@58
|
45 "Testing touch:\n"
|
rlm@58
|
46 "you should see a ball which responds to the table\n"
|
rlm@58
|
47 "and whatever balls hit it.\n")
|
rlm@58
|
48 (run-world (test.touch/test-skin))
|
rlm@58
|
49 (println
|
rlm@58
|
50 "***************\n"
|
rlm@58
|
51 "Testing vision:\n"
|
rlm@58
|
52 "You should see a rotating cube, and two windows,\n"
|
rlm@58
|
53 "each displaying a different view of the cube.\n")
|
rlm@58
|
54 (run-world (test.vision/test-two-eyes))
|
rlm@58
|
55 (println
|
rlm@58
|
56 "***************\n"
|
rlm@58
|
57 "Testing hearing:\n"
|
rlm@58
|
58 "You should see a blue sphere flying around several\n"
|
rlm@58
|
59 "cubes. As the sphere approaches each cube, it turns\n"
|
rlm@58
|
60 "green.\n")
|
rlm@58
|
61 (run-world
|
rlm@58
|
62 (doto (com.aurellem.capture.examples.Advanced.)
|
rlm@58
|
63 (.setSettings
|
rlm@58
|
64 (doto (AppSettings. true)
|
rlm@58
|
65 (.setAudioRenderer "Send")))
|
rlm@58
|
66 (.setShowSettings false)
|
rlm@58
|
67 (.setPauseOnLostFocus false))))
|
rlm@58
|
68 #+end_src
|
rlm@58
|
69
|
rlm@58
|
70
|
rlm@58
|
71
|
rlm@58
|
72
|
rlm@58
|
73 * COMMENT generate Source.
|
rlm@58
|
74 #+begin_src clojure :tangle ../src/test/all.clj
|
rlm@58
|
75 <<body-main>>
|
rlm@58
|
76 #+end_src
|
rlm@58
|
77
|
rlm@58
|
78
|