Page MenuHomeFreeBSD

lib/libc/tests/string/strcspn_test.c: extend tests to catch previous bug
ClosedPublic

Authored by fuz on Sep 12 2023, 3:43 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 31, 4:24 PM
Unknown Object (File)
Mon, Oct 21, 3:20 PM
Unknown Object (File)
Oct 13 2024, 11:41 AM
Unknown Object (File)
Sep 23 2024, 7:10 PM
Unknown Object (File)
Sep 23 2024, 2:41 PM
Unknown Object (File)
Sep 9 2024, 10:12 AM
Unknown Object (File)
Sep 9 2024, 10:12 AM
Unknown Object (File)
Sep 5 2024, 8:37 AM
Subscribers
None

Details

Summary

This extends the strcspn() unit tests to catch mistakes in the
implementation that only appear when a mismatch occurs in a certain
position of the string against a certain position of the set, i.e.
the bug fixed in 52d4a4d4e0dedc72bc33082a3f84c2d0fd6f2cbb.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

fuz requested review of this revision.Sep 12 2023, 3:43 AM
fuz created this revision.

Seems good to me, but why the ifdef?

lib/libc/tests/string/strcspn_test.c
151

Why the ifdef?

166

Can't tell if this is >80 characters. Either way, though, I'd be tempted to make this a standard multi-line comment as described in style(9).

185

Need 128? If so don't forget to bump the buffer size

fuz planned changes to this revision.Sep 12 2023, 5:01 AM
fuz added inline comments.
lib/libc/tests/string/strcspn_test.c
151

Tests both for strspn and strcspn are generated from the same file. This test doesn't make sense for strspn as strspn looks for mismatches, not matches. Therefore, it's enabled for strcspn only.

166

Just under 80 characters. I'll make it a multi-line comment for you.

185

Have added 128 for the buffer size. Set size doesn't need to be tested as we already go to the fallback slow-path with 33 character sets.

  • lib/libc/tests/string/strcspn_test.c: respond to imp review
This revision is now accepted and ready to land.Sep 17 2023, 12:17 AM