Mercurial > cortex
view org/test.org @ 149:1e6beed24cec
saving before major refactoring
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 03 Feb 2012 04:31:58 -0700 |
parents | a1e421d9c485 |
children | 7e7f8d6d9ec5 |
line wrap: on
line source
1 #+title: Test Suite2 #+author: Robert McIntyre3 #+email: rlm@mit.edu4 #+description: Simulating a body (movement, touch, propioception) 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 (:use clojure.contrib.def)15 (:require [cortex.test touch vision body hearing])16 (:import com.jme3.app.state.AppState17 com.jme3.system.AppSettings))19 (defn run-world20 "run the simulation and wait until it closes proprely."21 [world]22 (let [lock (promise)]23 (.enqueue24 world25 (partial26 (fn [world]27 (.attach28 (.getStateManager world)29 (proxy [AppState] []30 (cleanup [] (deliver lock nil))31 (initialize [_ _])32 (isEnabled [] true)33 (setEnabled [_] )34 (stateAttached [_])35 (stateDetached [_])36 (update [_])37 (render [_])38 (isInitialized [] true)39 (postRender []))))40 world))41 (.start world)42 (deref lock)))44 (defn run-test45 "print the docstring for the test, then run the simulation which it46 yields, waiting until it is terminated."47 [test-fn-var]48 (println-repl "\n ****************\n")49 (println-repl (:doc (meta test-fn-var)))50 (run-world ((deref test-fn-var))))52 (defvar test-suite53 [#'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]58 "The full test suite for all sensors/effectors.")60 (defn run-suite61 "Run the entire test-suite."62 []63 (dorun (map run-test test-suite)))65 #+end_src67 #+results: body-main68 : #'cortex.test/run-suite71 * COMMENT generate Source.72 #+begin_src clojure :tangle ../src/cortex/test.clj73 <<body-main>>74 #+end_src