tests: add unit and mutation tests for clear_census.h #3660

Manually merged
github merged 1 commit from github-bot/gh-3658 into main 2026-12-01 01:19:24 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-11-30 22:04 UTC · original
Ammmae0x:tests/startup-clear-census → main · +791 −0 · 5 files · 1 commits · merged 2026-12-01 01:17 UTC

Refs #1149

Adds a portable C++17 device-free unit and configure-time header-mutation test suite for x2w_startup::clear_size_class and x2w_startup::ClearCensus (src/startup_stubs/clear_census.h), without altering the header or device code. 5 new files only, +791/−0.

What changed

  • tests/startup_clear_census_check.cpp: 4 cases — size_class_bounds (exact boundaries 0..UINT64_MAX), dedup_and_fields (all 4 ClearKind values, first-seen frame + call counts, one-field-difference distinctness, exact x2w-render clear ... line format), capacity_overflow (128 shapes, overflow counting, no overwrite, repeat increments calls), periodic_vs_forced (empty emits nothing, delta emits only the changed entry, forced emits all, forced does not consume the delta).
  • tests/cmake/startup_clear_census.cmake: per-case + startup_clear_census_all tests, plus 6 WILL_FAIL TRUE mutation controls mirroring era_physical_owns_last_page_control.
  • tests/startup_clear_census_meta_check.py + tests/checks/python-linux/startup_clear_census.txt: Linux contract audit that compiles and runs the real C++ test and every mutated header copy with g++ -std=c++17.
  • docs/experiments/startup-clear-census.md: cases, controls, and check commands.

Tests (Linux)

  • Meta check: PASS: startup clear census: 4 cases, 6/6 mutations killed (g++)
  • tools/run_checks_parallel.py --from-dir tests/checks/python-linux: all 73 checks passed
  • form_coverage_check.py, docs_links_check.py (192 files/745 links), bidi_controls_check.py (2762 files): pass; py_compile ok; diff --check clean; merge-tree exits 0; zero personal paths.

Windows Verification (a77b865676dd67bfa2ef38ecb9c49a299bfd0cac)

  • Toolset: MSVC dev & release presets (startup_clear_census_check + all 6 mutation targets built clean)
  • ctest --preset dev --no-tests=error -R '^startup_clear_census' --output-on-failure: 11/11 passed (0.66 s; 4/4 cases, all, 6/6 mutations killed)
  • ctest --preset release --no-tests=error -R '^startup_clear_census' --output-on-failure: 11/11 passed (0.69 s; 4/4 cases, all, 6/6 mutations killed)
  • Direct binary startup_clear_census_check.exe (dev & release): PASS: startup_clear_census: 4/4 cases passed
  • form_coverage_check.py, docs_links_check.py (193 files, 749 links), bidi_controls_check.py (2765 files): passed

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-11-30 22:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3658) `Ammmae0x:tests/startup-clear-census` → `main` · +791 −0 · 5 files · 1 commits · merged 2026-12-01 01:17 UTC Refs #1149 Adds a portable C++17 device-free unit and configure-time header-mutation test suite for `x2w_startup::clear_size_class` and `x2w_startup::ClearCensus` (`src/startup_stubs/clear_census.h`), without altering the header or device code. 5 new files only, +791/−0. What changed - `tests/startup_clear_census_check.cpp`: 4 cases — `size_class_bounds` (exact boundaries 0..UINT64_MAX), `dedup_and_fields` (all 4 `ClearKind` values, first-seen frame + call counts, one-field-difference distinctness, exact `x2w-render clear ...` line format), `capacity_overflow` (128 shapes, overflow counting, no overwrite, repeat increments calls), `periodic_vs_forced` (empty emits nothing, delta emits only the changed entry, forced emits all, forced does not consume the delta). - `tests/cmake/startup_clear_census.cmake`: per-case + `startup_clear_census_all` tests, plus 6 `WILL_FAIL TRUE` mutation controls mirroring `era_physical_owns_last_page_control`. - `tests/startup_clear_census_meta_check.py` + `tests/checks/python-linux/startup_clear_census.txt`: Linux contract audit that compiles and runs the real C++ test and every mutated header copy with `g++ -std=c++17`. - `docs/experiments/startup-clear-census.md`: cases, controls, and check commands. Tests (Linux) - Meta check: `PASS: startup clear census: 4 cases, 6/6 mutations killed (g++)` - `tools/run_checks_parallel.py --from-dir tests/checks/python-linux`: all 73 checks passed - `form_coverage_check.py`, `docs_links_check.py` (192 files/745 links), `bidi_controls_check.py` (2762 files): pass; py_compile ok; diff --check clean; merge-tree exits 0; zero personal paths. ### Windows Verification (`a77b865676dd67bfa2ef38ecb9c49a299bfd0cac`) - Toolset: MSVC dev & release presets (`startup_clear_census_check` + all 6 mutation targets built clean) - `ctest --preset dev --no-tests=error -R '^startup_clear_census' --output-on-failure`: 11/11 passed (0.66 s; 4/4 cases, `all`, 6/6 mutations killed) - `ctest --preset release --no-tests=error -R '^startup_clear_census' --output-on-failure`: 11/11 passed (0.69 s; 4/4 cases, `all`, 6/6 mutations killed) - Direct binary `startup_clear_census_check.exe` (dev & release): `PASS: startup_clear_census: 4/4 cases passed` - `form_coverage_check.py`, `docs_links_check.py` (193 files, 749 links), `bidi_controls_check.py` (2765 files): passed AI-assisted. <!-- WIN-VERIFY: passed | sha=a77b865676dd67bfa2ef38ecb9c49a299bfd0cac | targets=startup_clear_census_check startup_clear_census_size_class_mut startup_clear_census_dedup_bits_mut startup_clear_census_capacity_no_advance_mut startup_clear_census_overflow_count_mut startup_clear_census_periodic_gate_mut startup_clear_census_entry_delta_mut | ctest=^startup_clear_census | release=true -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 22:10:20 +00:00
github manually merged commit c4c18bd979 into main 2026-12-01 01:19:24 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-01 01:14 UTC · original · approved these changes

Reviewed the clear census fixtures and their CMake controls. ctest --test-dir <build> --no-tests=error -j1 -R '^startup_clear_census_' --output-on-failure passed all 11 cases. All six changed-behavior controls were caught.

**@⁠R0Y00** on GitHub · 2026-12-01 01:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3658#pullrequestreview-6123434737) · **approved these changes** Reviewed the clear census fixtures and their CMake controls. `ctest --test-dir <build> --no-tests=error -j1 -R '^startup_clear_census_' --output-on-failure` passed all 11 cases. All six changed-behavior controls were caught.
This discussion has been locked. Commenting is limited to contributors.
No description provided.