1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00
mal/tests/perf3.mal
Nicolas Boulenguez 83665b4fda lib/: add tests, fix detected problems, improve implementations
equality.mal:
- fix typos
- let and2 and or2 always return booleans
- when looping in sequences, compare lengths only once
- empty? instead of an equality test
- when looping on a keys, do not check if a contains the current key
- change the `cond` logic: when a is a sequence and b a map, return
  false instead of delegating to scalar-equal?.
- add tests

memoize.mal:
- make explicit that the function name must be kept
- fix typo in tests

protocols.mal:
- document
- add a function mapping an object to its type
- add default types for remaining built-in MAL values
- let defprotocol return the new protocol instead of last method
- set the right profile for abstract methods, improving error messages
- replace incomplete example with lots of tests

pprint:
- escape parenthesis in expected test results

[kanaka]
- explain in lib/README.md how to run tests/lib/*.
- rename folds to reducers and composition to threading
- move fib and sumdown from lib/ to tests/
2019-05-18 01:52:13 +02:00

20 lines
631 B
Plaintext

(load-file "../lib/threading.mal") ; ->
(load-file "../lib/perf.mal") ; run-fn-for
(load-file "../lib/test_cascade.mal") ; or
;;(prn "Start: basic macros/atom test")
(def! atm (atom (list 0 1 2 3 4 5 6 7 8 9)))
(println "iters over 10 seconds:"
(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))
;;(prn "Done: basic macros/atom test")