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.
20 lines
327 B
Plaintext
20 lines
327 B
Plaintext
;; Complex Data Structure Test
|
|
;; Benchmark: 66.8us
|
|
;; Output: {:input 10, :name "Fibonacci", :output 55}
|
|
(do
|
|
(def fib (fn [n]
|
|
(if (< n 2)
|
|
n
|
|
(+ (fib (- n 1)) (fib (- n 2))))))
|
|
|
|
(def result (fib 10))
|
|
|
|
(def data {
|
|
:name "Fibonacci"
|
|
:input 10
|
|
:output result
|
|
})
|
|
|
|
data
|
|
)
|