Improve test coverage to 100% functions / 88% lines; automate Windows coverage via OpenCppCoverage - #5
Open
VipinKum4r wants to merge 11 commits into
Open
Improve test coverage to 100% functions / 88% lines; automate Windows coverage via OpenCppCoverage#5VipinKum4r wants to merge 11 commits into
VipinKum4r wants to merge 11 commits into
Conversation
…d generate coverage in build script
amoldhamale1105
requested changes
Apr 11, 2026
Broke the two giant TEST() blocks into individual TEST/TEST_F cases with proper <func>_test_scenario names. Moved event setup/teardown into fixtures (SetUp/TearDown, SetUpTestSuite for the shared loop) instead of building everything inline in one function. Also added a real assertion that halt happens within its scheduled delay instead of just waiting up to 300ms and hoping, and made the DataEvent test actually check the handler fired. While adding a BLOCK-mode test I hit a real bug: start() would call std::thread(...) on top of a thread that was still joinable from a previous run, since Halt() signals shutdown but never joins. Fixed by joining m_mainLoop/m_scheduler at the top of start() if needed. Cleaned up the coverage-percentage comments in the test file and build.sh since that stuff belongs in the coverage report, not code. Not doing in this PR: the dead-code cleanup in eventLoop() (will be its own PR) or mocking thread-creation failures for the catch blocks (needs a factory seam in EventManager, also separate).
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.
Improve coverage to 100% functions / ~89% lines and automate Windows coverage report
What this PR does
Builds on the test foundation from #4 to push coverage as high as the library's design permits, and adds automated coverage report generation on Windows via OpenCppCoverage.
Coverage results
These are defensive/safety net code paths — their presence is valuable for production robustness even if they cannot be exercised by unit tests.
build.shchangesThe
-tflag (test + coverage) now auto-detects the platform:lcov+genhtmlflow (unchanged)OpenCppCoverage, producing both an HTML report and a Cobertura XML report suitable for CIIf
OpenCppCoverageis not onPATH, the script prints a clear install instruction (winget install OpenCppCoverage) and exits gracefully instead of failing the build..gitignoreupdateAdded
CoverageReport-*/to ignore the timestamped report folders OpenCppCoverage generates in the working directory.