Tests

The board's unit tests are tests/agb_*.c. agb_state (tests/agb_state.c) runs a ROM it makes, saves a state, and checks that the 30 frames after a load, in the same machine and in a fresh one, give the same pictures, sound and state word for word as the run that went on, and that a state of another ROM, version or layout, damaged or cut short, is refused with the machine left as it was. A test build also downloads jsmolka's gba-tests (pinned in cpmfile.json) and runs each ROM as a test of its own, agb_gba_<rom> (tests/agb_gba_tests.py). The ROMs check the ARM and Thumb instruction sets, the BIOS's open bus, the memory map, the save memory and the display. A self-checking ROM leaves the number of its first failed test in a register, which scarletnx-agb --registers prints at the end of the run. The display ROMs are checked against the picture their source draws.

It downloads DenSinH's FuzzARM too, five ROMs of 10000 random ARM and Thumb instructions each, agb_fuzzarm_<rom> (tests/agb_fuzzarm.py). A ROM whose instructions all gave the values its generator computed ends in the loop after its tests with "End of testing" alone on its top line; one that met a difference waits for a key with the instruction on its screen.

With -DSNX_TEST_AGB_MGBA_SUITE=ON it downloads mGBA's test suite too (the ROM of mgba-emu/suite e694203, pinned in scarletnx/mgba-suite-rom's release), its 13 sections each a test, agb_mgba_<section>, labelled mgba-suite (tests/agb_mgba_suite.py). Its results were measured on the console; a section short of all of them passes at the count it reaches today, its issue named, and fails at any other. It is off by default: the 13 take about 90 s.

ctest --test-dir build/agb -R 'agb_(gba|fuzzarm)'
ctest --test-dir build/agb -L mgba-suite    # with SNX_TEST_AGB_MGBA_SUITE=ON

Made from docs/platforms/agb/README.md at 69237645142c. GPL-3.0-or-later.