Draft
chore: add coverage reporting, Codecov badge, and improvement suggestions#1101
Conversation
Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/4db5f3fc-4a99-4f9e-a4ff-5060af0a356f Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Kenix3
May 12, 2026 03:10
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
utils/(StrHash64, StringHelper, Utils, stox, binarytools)events/EventSystemaudio/SoundMatrixDecoderresource/archive/Archiveresource/types, loaders, factoriesutils/glob, path helpersContext,Config,ConsoleVariableEstimated current coverage: ~5–10% of the ~30,200 source lines (147
.cppfiles).Changes
.github/workflows/coverage.yml— new CI job that:-DCMAKE_CXX_FLAGS="--coverage"(gcov instrumentation via GCC)ctestwith dummy SDL drivers (same as test-validation)src/viagcovrcodecov/codecov-action@v5codecov.yml— Codecov configuration that excludestests/,build*/,cmake/, andtools/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:
Config/ConsoleVariable— Both are pure data classes with no SDL/GPU dependency. Test construction,Get/Set/Erase/Save/Loadround-trips, and JSON serialization with a temporary file. These alone represent ~640 lines of testable logic.Component/Part/PartList/ComponentList— The component graph (BFS traversal,Add/Remove,OnAdded/OnRemovedhooks) is already exercised in integration but has no dedicated unit tests. A thin fixture with concrete subclasses would cover hundreds of lines.ResourceManagerwith a mock archive — Construct aResourceManagerbacked by the existing in-memoryTestArchivefromarchive_self_tests.cpp, then testLoadResource,GetCachedResource, andUnloadResource. This would coverResourceManager.cpp,ResourceLoader.cpp, and the factory dispatch logic.EventSystemedge cases — Already tested, butListenerPriorityordering, re-entrant dispatch, andRemoveAllListenerswith active iterators are missing.BinaryReader/BinaryWriterendian round-trips — Add parametric tests for all primitive types across bothEndianness::BigandEndianness::Littleto close remaining uncovered branches.StrHash64(CRC64) length-aware interface —CRC64(data, len)overload is only lightly exercised; add tests for binary blobs containing embedded NUL bytes.Resource factories (
BlobFactory,JsonFactory,ShaderFactory) — These can be exercised without a running context by constructing anInitDatastruct and callingReadResourceon known binary fixtures.