test(utility): adopt canonical ReportTestSuite pattern for string_parse foundation test#840
Conversation
…se foundation test Follow-on cleanup for PR #838 (Phase A of #835). The foundation test landed with a homegrown g_total/g_failures bench instead of the ReportTestSuiteHeader / scope-block / ReportTestSuiteResults idiom used by the rest of the Universal regression suite (and applied to the integer/fixpnt parse() tests on PR #839). Refactor mirrors that style: - ReportTestSuiteHeader at entry, ReportTestSuiteResults at exit - Each primitive (scan_prefix / scan_sign / parse_binary/octal/hex / scan_decimal_float) is one scope block: `int start = nrOfFailedTestCases` at the top, per-assertion `if (...) ++nrOfFailedTestCases`, trailing `if (nrOfFailedTestCases - start > 0) std::cout << "FAIL: ..."` diagnostic. - Standard catch footer (ad-hoc / runtime / ...) Static_assert smoke tests at file scope (proving constexpr) are kept verbatim -- they verify a different invariant (compile-time evaluation) that the runtime block can't. Same test matrix, same coverage. Output now reads: string_parse primitives (Phase A of #835) test suite: PASS Relates to #835 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR refactors a string-parsing test file from an ad-hoc iostream-based bench to the project's ChangesTest Harness Refactoring and Coverage Expansion
🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Suggested Labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Coverage Report for CI Build 25962300725Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.007%) to 83.936%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
Summary
Follow-on cleanup for the Phase A foundation that landed via #838. The foundation test (
static/utility/test_string_parse.cpp) used a homegrowng_total/g_failuresbench instead of theReportTestSuiteHeader/ scope-block /ReportTestSuiteResultsidiom that the rest of the regression suite (hundreds of tests instatic/*/api/*) uses. PR #839 applied the same fix to the integer and fixpnt parse() tests; this PR brings the foundation in line.Changes
static/utility/test_string_parse.cpp-- replaces the custom bench with the canonical pattern:ReportTestSuiteHeaderat entry,ReportTestSuiteResultsat exitscan_prefix/scan_sign/parse_binary/parse_octal/parse_hex/scan_decimal_float), each withint start = nrOfFailedTestCases;at the top, per-assertion++nrOfFailedTestCases, trailingif (nrOfFailedTestCases - start > 0) std::cout << "FAIL: <group>\n";diagnostic.The
static_assertsmoke tests at file scope (provingconstexprevaluation) are kept verbatim -- they verify a different invariant (compile-time evaluation) that no runtime block can.Test coverage
Identical to the pre-refactor version:
scan_prefix: 0b/0B/0o/0O/0x/0X, decimal default, leading-0-without-prefix, emptyscan_sign: +/-, no sign, empty, double-signparse_binary/octal/hex: valid, partial-stop-at-invalid, 64-bit boundary, 65/17-digit overflow, empty -> invalidscan_decimal_float: integer-only, fraction-only, signs, exponent variants, malformed (bare dot, trailing garbage, empty exponent), 50-digit fraction, int32 boundary exponents (INT32_MAX, INT32_MIN, INT32_MAX+1)Test results
utility_test_string_parseOutput now reads
string_parse primitives (Phase A of #835) test suite: PASSmatching the rest of the suite.Test plan
Relates to #835
Generated with Claude Code
Summary by CodeRabbit
Release Notes
Tests
Note: No user-facing changes in this release. This update focuses on test quality improvements.