Skip to content

test: cover remaining branches in cbor_structurally_equal#410

Merged
PJK merged 1 commit into
masterfrom
structurally-equal-coverage
Mar 22, 2026
Merged

test: cover remaining branches in cbor_structurally_equal#410
PJK merged 1 commit into
masterfrom
structurally-equal-coverage

Conversation

@PJK

@PJK PJK commented Mar 22, 2026

Copy link
Copy Markdown
Owner

Summary

Adds 6 test cases to test/structurally_equal_test.c to cover the branches in cbor_structurally_equal that were missed in #408, as identified by the codecov report at https://app.codecov.io/gh/PJK/libcbor/commit/dd5676a5971eaff9d8cf1f737c9844db0a5a1e05.

Previously uncovered path New test
Indefinite bytestring loop return false (same chunk count, unequal content) test_bytestring_indefinite_unequal_chunks
Indefinite string loop return false (same chunk count, unequal content) test_string_indefinite_unequal_chunks
Array size mismatch early return test_array_different_size
Map size mismatch early return test_map_different_size
Tag: both tagged items NULL → return true test_tag_both_null_item
Tag: one tagged item NULL, one non-NULL → return false test_tag_one_null_item

No production code changes.

Test plan

  • ctest -R structurally_equal_test passes (42/42)
  • codecov shows no remaining missed lines in cbor_structurally_equal

🤖 Generated with Claude Code

Six new test cases targeting the paths not reached by the original suite:

- Indefinite bytestring/string: same chunk count, different content
  (exercises the return-false path inside the chunk-comparison loop)
- Arrays/maps of different sizes
  (exercises the size-mismatch early-return)
- Tag with both tagged items NULL (returns true)
- Tag with one NULL and one non-NULL tagged item (returns false)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@PJK
PJK merged commit 98cabc1 into master Mar 22, 2026
16 checks passed
@PJK
PJK deleted the structurally-equal-coverage branch March 22, 2026 18:47
@codecov

codecov Bot commented Mar 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.94%. Comparing base (d5222af) to head (afc0f86).
⚠️ Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #410      +/-   ##
==========================================
+ Coverage   99.59%   99.94%   +0.34%     
==========================================
  Files          20       20              
  Lines        1737     1740       +3     
==========================================
+ Hits         1730     1739       +9     
+ Misses          7        1       -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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