; SPDX-License-Identifier: MPL-2.0
;
; AffineScript microbenchmarks (bench/).
;
; Visibility-only today (no merge-blocking threshold) — per
; docs/standards/TESTING.adoc §"Bench standards (visibility-only)".
; Each bench is an alcotest case wired into a dedicated executable
; under the `@bench` alias so the normal `dune runtest` gate is
; unaffected.
;
; Run with:
;   just bench                 (per docs/standards/TESTING.adoc)
;   dune runtest @bench --force
;
; Source layout:
;   bench/bench_main.ml        single test runner
;   bench/bench_fixtures.ml    shared input strings
;   bench/bench_lex.ml         lexer-only sweep
;   bench/bench_parse.ml       parser sweep
;   bench/bench_typecheck.ml   typecheck + quantity sweep
;   bench/bench_codegen.ml     wasm-codegen sweep

; `(test ...)` would auto-register bench_main under @runtest, defeating the
; visibility-only contract. Use `(executable ...)` + a dedicated `(rule
; (alias bench) ...)` so the bench is only invoked when explicitly targeted
; (`dune runtest @bench` / `just bench`). The previous `(alias bench)` field
; on `(test ...)` was rejected by dune 3.x as Unknown field.

(executable
 (name bench_main)
 (libraries affinescript alcotest unix)
 (modules
  bench_main
  bench_fixtures
  bench_lex
  bench_parse
  bench_typecheck
  bench_codegen
  bench_scaling
  bench_vm))

(rule
 (alias bench)
 (action
  (run %{exe:bench_main.exe})))
