Mercurial > cortex
view org/test.org @ 317:bb3f8a4af87f
removed references to defvar from clojure.contrib.def since the def from 1.4 now allows for docstrings
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 28 Feb 2012 14:04:21 -0600 |
parents | 7e7f8d6d9ec5 |
children | 702b5c78c2de |
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.test touch vision body hearing])15 (:import com.jme3.app.state.AppState16 com.jme3.system.AppSettings))18 (defn run-world19 "run the simulation and wait until it closes properly."20 [world]21 (let [lock (promise)]22 (.enqueue23 world24 (partial25 (fn [world]26 (.attach27 (.getStateManager world)28 (proxy [AppState] []29 (cleanup [] (deliver lock nil))30 (initialize [_ _])31 (isEnabled [] true)32 (setEnabled [_] )33 (stateAttached [_])34 (stateDetached [_])35 (update [_])36 (render [_])37 (isInitialized [] true)38 (postRender []))))39 world))40 (.start world)41 (deref lock)))43 (defn run-test44 "print the docstring for the test, then run the simulation which it45 yields, waiting until it is terminated."46 [test-fn-var]47 (println-repl "\n ****************\n")48 (println-repl (:doc (meta test-fn-var)))49 (run-world ((deref test-fn-var))))51 (def test-suite52 "The full test suite for all sensors/effectors."53 [#'cortex.test.touch/test-skin54 #'cortex.test.vision/test-two-eyes55 #'cortex.test.hearing/test-advanced-hearing56 #'cortex.test.body/test-proprioception57 #'cortex.test.body/test-motor-control])59 (defn run-suite60 "Run the entire test-suite."61 []62 (dorun (map run-test test-suite)))64 #+end_src66 #+results: body-main67 : #'cortex.test/run-suite70 * COMMENT generate Source.71 #+begin_src clojure :tangle ../src/cortex/test.clj72 <<body-main>>73 #+end_src