From 4208d9d47140d913385168077d55dcf0a37c4e96 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Fri, 31 Jul 2026 07:17:18 -0400 Subject: [PATCH] Regenerate the coverage numbers 77.2% line and 83.1% function coverage across 2637 lines, up from 72.2% / 78.6%, with the three new suites at 91% (audio), 95% (draw) and 58% (text). All 19 suites pass: the note recording character as an intentional failure was stale, and neither tests/character.c nor src/character.c has changed since it was written. Co-Authored-By: Claude Opus 5 (1M context) --- TODO.md | 56 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/TODO.md b/TODO.md index 510090e..44087aa 100644 --- a/TODO.md +++ b/TODO.md @@ -379,30 +379,35 @@ ctest --test-dir build-coverage --output-on-failure Reports land in `build-coverage/coverage/` (`index.html`, `coverage.xml`). -**Line coverage 72.2%, function coverage 78.6%** (1534/2125 lines), up from a -39.6% / 44.3% baseline. `character` is the one intentionally failing suite; -everything else passes. +**Line coverage 77.2%, function coverage 83.1%** (2035/2637 lines), up from a +39.6% / 44.3% baseline. All 19 suites pass. (An earlier revision of this file +recorded `character` as an intentionally failing suite; it passes now, and +nothing in `tests/character.c` or `src/character.c` has changed since — the fix +came from elsewhere in the tree and this note was never updated.) | File | Lines | Functions | |---|---|---| -| `src/actor.c` | 205/258 (80%) | 16/18 | +| `src/actor.c` | 205/258 (79%) | 16/18 | | `src/assets.c` | 0/21 (0%) | 0/1 | +| `src/audio.c` | 189/207 (91%) | 19/20 | | `src/character.c` | 104/118 (88%) | 6/7 | -| `src/controller.c` | 220/243 (90%) | 9/9 | -| `src/draw.c` | 0/13 (0%) | 0/1 | -| `src/game.c` | 124/230 (54%) | 10/15 | -| `src/heap.c` | 116/116 (100%) | 12/12 | +| `src/controller.c` | 247/270 (91%) | 12/12 | +| `src/draw.c` | 253/267 (95%) | 11/12 | +| `src/error.c` | 9/9 (100%) | 1/1 | +| `src/game.c` | 124/231 (54%) | 10/15 | +| `src/heap.c` | 111/111 (100%) | 12/12 | | `src/json_helpers.c` | 111/111 (100%) | 11/11 | | `src/physics.c` | 140/140 (100%) | 10/10 | -| `src/registry.c` | 76/102 (74%) | 11/12 | +| `src/registry.c` | 76/102 (75%) | 11/12 | | `src/renderer.c` | 7/70 (10%) | 1/7 | | `src/sprite.c` | 93/101 (92%) | 5/5 | | `src/staticstring.c` | 16/17 (94%) | 2/2 | -| `src/text.c` | 0/28 (0%) | 0/2 | +| `src/text.c` | 26/45 (58%) | 3/4 | | `src/tilemap.c` | 201/426 (47%) | 10/20 | | `src/util.c` | 121/131 (92%) | 7/8 | +| `src/version.c` | 2/2 (100%) | 1/1 | -Branch coverage reads 18.6% and should not be used as a target. The akerror +Branch coverage reads 20.8% and should not be used as a target. The akerror control-flow macros (`ATTEMPT`/`CATCH`/`PROCESS`/`FINISH`, `FAIL_*_RETURN`) expand into large branch trees per call site, most of them unreachable in normal operation — `src/game.c` reports over 1700 branches across 230 lines. Track line @@ -439,14 +444,24 @@ Done: - `tests/actor.c` — extended with the eight control-map handlers, automatic facing, movement logic, the animation frame state machine, `akgl_actor_update`, and character/sprite binding lookups. 80%. +- `tests/audio.c` — every waveform, the ADSR envelope stage by stage, gate + expiry and release, voice summing and clamping, the master level, and device + open/shutdown under the dummy driver. 91%. +- `tests/draw.c` — every primitive against a 64x64 software renderer with the + pixels read back, including flood-fill containment, save/paste roundtrip, and + that drawing restores the renderer's draw color. 95%. +- `tests/text.c` — font loading into the registry and both measurement entry + points against a monospaced fixture font. 58%; the rest of `src/text.c` is + `akgl_text_rendertextat`, which needs the harness. ## Remaining work ### Needs the offscreen renderer harness -`src/renderer.c` (63 lines), `src/text.c` (28), `src/draw.c` (13), -`src/assets.c` (21), `akgl_actor_render`/`actor_visible` in `src/actor.c` (53), -and the drawing half of `src/tilemap.c` all need a live `renderer` global. +`src/renderer.c` (63 lines), `akgl_text_rendertextat` in `src/text.c` (19), +`akgl_draw_background` in `src/draw.c` (13), `src/assets.c` (21), +`akgl_actor_render`/`actor_visible` in `src/actor.c` (53), and the drawing half +of `src/tilemap.c` all need a live `renderer` global. Build `tests/harness.c` / `tests/harness.h` with `akgl_test_init_headless()` and `akgl_test_shutdown_headless()`: set the dummy video and audio drivers, @@ -464,10 +479,15 @@ Then: rotated `draw_texture` path including `angle != 0` with a NULL center; the `draw_mesh` "not implemented" stub; and `draw_world` layer ordering. Note `defflags` at `src/renderer.c:113` is uninitialized until the `if` body runs. -- **`tests/text.c`**, **`tests/draw.c`**, **`tests/assets.c`** — font loading - into `AKGL_REGISTRY_FONT`, text rendering with wrap on and off, background - drawing at zero/negative/oversized dimensions, and BGM loading into - `AKGL_REGISTRY_MUSIC` under the dummy audio driver. +- **`tests/assets.c`** — BGM loading into `AKGL_REGISTRY_MUSIC` under the dummy + audio driver. +- **`tests/text.c` extensions** — text rendering with wrap on and off. + `tests/text.c` exists and covers font loading and measurement; only + `akgl_text_rendertextat` is left. +- **`tests/draw.c` extensions** — `akgl_draw_background` at zero, negative and + oversized dimensions. `tests/draw.c` exists and covers every other primitive + against a software renderer; `akgl_draw_background` is the one function in the + file that still reads the global `renderer` rather than taking a backend. - **`tests/tilemap.c` extensions** — `akgl_tilemap_draw`, `_draw_tileset`, and `akgl_tilemap_load_layer_image`.