|
libose
the C library every o.se host is built on
|
Files | |
| ose_test_bundle_literal.h | |
| ose_test_common.h | |
| provides utility functions and global variables for testing | |
| ose_test_ctosc.h | |
| provides a compile-time OSC implementation. | |
| ose_test_unit.h | |
| provides unit testing functions for OSE/OSC bundles. | |
| ose_test_vm_literal.h | |
The test harness for libose and the modules that build on it.
Test code never uses the library under test to build its expected values. They are constructed by preprocessor macros in ose_test_ctosc.h:
That is a bundle containing one message with an empty address, typetag i, and the integer 32 — assembled by the C preprocessor into bytes, without calling libose at all. So a bug in the library cannot make a test agree with it, which is the failure mode that makes a green suite worthless.
| file | |
|---|---|
| ose_test_ctosc.h | the macros above: expected OSC, built by the preprocessor |
| ose_test_unit.h | the test macros — UNIT_TEST_BUNDLE_TRANSFORM, UNIT_TEST_WITH_VM, and friends |
| ose_test_common.h | reporting, comparison, the signal handling that lets a test expect an assert |
| ose_test_bundle_literal.h, ose_test_vm_literal.h | generated fixtures — a known-good bundle and a known-good VM, byte by byte |
| tools/emit_bundle_literal.c, tools/emit_vm_literal.c | what generates them |
The fixtures are generated rather than hand-written because they are several thousand bytes of layout-sensitive hex. They went stale once when the context layout changed underneath them and nobody noticed, which is what the generators exist to prevent. Regenerate after any change to the context layout; the header of each generator says how.
From libose:
Twelve suites. Each binary exits nonzero if any of its tests fail, so check is usable as a CI gate.
Every suite is built with OSE_CONF_DEBUG and OSE_QUIET_ASSERT — asserts live — because an assert firing is a legitimate way to show that a precondition is enforced.
ut_ose_preconditions is the exception, built deliberately without them. It asks what the library does when a precondition is violated and there is no assert to catch it, which is the configuration that ships. That cannot be asked with asserts on, because a quiet assert still calls abort().