b0f139f389
This commit introduces a new `tester` module to the `ast` crate, enabling functional tests and performance benchmarks for MYC scripts. Functional tests are executed by reading `.myc` files from the `examples` directory, parsing expected output comments, and comparing them against the actual script execution results. Benchmarking involves measuring the execution time of scripts, calculating median durations, and comparing them against stored baselines. The commit also adds support for updating these baselines. The `ast.rs` CLI and the `main.rs` GUI application have been updated to expose these new testing and benchmarking features. The `Cargo.toml` and `Cargo.lock` files have been updated to include the `regex` dependency required for parsing benchmark comments.
10 lines
165 B
Plaintext
10 lines
165 B
Plaintext
;; Higher-Order Function Example
|
|
;; Benchmark: 7.4us
|
|
;; Output: 25
|
|
(do
|
|
(def apply (fn [f x] (f x)))
|
|
(def square (fn [x] (* x x)))
|
|
|
|
(apply square 5)
|
|
)
|