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, Jun 27, 7:33 AM
Unknown Object (File)
Wed, Jun 26, 12:42 AM
Unknown Object (File)
Sat, Jun 22, 5:06 AM
Unknown Object (File)
Sat, Jun 22, 4:59 AM
Unknown Object (File)
Thu, Jun 20, 11:42 PM
Unknown Object (File)
Wed, Jun 19, 4:38 AM
Unknown Object (File)
Tue, Jun 18, 11:31 PM
Unknown Object (File)
May 10 2024, 2:10 PM
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