Host-side unit tests for the watchapp logic #68

Open
opened 2026-09-01 17:35:46 +02:00 by robert · 0 comments
robert commented 2026-09-01 17:35:46 +02:00 (Migrated from git.butzei.de)

Goal

Test the C. Every test issue in the plan targets the JVM companion - the watchapp, which is the half written in C, has none.

The field store, the formatter table, the staleness rule, the template geometry and the descriptor packing are all pure functions over plain data. Compiled for the host with a small harness they test without an emulator, a watch or a phone.

Acceptance criteria

  • Host build of the testable watchapp sources, with the Pebble SDK surface stubbed where touched
  • Small assertion harness - no framework dependency; this is a few hundred lines of C
  • Field store: set, read, absent-renders---, zero-is-not-absent
  • Formatter table: every FieldId formats, in metric and imperial, including its unavailable rendering
  • Staleness: a value greys once older than its expected update interval, and recovers
  • Page rules: a sourceless page is skipped in the carousel; the last enabled page cannot be skipped away
  • Template geometry: no slot exceeds its bounds on emery, gabbro or basalt - the assertion that makes the deferred round work in #62 safe to do later
  • Descriptor pack/unpack round-trips, and rejects unknown field ids and wrong slot counts (mirrors #61's validation)
  • Runs in CI (#67)

Files

  • watchapp/test/
  • watchapp/test/stubs/

Notes

See D34. Keeping the geometry pure - taking bounds in, giving rects out - is what makes this possible; that constraint is worth honouring in #59 for its own sake.

Update — 2026-09-02: two more things to test on the host

  • Map projection (#42): anchor-relative decimetre offsets to screen pixels — translate, scale,
    rotate — asserted against fixture slices on all three geometries. Pure integer functions, no SDK
  • Stale vs unavailable (#58, D44): a field whose group heartbeat is missed greys; a field sent
    as its type's sentinel renders --; a constant value under changed-keys-only updates does
    neither
  • Per-type sentinel handling, including that zero is never mistaken for unavailable
## Goal Test the C. Every test issue in the plan targets the JVM companion - the watchapp, which is the half written in C, has none. The field store, the formatter table, the staleness rule, the template geometry and the descriptor packing are all pure functions over plain data. Compiled for the host with a small harness they test without an emulator, a watch or a phone. ## Acceptance criteria - [ ] Host build of the testable watchapp sources, with the Pebble SDK surface stubbed where touched - [ ] Small assertion harness - no framework dependency; this is a few hundred lines of C - [ ] Field store: set, read, absent-renders-`--`, zero-is-not-absent - [ ] Formatter table: every `FieldId` formats, in metric and imperial, including its unavailable rendering - [ ] Staleness: a value greys once older than its expected update interval, and recovers - [ ] Page rules: a sourceless page is skipped in the carousel; the last enabled page cannot be skipped away - [ ] **Template geometry: no slot exceeds its bounds on `emery`, `gabbro` or `basalt`** - the assertion that makes the deferred round work in #62 safe to do later - [ ] Descriptor pack/unpack round-trips, and rejects unknown field ids and wrong slot counts (mirrors #61's validation) - [ ] Runs in CI (#67) ## Files - `watchapp/test/` - `watchapp/test/stubs/` ## Notes See D34. Keeping the geometry pure - taking bounds in, giving rects out - is what makes this possible; that constraint is worth honouring in #59 for its own sake. ## Update — 2026-09-02: two more things to test on the host - [ ] **Map projection** (#42): anchor-relative decimetre offsets to screen pixels — translate, scale, rotate — asserted against fixture slices on all three geometries. Pure integer functions, no SDK - [ ] **Stale vs unavailable** (#58, D44): a field whose group heartbeat is missed greys; a field sent as its type's sentinel renders `--`; a constant value under changed-keys-only updates does **neither** - [ ] Per-type sentinel handling, including that zero is never mistaken for unavailable
Sign in to join this conversation.
No description provided.