Testing

Independent references

QCheck compares overlapping search with a naive per-pattern scan, including output order. A second reference tries each pattern at each input position to check leftmost-longest selection and replacement.

Streaming modes are checked across random chunk splits. Cases include empty chunks, empty pattern lists, mixed ASCII case, arbitrary bytes, duplicates, and dense overlapping matches.

Regression cases

Alcotest covers classic ushers matches, duplicate IDs, empty patterns, accessors, binary data, tie-breaking, chunk boundaries, state reuse, final flushes, and a large chunk of dense matches.

Other implementations

Conformance tests port published vectors from Rust aho-corasick, daachorse, and pyahocorasick. A separate CI job compares 20,000 generated cases with three pinned implementations and runs a count-checked benchmark smoke test.

Run locally

opam install . --deps-only --with-test
opam exec -- dune runtest

Replay a failing random seed with:

QCHECK_SEED=12345 opam exec -- dune runtest --force

CI covers OCaml 4.14 and 5.4, lower dependency bounds, package installation, generated opam metadata, API documentation, website links, and the differential harness.

Scope

These checks are not a formal proof. Cross-library results apply to the pinned versions and generated cases; throughput depends on the machine and workload.

Report a bug

Include the compiler version, patterns, input bytes, expected and actual matches, and exact chunks for streaming failures.

Open an issue · Read the tests