Skip to content

chore: add coverage reporting, Codecov badge, and improvement suggestions#1101

Draft
Kenix3 with Copilot wants to merge 1 commit into
mainfrom
copilot/estimate-test-coverage-badge
Draft

chore: add coverage reporting, Codecov badge, and improvement suggestions#1101
Kenix3 with Copilot wants to merge 1 commit into
mainfrom
copilot/estimate-test-coverage-badge

Conversation

Copilot AI commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds infrastructure to measure and track test code coverage.

Coverage Estimate

The current test suite has ~432 individual test cases across 15 test files, covering:

Area Source files Status
utils/ (StrHash64, StringHelper, Utils, stox, binarytools) ~7 files, ~956 lines ✅ Well tested
events/EventSystem 1 file ✅ Well tested
audio/SoundMatrixDecoder 1 file, 284 lines ✅ Well tested
resource/archive/Archive partial ✅ Partially tested
resource/ types, loaders, factories partial ✅ Partially tested
utils/glob, path helpers partial ✅ Partially tested
Fast3D interpreter + backends ~12,000 lines ❌ No tests
Controller / input mappings ~2,000 lines ❌ No tests
GUI / Window code ~3,000 lines ❌ No tests
Context, Config, ConsoleVariable ~1,200 lines ❌ No tests
Audio players, bridge functions ~1,500 lines ❌ No tests

Estimated current coverage: ~5–10% of the ~30,200 source lines (147 .cpp files).


Changes

  • .github/workflows/coverage.yml — new CI job that:

    1. Builds the test suite with -DCMAKE_CXX_FLAGS="--coverage" (gcov instrumentation via GCC)
    2. Runs ctest with dummy SDL drivers (same as test-validation)
    3. Generates an XML coverage report scoped to src/ via gcovr
    4. Uploads the report to Codecov using codecov/codecov-action@v5

    Note: A CODECOV_TOKEN repository secret must be added in GitHub → Settings → Secrets for the upload to succeed. Public repos may work without a token.

  • codecov.yml — Codecov configuration that excludes tests/, build*/, cmake/, and tools/ from coverage metrics.

  • README.md — Adds a live Codecov badge at the top of the file.


Suggestions to increase coverage

The following areas would give the biggest bang for the buck:

  1. Config / ConsoleVariable — Both are pure data classes with no SDL/GPU dependency. Test construction, Get/Set/Erase/Save/Load round-trips, and JSON serialization with a temporary file. These alone represent ~640 lines of testable logic.

  2. Component / Part / PartList / ComponentList — The component graph (BFS traversal, Add/Remove, OnAdded/OnRemoved hooks) is already exercised in integration but has no dedicated unit tests. A thin fixture with concrete subclasses would cover hundreds of lines.

  3. ResourceManager with a mock archive — Construct a ResourceManager backed by the existing in-memory TestArchive from archive_self_tests.cpp, then test LoadResource, GetCachedResource, and UnloadResource. This would cover ResourceManager.cpp, ResourceLoader.cpp, and the factory dispatch logic.

  4. EventSystem edge cases — Already tested, but ListenerPriority ordering, re-entrant dispatch, and RemoveAllListeners with active iterators are missing.

  5. BinaryReader / BinaryWriter endian round-trips — Add parametric tests for all primitive types across both Endianness::Big and Endianness::Little to close remaining uncovered branches.

  6. StrHash64 (CRC64) length-aware interfaceCRC64(data, len) overload is only lightly exercised; add tests for binary blobs containing embedded NUL bytes.

  7. Resource factories (BlobFactory, JsonFactory, ShaderFactory) — These can be exercised without a running context by constructing an InitData struct and calling ReadResource on known binary fixtures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants