Mercurial > cortex
comparison org/test.org @ 321:702b5c78c2de
gathered all the tests into (run-suite), which should make testing vastly easier.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 08 May 2012 08:22:19 -0500 |
parents | bb3f8a4af87f |
children | 5c398b65d01b |
comparison
equal
deleted
inserted
replaced
320:52de8a36edde | 321:702b5c78c2de |
---|---|
9 | 9 |
10 #+name: body-main | 10 #+name: body-main |
11 #+begin_src clojure | 11 #+begin_src clojure |
12 (ns cortex.test | 12 (ns cortex.test |
13 (:use cortex.util) | 13 (:use cortex.util) |
14 (:require [cortex.test touch vision body hearing]) | 14 (:require [cortex.test |
15 body | |
16 vision | |
17 hearing | |
18 touch | |
19 proprioception | |
20 movement | |
21 | |
22 ]) | |
15 (:import com.jme3.app.state.AppState | 23 (:import com.jme3.app.state.AppState |
16 com.jme3.system.AppSettings)) | 24 com.jme3.system.AppSettings) |
25 (:import (com.jme3.math Triangle Vector3f Vector2f Ray Matrix4f))) | |
17 | 26 |
18 (defn run-world | 27 (defn run-world |
19 "run the simulation and wait until it closes properly." | 28 "run the simulation and wait until it closes properly." |
20 [world] | 29 [world] |
21 (let [lock (promise)] | 30 (let [lock (promise)] |
42 | 51 |
43 (defn run-test | 52 (defn run-test |
44 "print the docstring for the test, then run the simulation which it | 53 "print the docstring for the test, then run the simulation which it |
45 yields, waiting until it is terminated." | 54 yields, waiting until it is terminated." |
46 [test-fn-var] | 55 [test-fn-var] |
56 (println-repl (:doc (meta test-fn-var))) | |
47 (println-repl "\n ****************\n") | 57 (println-repl "\n ****************\n") |
48 (println-repl (:doc (meta test-fn-var))) | |
49 (run-world ((deref test-fn-var)))) | 58 (run-world ((deref test-fn-var)))) |
50 | 59 |
51 (def test-suite | 60 (def test-suite |
52 "The full test suite for all sensors/effectors." | 61 "The full test suite for all sensors/effectors." |
53 [#'cortex.test.touch/test-skin | 62 [#'cortex.test.body/test-worm |
54 #'cortex.test.vision/test-two-eyes | |
55 #'cortex.test.hearing/test-advanced-hearing | |
56 #'cortex.test.body/test-proprioception | |
57 #'cortex.test.body/test-motor-control]) | |
58 | 63 |
64 #'cortex.test.vision/test-pipeline | |
65 #'cortex.test.vision/test-worm-vision | |
66 | |
67 #'cortex.test.hearing/test-java-hearing | |
68 #'cortex.test.hearing/test-worm-hearing | |
69 | |
70 #'cortex.test.touch/test-basic-touch | |
71 #'cortex.test.touch/test-worm-touch | |
72 | |
73 #'cortex.test.proprioception/test-proprioception | |
74 | |
75 #'cortex.test.movement/test-worm-movement | |
76 ]) | |
77 | |
78 | |
79 | |
59 (defn run-suite | 80 (defn run-suite |
60 "Run the entire test-suite." | 81 "Run the entire test-suite." |
61 [] | 82 [] |
83 (println-repl "\n ****************\n") | |
62 (dorun (map run-test test-suite))) | 84 (dorun (map run-test test-suite))) |
63 | 85 |
64 #+end_src | 86 #+end_src |
65 | 87 |
66 #+results: body-main | 88 #+results: body-main |