test: exercise previously uncovered feature paths - #54
Merged
Conversation
Problem - Branch coverage sat at 31.9% / line at 42.5%, with several feature paths unused by any test: lit_ci edge cases, alt<I> subpattern paths, the full guard operator set, and the combinator operator-sugar truth table. Implementation - tests_literal_pattern: lit_ci with non-letter characters (tolower_ascii non-letter branch), size mismatch, and against std::string_view / const char* subjects (templated comparison overload). - tests_type_pattern: alt<I>() no-subpattern fast path, alt<I>(sub) subpattern match path, and is<T>(sub) match+bind — covering both branches of type_is/type_alt match()/bind(). - tests_guard: the previously unused arithmetic/comparison guard operators (%, /, <=, >=, and all of != == < > on members). - tests_combinator: a full truth table for the !/||/&& operator sugar (both/one/none-true for || and &&, and ! combined with each). Tests - Full suite: 216/216 (was 204). - Local source-based coverage: lines 42.5% -> 43.2%, branches 31.9% -> 32.4%; lit.hpp 89.5% -> 94.7%. Notes - Two eval.hpp otherwise paths (unreachable_t branch and the Subject& otherwise branch) stay uncovered: they are forward- looking infrastructure with no public-API trigger today (the exhaustiveness-checking work will exercise them). optimize.hpp remains 0% as its dispatch tables are built at compile time and are not credited by runtime coverage; verifying them needs compile-time static_assert checks, not runtime tests.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Fill the runtime-testable coverage gaps surfaced by a local source-based coverage run:
lit_ciedge cases,alt<I>subpattern paths, the full guard operator set, and the combinator operator-sugar truth table. Distributed by feature into the existing test files (no new dump file).Changes
tests_literal_pattern.cpp:lit_ciwith non-letter characters (tolower_ascii non-letter branch), size-mismatch early return, and againststd::string_view/const char*subjects (templated comparison overload).tests_type_pattern.cpp:alt<I>()no-subpattern fast path,alt<I>(sub)subpattern match path, andis<T>(sub)match+bind — covering both branches oftype_is/type_altmatch()/bind().tests_guard.cpp: previously unused arithmetic/comparison guard operators (%,/,<=,>=, and!= == < >on members).tests_combinator.cpp: full truth table for the!/||/&&operator sugar (both/one/none-true for||and&&, and!combined with each).Testing
-fprofile-instr-generate -fcoverage-mapping, tests only): lines 42.5% → 43.2%, branches 31.9% → 32.4%;lit.hpp89.5% → 94.7%.Notes — what stayed uncovered and why
Two categories are intentionally not chased in this PR:
optimize.hpp(139 lines, 0%): dispatch tables are built at compile time and constant-folded, so runtime coverage cannot credit them. Correct verification is compile-timestatic_assert, tracked separately.eval.hppinvoke_otherwise_typedunreachable and Subject& branches: forward-looking infrastructure (no public-API trigger today; the exhaustiveness-checking work will exercise them).So ~43% line / ~32% branch is effectively the practical ceiling for runtime coverage of this compile-time-heavy library until those two tracks land.