This directory contains the test suite for the Hazel project.
- Test Framework: Alcotest
- Execution: Tests are run via the
run_testsscript ormakecommands.
-
Run all tests (including slow and property-based):
./run_tests
-
Filter tests by group or number:
- Run all tests in the "Statics" group with quick output (excluding slow/property-based):
./run_tests test 'Statics.*' -q
- Run only test 19 from the "Evaluator" group:
./run_tests test 'Evaluator' 19
- Run all tests in the "Statics" group with quick output (excluding slow/property-based):
-
Run all tests:
make test -
Run only quick tests (skip slow/property-based):
make test-quick
./run_testsis a shell script that first builds the tests usingdune(the OCaml build system), then runs them usingnode.- You can pass CLI arguments to
./run_teststo filter and control test execution. - For more CLI options, refer to the Alcotest documentation.
- All test files are located in this directory and its
statics/subdirectory. - Each file tests a specific module or feature (e.g.,
Test_Evaluator.refor the evaluator). - Property-based tests use QCheck and are included when running the full test suite.
- To add a new test, create a new file named
Test_<Feature>.reor add to an existing file. - Use the Alcotest API for defining test cases.
- Utility functions for property-based testing are in
QCheck_Util.re.
- If you encounter build errors, ensure all dependencies are installed:
make deps
- For issues with Node.js execution, check your Node.js version (>=14 recommended).
-
Run tests with coverage instrumentation:
make coverage
This will run the test suite and collect coverage data.
-
Generate an HTML coverage report:
make generate-coverage-html
This will produce an HTML file with a coverage overview, which you can open in your browser to inspect which parts of the codebase are covered by tests.
- Tests are automatically run on each pull request via GitHub Actions.
- CI status can be viewed on the repository main page.
- The test suite uses junit_alcotest to generate a
junit.xmlreport, which is picked up by CI for test result reporting. - Coverage information is uploaded to Codecov to provide coverage metrics on pull requests.