Skip to content

test: exercise previously uncovered feature paths - #54

Merged
sentomk merged 1 commit into
mainfrom
test/exercise-untested-paths
Aug 3, 2026
Merged

test: exercise previously uncovered feature paths#54
sentomk merged 1 commit into
mainfrom
test/exercise-untested-paths

Conversation

@sentomk

@sentomk sentomk commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Fill the runtime-testable coverage gaps surfaced by a local source-based coverage run: lit_ci edge 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_ci with non-letter characters (tolower_ascii non-letter branch), size-mismatch early return, and against std::string_view / const char* subjects (templated comparison overload).
  • tests_type_pattern.cpp: 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.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

  • Full suite: 216/216 (was 204).
  • Local source-based coverage (Clang, -fprofile-instr-generate -fcoverage-mapping, tests only): lines 42.5% → 43.2%, branches 31.9% → 32.4%; lit.hpp 89.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-time static_assert, tracked separately.
  • eval.hpp invoke_otherwise_typed unreachable 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.

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

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sentomk
sentomk merged commit 95e5706 into main Aug 3, 2026
24 of 25 checks passed
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.

1 participant