Skip to content

test(crypto): expand is_uuid_like coverage for nibbles, Max, and non-hex characters - #2644

Merged
jviotti merged 1 commit into
sourcemeta:mainfrom
vtushar06:test-uuid-like-coverage
Jul 23, 2026
Merged

test(crypto): expand is_uuid_like coverage for nibbles, Max, and non-hex characters#2644
jviotti merged 1 commit into
sourcemeta:mainfrom
vtushar06:test-uuid-like-coverage

Conversation

@vtushar06

@vtushar06 vtushar06 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

I added 8 test blocks to is_uuid_like. Core already passes all of them, so this is coverage, not a fix.

What is new:

  • valid_max - the Max UUID (all f), RFC 9562 section 5.10, alongside the existing Nil case.
  • valid_all_version_nibbles and valid_all_variant_nibbles - loops over 0-f at index 14 and index 19, pinning that is_uuid_like treats the version and variant as semantic fields, not syntactic constraints (RFC 9562 sections 4.1 and 4.2).
  • invalid_underscore_separator, invalid_leading_plus, invalid_hex_radix_prefix, invalid_non_ascii_digit - characters that a lenient integer parser tolerates (_, +, 0x, a Unicode decimal digit) but HEXDIG does not. is_uuid_like rejects them through its byte-level hex check, unlike a checker that validates the hex content with an integer parser.
  • invalid_trailing_newline - a complete UUID followed by \n.

How I checked the expected values: I compiled and ran every block against the real is_uuid_like before staging - all 8 pass.

RFC references: RFC 9562 sections 4, 4.1, 4.2, 5.9, 5.10.

Review in cubic

Copilot AI review requested due to automatic review settings July 21, 2026 04:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@augmentcode

augmentcode Bot commented Jul 21, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Expands unit test coverage for sourcemeta::core::is_uuid_like without changing production code.

Changes:

  • Adds a valid_max test for the all-f (“Max”) UUID alongside the existing Nil/zero case.
  • Adds loop-based tests that vary the version (index 14) and variant (index 19) nibbles across 0-f to assert they’re treated as semantic fields, not syntactic constraints.
  • Adds negative tests for characters some integer parsers may accept (_, leading +, 0x prefix, non-ASCII digit) but HEXDIG should not.
  • Adds a negative test for an otherwise-valid UUID with a trailing newline.
  • Includes <string>/<string_view> needed by the new loop tests.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread test/crypto/crypto_uuid_test.cc Outdated

@jviotti jviotti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but formatting and DCO are failing!

Comment thread test/crypto/crypto_uuid_test.cc Outdated
Comment thread test/crypto/crypto_uuid_test.cc Outdated
…hex characters

Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
@vtushar06
vtushar06 force-pushed the test-uuid-like-coverage branch from 4130c5a to f56d474 Compare July 23, 2026 06:20
@vtushar06

Copy link
Copy Markdown
Contributor Author

Hey @jviotti, Pr is ready for another look.

@jviotti
jviotti merged commit 42d0906 into sourcemeta:main Jul 23, 2026
12 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.

3 participants