Testing
tilttek/character-sheetThe package's tests
composer install
vendor/bin/phpunit --no-configuration tests
The unit suite, under tests/Unit, runs without a kernel, a database or a network: the sheets live in
Store\InMemorySheetStore, and the game system of the tests is built in memory with tilttek/rpg-systems. The tests
take each bound at its last allowed value and at the first refused one. In the monorepo, Infection holds the package
at 100 % of covered mutants.
An application tests its own SheetStore against the rules of the store: nothing for
an identifier never kept, a new sheet kept once, a stale one refused on save and on delete, the version raised by one at
each write, and the items, charges and campaign fields read back in their order and with their types.
The fuzz target
tests/Fuzz/formula.php is the fuzz target of the formulas: any text is refused with the library's exceptions, or
gives a formula whose canonical text reads back to the same canonical text, the same names and the same value.
composer fuzz runs it.
Benchmarks
tests/Benchmark/SheetBench.php computes a full sheet — 6 attributes, 60 derived values, 4 pools, 200 items of which
40 equipped — as a page does at each display, builds the rules of that system as a worker does at warm-up, and reads
one formula. On PHP 8.5 without an opcode cache: the sheet in about 0.28 ms, the rules in about 1.8 ms, a formula in
about 0.03 ms.