. #34148
pull bitcoinbrisbane wants to merge 2 commits into bitcoin:master from bitcoinbrisbane:bech32-test-improvements changing 2 files +554 −0-
bitcoinbrisbane commented at 0:46 am on December 25, 2025: none.
-
ff0663a56a
doc: add bech32 test improvement plan
Add documentation outlining a plan to improve unit test coverage for the Bech32 encoding implementation based on BIP-173. The plan includes: - Analysis of current test coverage - Proposed new tests for round-trip encoding, HRP boundaries, character set validation, error detection, and edge cases - Test vectors from BIP-173 specification - Implementation phases 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
-
ecea551d14
test: add comprehensive bech32 unit tests based on BIP-173
Add 9 new test cases to improve bech32 encoding test coverage: - bech32_charset_encoding: Verify all 32 valid characters map correctly - bech32_roundtrip_encoding: Test encode/decode round-trip for data 0-40 bytes - bech32_length_limits: Test 90-character limit boundary conditions - bech32_hrp_limits: Test HRP edge cases (min length, boundary ASCII, separator) - bech32_single_error_detection: Verify single-character errors detected - bech32_transposition_detection: Verify adjacent character swaps detected - bech32_multiple_error_detection: Test 2, 3, 4 error detection guarantee - bech32_case_sensitivity: Test uppercase/lowercase/mixed case handling - bech32_checksum_properties: Verify checksum is 6 chars and deterministic These tests cover BIP-173 specification requirements including: - Character set validation - Maximum length enforcement (90 chars) - Error detection guarantees (up to 4 errors) - Case sensitivity rules - Checksum properties 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
-
DrahtBot commented at 0:46 am on December 25, 2025: contributor
LLM spam detection (✨ experimental): SPAM. The body contains only boilerplate contributor guidance and no substantive description, rationale, tests, or implementation details for the proposed change, indicating a placeholder or incomplete submission rather than a real contribution.
♻️ Automatically wiping, closing, and locking for now based on heuristics. Generally, please focus on creating high-quality, original content that demonstrates a clear understanding of the project’s requirements and goals.
-
DrahtBot renamed this:
Bech32 test improvements
.
on Dec 25, 2025 -
DrahtBot closed this on Dec 25, 2025
-
bitcoin locked this on Dec 25, 2025
-
DrahtBot commented at 0:46 am on December 25, 2025: contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34148.
Reviews
See the guideline for information on the review process. A summary of reviews will appear here.
LLM Linter (✨ experimental)
Possible places where comparison-specific test macros should replace generic comparisons:
- src/test/bech32_tests.cpp: BOOST_CHECK(decoded.encoding == bech32::Encoding::BECH32); -> use BOOST_CHECK_EQUAL(decoded.encoding, bech32::Encoding::BECH32)
- src/test/bech32_tests.cpp: BOOST_CHECK(decoded.encoding == encoding); -> use BOOST_CHECK_EQUAL(decoded.encoding, encoding)
- src/test/bech32_tests.cpp: BOOST_CHECK(decoded.data == data); -> use BOOST_CHECK_EQUAL(decoded.data, data) (or a collection-aware comparison helper if available)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_at_limit.encoding == bech32::Encoding::BECH32); -> use BOOST_CHECK_EQUAL(dec_at_limit.encoding, bech32::Encoding::BECH32)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_too_long.encoding == bech32::Encoding::INVALID); -> use BOOST_CHECK_EQUAL(dec_too_long.encoding, bech32::Encoding::INVALID)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_min.encoding == bech32::Encoding::BECH32); -> use BOOST_CHECK_EQUAL(dec_min.encoding, bech32::Encoding::BECH32)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_boundary.encoding == bech32::Encoding::BECH32); -> use BOOST_CHECK_EQUAL(dec_boundary.encoding, bech32::Encoding::BECH32)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_with_one.encoding == bech32::Encoding::BECH32); -> use BOOST_CHECK_EQUAL(dec_with_one.encoding, bech32::Encoding::BECH32)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_empty.encoding == bech32::Encoding::INVALID); -> use BOOST_CHECK_EQUAL(dec_empty.encoding, bech32::Encoding::INVALID)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_valid.encoding == bech32::Encoding::BECH32); -> use BOOST_CHECK_EQUAL(dec_valid.encoding, bech32::Encoding::BECH32)
- src/test/bech32_tests.cpp: BOOST_CHECK_MESSAGE(dec_corrupted.encoding == bech32::Encoding::INVALID, “Single error at position " + std::to_string(pos) + " was not detected”); -> prefer BOOST_CHECK_EQUAL(dec_corrupted.encoding, bech32::Encoding::INVALID) (and if a custom message is needed, use the equality macro plus a separate BOOST_TEST_MESSAGE or adapt to BOOST_TEST equality helpers that support messages)
- src/test/bech32_tests.cpp: BOOST_CHECK_MESSAGE(dec_transposed.encoding == bech32::Encoding::INVALID, “Transposition at position " + std::to_string(pos) + " was not detected”); -> prefer BOOST_CHECK_EQUAL(dec_transposed.encoding, bech32::Encoding::INVALID) (see note about messages above)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec.encoding == bech32::Encoding::INVALID); (multiple blocks in multiple_error_detection) -> use BOOST_CHECK_EQUAL(dec.encoding, bech32::Encoding::INVALID)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_upper.encoding == bech32::Encoding::BECH32); -> use BOOST_CHECK_EQUAL(dec_upper.encoding, bech32::Encoding::BECH32)
- src/test/bech32_tests.cpp: BOOST_CHECK_EQUAL(dec_upper.hrp, “bc”); (already uses BOOST_CHECK_EQUAL — no change)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_lower.encoding == bech32::Encoding::BECH32); -> use BOOST_CHECK_EQUAL(dec_lower.encoding, bech32::Encoding::BECH32)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_mixed.encoding == bech32::Encoding::INVALID); -> use BOOST_CHECK_EQUAL(dec_mixed.encoding, bech32::Encoding::INVALID)
- src/test/bech32_tests.cpp: BOOST_CHECK(dec_mixed_hrp.encoding == bech32::Encoding::INVALID); -> use BOOST_CHECK_EQUAL(dec_mixed_hrp.encoding, bech32::Encoding::INVALID)
- src/test/bech32_tests.cpp: for (char c : encoded) { BOOST_CHECK(c < ‘A’ || c > ‘Z’); } -> consider using BOOST_CHECK_GE/BOOST_CHECK_LE or BOOST_CHECK_MESSAGE with explicit checks, e.g. BOOST_CHECK_MESSAGE(std::none_of(encoded.begin(), encoded.end(), [](char c){ return c >= ‘A’ && c <= ‘Z’; }), “Encoded string contains uppercase letters”) or use BOOST_CHECK_EQUAL on a computed boolean
Note: Many comparisons currently wrapped in BOOST_CHECK/BOOST_CHECK_MESSAGE use ==/!= etc. Replacing these with the comparison-specific macros (BOOST_CHECK_EQUAL, BOOST_CHECK_NE, BOOST_CHECK_LT, BOOST_CHECK_LE, BOOST_CHECK_GT, BOOST_CHECK_GE) yields clearer diagnostics on failure. For container equality, ensure the chosen macro supports the container type (or use collection-aware helpers if available).
2025-12-25
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-07 03:13 UTC
More mirrored repositories can be found on mirror.b10c.me