Test programs
| Directory | What | Run by |
|---|---|---|
run/ | Programs with their expected output. Each runs interpreted and natively (differential testing), and natively must leave no live heap block. | louise_interp/tests/run.rs, louise_codegen_c/tests/native.rs |
ui/ | Programs with expected diagnostics and types (format in louise_db/tests/ui.rs). After a change that moves lines (the formatter, a parser change), re-place the //~ markers with LOUISE_UI_BLESS=1 cargo test -p louise_db --test ui, then check the diff by hand. | louise_db/tests/ui.rs |
stress/ | Actor programs built optimised and run on several scheduler threads. | scripts/stress.sh |
bench/ | Benchmarks, each printing a checksum (README). | scripts/bench.sh |
compare/ | The same small programs in Louise, Rust, Haskell, Java, JavaScript and Python, for the README's comparison. | scripts/compare.sh |
A change that must not alter what the compiler produces (a refactor) is checked with scripts/same-output.sh BASE: it builds louise at the revision BASE and from the working tree, and compares, for every program in run/, stress/, bench/ and the examples, the diagnostics, the Core with and without the optimiser, and the generated C in one unit and in three.
Expected output
A program in run/, stress/ or bench/ states what it must do in comments:
//> text: the program prints the linetext. The lines are expected in order, and nothing else may be printed on standard output. One space after//>is dropped;//>alone expects an empty line.//! panic: message: after printing the expected lines, the program stops with a panic whose message ismessage. Without it, the program must end normally.//@ small-stack: the program runs with a small stack: 256 KiB natively (LOUISE_STACK_KIB), 10,000 frames in the interpreter (LOUISE_INTERP_MAX_FRAMES, where going deeper panics with "stack overflow"). For programs that check their deep recursion runs in constant stack: the default stacks (1 GiB natively) would hide the difference.
A program in run/ reads <name>.stdin beside it as its standard input, on both backends (louise_testkit::stdin_of); without one, its input is empty. The file is bytes as they are (.gitattributes): CRLF, no final newline.
The Rust harnesses read them with louise_testkit::Expectations. The scripts read only //> lines, and only at the start of a line.
