aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMiki Tebeka <miki.tebeka@gmail.com>2015-03-01 06:12:42 +0200
committerMiki Tebeka <miki.tebeka@gmail.com>2015-03-01 06:12:42 +0200
commit9fb199e2cb2cf44cd61c2a226193a70f6013aadc (patch)
tree325a2a8e33e3e8d18217d10854152cab82ac8b61 /tests
parent49916f9402e30a5277146355be878b32ec30f46d (diff)
parent2cb013877c4ed41d245ce7c5525405c4833c503d (diff)
downloadmal-9fb199e2cb2cf44cd61c2a226193a70f6013aadc.tar.gz
mal-9fb199e2cb2cf44cd61c2a226193a70f6013aadc.zip
Merge branch 'master' of https://github.com/kanaka/mal
Diffstat (limited to 'tests')
-rw-r--r--tests/perf3.mal28
-rw-r--r--tests/step2_eval.mal4
2 files changed, 30 insertions, 2 deletions
diff --git a/tests/perf3.mal b/tests/perf3.mal
new file mode 100644
index 0000000..be66239
--- /dev/null
+++ b/tests/perf3.mal
@@ -0,0 +1,28 @@
+(load-file "../core.mal")
+(load-file "../perf.mal")
+
+;;(prn "Start: basic macros/atom test")
+
+(def! atm (atom (list 0 1 2 3 4 5 6 7 8 9)))
+
+(println "iters/s:"
+ (run-fn-for
+ (fn* []
+ (do
+ (or false nil false nil false nil false nil false nil (first @atm))
+ (cond false 1 nil 2 false 3 nil 4 false 5 nil 6 "else" (first @atm))
+ (-> (deref atm) rest rest rest rest rest rest first)
+ (swap! atm (fn* [a] (concat (rest a) (list (first a)))))))
+ 10))
+
+;;(def! sumdown (fn* (N) (if (> N 0) (+ N (sumdown (- N 1))) 0)))
+;;(def! fib (fn* (N) (if (= N 0) 1 (if (= N 1) 1 (+ (fib (- N 1)) (fib (- N 2)))))))
+;;
+;;(println "iters/s:"
+;; (run-fn-for
+;; (fn* []
+;; (do
+;; (sumdown 10)
+;; (fib 12)))
+;; 3))
+;;(prn "Done: basic macros/atom test")
diff --git a/tests/step2_eval.mal b/tests/step2_eval.mal
index aaf1a7d..e975910 100644
--- a/tests/step2_eval.mal
+++ b/tests/step2_eval.mal
@@ -11,8 +11,8 @@
(/ (- (+ 5 (* 2 3)) 3) 4)
;=>2
-(/ (- (+ 515 (* 222 311)) 300) 41)
-;=>1689
+(/ (- (+ 515 (* 222 311)) 302) 27)
+;=>2565
(abc 1 2 3)
; .*\'abc\' not found.*