Permalink
Browse files

Moved stress-test to test/stress_test.clj

  • Loading branch information...
1 parent e57cf2a commit 2704e1e5c389a005a373b017c770b9eac210d42e @thelmuth thelmuth committed Jun 26, 2012
View
@@ -236,31 +236,7 @@
[argmap]
(apply pushgp (apply concat argmap)))
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; stress test
-
-(defn stress-test
- "Performs a stress test of the registered instructions by generating and running n
- random programs. For more thorough testing and debugging of Push instructions you many
- want to un-comment code in execute-instruction that will allow you to look at recently
- executed instructions and the most recent state after an error. That code burns memory,
- however, so it is normally commented out. You might also want to comment out the handling
- of nil values in execute-instruction, do see if any instructions are introducing nils."
- [n]
- (let [completely-random-program
- (fn []
- (random-code 100 (concat @registered-instructions
- (list (fn [] (lrand-int 100))
- (fn [] (lrand))))))]
- (loop [i 0 p (completely-random-program)]
- (if (>= i n)
- (println :no-errors-found-in-stress-test)
- (let [result (run-push p (make-push-state) false)]
- (if result
- (recur (inc i) (completely-random-program))
- (println p)))))))
-;(stress-test 10000)
(defn -main
"A main function for clojush, which assumes that the first/only argument is the name
@@ -1,7 +1,7 @@
;; This is a file of commented-out informal tests (without outputs...)
;; of functions in coljush.clj.
-(ns clojush.test.clojush-tests
+(ns clojush.test.clojush_tests
(:use [clojush.clojush]
[clojush.globals]
[clojush.random]
@@ -0,0 +1,30 @@
+(ns clojush.test.stress_test
+ (:use [clojush.random]
+ [clojush.pushstate]
+ [clojush.interpreter]))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; stress test
+
+(defn stress-test
+ "Performs a stress test of the registered instructions by generating and running n
+ random programs. For more thorough testing and debugging of Push instructions you many
+ want to un-comment code in execute-instruction that will allow you to look at recently
+ executed instructions and the most recent state after an error. That code burns memory,
+ however, so it is normally commented out. You might also want to comment out the handling
+ of nil values in execute-instruction, do see if any instructions are introducing nils."
+ [n]
+ (let [completely-random-program
+ (fn []
+ (random-code 100 (concat @registered-instructions
+ (list (fn [] (lrand-int 100))
+ (fn [] (lrand))))))]
+ (loop [i 0 p (completely-random-program)]
+ (if (>= i n)
+ (println :no-errors-found-in-stress-test)
+ (let [result (run-push p (make-push-state) false)]
+ (if result
+ (recur (inc i) (completely-random-program))
+ (println p)))))))
+
+;(stress-test 10000)

0 comments on commit 2704e1e

Please sign in to comment.