The developer problem
A test that only prints an error can leave a build green. TAP defines a machine-readable result for each check and a plan stating how many results to expect. Wren couples that output to the number of failures.
Run the project locally
The suite checks a decimal invoice total and a whole-box count, then records an offline printer as a skip. Change the expected box count to see the process exit with status 1. Install Blyx 0.2.1, Rust and a host linker, then run these commands.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-wren.git
cd blyx-wren
blyxc native-run project.blyxUse the API
Start with wr_begin, pass the returned suite to each check or skip, then call process_exit(wr_end(suite)). The producer emits a trailing TAP plan. Names are truncated at a line break or # to keep the stream unambiguous. Relative tolerance ranges from zero to one. Inputs for measurements and tolerances must be finite.
| Function | Behavior |
|---|---|
| wr_begin(), wr_check(suite, passed, label) | Import tap. Start a TAP stream and record numbered checks. |
| wr_skip(suite, label, detail), wr_end(suite) | Declare a skip and finish with a plan. wr_end returns 1 when a check failed. |
| wr_near(actual, expected, absolute, relative) | Compare using the larger of an absolute tolerance and a tolerance scaled by the larger input magnitude. |
| wr_start(), wr_record(suite, passed, skipped), wr_exit(suite) | Track total, failed and skipped cases without writing TAP output. |
Verify a change
Run the package checks from its release directory. Compare the browser example with its expected output, then change the input in the exercise below.
blyxc native-run tests.blyxTry the program
Expected output
3 1 1 1
Practice
Correct the failing arithmetic check and predict the exit code.
Hint
Change only the worked example’s input. The API table describes the output.
Worked solution
The suite still contains three cases and one skip, with zero failures and status zero.
Find
2 * 2 == 5Replace with
2 * 2 == 4Output after the change
3 0 1 0
