cli/itl_expr_cli tutorial

This tutorial shows how to run ITF1788 .itl files with the interval runner, select operations, and read its JSON report. The runner is reached as floating-conformance --backend itl; below, itl abbreviates that command.

I want toUse
run the committed smoke fileitl with no path
run one or more .itl filesitl PATH …
run only some operations--operation NAME
fail on operations that are not implemented--strict-supported
call the runner from MoonBit@itl_expr_cli.run

Quick start

The executable is built from a checkout of the repository:

just conformance build interval
_build/conformance/itl/native/release/build/itl-conformance.exe --backend itl

With no path the runner executes testdata/interval/smoke.itl and prints one JSON object such as

{"schemaVersion":1,"runner":"itl-expression-interpreter","totalCases":…,"executableCases":…,"passedCases":…,"failedCases":0,…}

From MoonBit code

The runner is also a library. The package belongs to the tools module Luna-Flow/floating-tools (directory tooling/ of the repository, versioned with the library), not to the published library. Write your code as a package of this workspace or, once the tools module is published, run moon add Luna-Flow/floating-tools@0.11.0. Import "Luna-Flow/floating-tools/cli/itl_expr_cli" in moon.pkg and call run with the argument vector, program name first:

///|
test "run the ITL runner from MoonBit code" {
  let status = @itl_expr_cli.run(["itl", "../testdata/interval/smoke.itl"])
  inspect(status, content="0")
}

just docs runs the tests of this page in the module directory tooling/, so the corpus paths start with ../testdata; use your own paths in your code.

Everyday tasks

Run files

itl .tmp/interval/itf1788/libieeep1788_tests_set.itl
itl a.itl b.itl

Paths must be files; they are read in the given order.

Select operations

itl --operation add --operation sub libieeep1788_tests_elem.itl

Only cases whose operation is one of the listed names are executed and counted.

Make unsupported operations fail

itl --strict-supported --operation sqrt libieeep1788_tests_elem.itl

Without the flag, unsupported cases are reported in unsupportedIds but do not change the exit status; diagnostic cases always do.

Going further

  • just conformance run interval runs the phases listed in testdata/interval/interpreter_stages.json (files and operations per phase); add --strict-supported to forward strict mode to every phase.
  • itl_expr tutorial explains the cases and the pass rule.

Common pitfalls

  • No --json option. The output is always JSON; passing --json is an unknown option (exit 2).
  • No sharding. ITL files are small; the tooling parallelizes by phase.
  • All parse diagnostics are printed as PATH: MESSAGE, and the run stops, even when the bad statement belongs to an operation you did not select.
  • Strict mode counts unknown operations. Without --operation, cases such as nums2interval 1.0 2.0 = … are unsupported; they do not change the exit status unless --strict-supported is given.

Next steps