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