cleaning comments

This commit is contained in:
2026-05-23 07:24:05 -03:00
parent f615ee0242
commit 8c14340adc
5 changed files with 26 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
/* Stress tests for lib11sht aim to break upper / lower bounds.
/* Stress tests for lib11sht -- aim to break upper / lower bounds.
* Compile: gcc -Wall -Wextra -O2 test_lib11sht.c lib11sht.c -lm -o test_lib11sht
* Run: ./test_lib11sht
* Exit 0 if all tests pass, non-zero on first failure.
@@ -64,7 +64,7 @@ int main(void)
CHECK(errno == 0 && r == 0, "no errno, returns 0 (equal at boundary)");
}
/* Test 4: long input WITH accents UTF-8 multi-byte at offset 250.
/* Test 4: long input WITH accents -- UTF-8 multi-byte at offset 250.
* Should asciify each accent to ASCII, total visible chars < 256. */
{
char a[400] = "", b[400] = "";
@@ -72,15 +72,15 @@ int main(void)
/* Fill with 240 'a' then put "ÃÃÃÃÃÃ" (UTF-8: 0xC3 0x83 each, 12 bytes) */
for(i = 0; i < 240; i++) { a[i] = 'a'; b[i] = 'a'; }
a[240] = b[240] = '\0';
strcat(a, "ÃÃÃÃÃÃ"); /* +12 bytes UTF-8, 6 chars visible asciify to 'AAAAAA' */
strcat(a, "ÃÃÃÃÃÃ"); /* +12 bytes UTF-8, 6 chars visible -> asciify to 'AAAAAA' */
strcat(b, "ÃÃÃÃÃÃ");
printf("Test 4: 240 'a' + 6×à (multi-byte near boundary)\n");
printf("Test 4: 240 'a' + 6x A-tilde (multi-byte near boundary)\n");
errno = 0;
r = sequal(a, b, 0.85);
CHECK(errno == 0 && r == 0, "no errno, returns 0 (equal)");
}
/* Test 5: full-detail call with undersized buffers this is the actual
/* Test 5: full-detail call with undersized buffers -- this is the actual
* realistic break path. Pass 64-byte buffers to sequal_full. */
{
char small1[64], small2[64];
@@ -99,7 +99,7 @@ int main(void)
/* ----- LOWER bound tests ----- */
/* Test 6: NULL inputs should set errno=EINVAL and return 0 */
/* Test 6: NULL inputs -- should set errno=EINVAL and return 0 */
{
printf("Test 6: NULL inputs via sequal_full\n");
errno = 0;
@@ -123,7 +123,7 @@ int main(void)
CHECK(errno == EINVAL && r == 0, "NULL s2: errno=EINVAL, returns 0");
}
/* Test 7: zero-size buffers should set errno=EINVAL */
/* Test 7: zero-size buffers -- should set errno=EINVAL */
{
printf("Test 7: zero-size buffers\n");
errno = 0;
@@ -142,23 +142,23 @@ int main(void)
/* single char equal */
errno = 0;
r = sequal("a", "a", 0.85);
CHECK(r == 0 && errno == 0, "'a' vs 'a' 0 (equal)");
CHECK(r == 0 && errno == 0, "'a' vs 'a' -> 0 (equal)");
/* single char different */
errno = 0;
r = sequal("a", "b", 0.85);
CHECK(r != 0 && errno == 0, "'a' vs 'b' non-zero (different)");
CHECK(r != 0 && errno == 0, "'a' vs 'b' -> non-zero (different)");
/* threshold = 0.0: any non-zero similarity matches 0 even when different */
/* threshold = 0.0: any non-zero similarity matches -> 0 even when different */
r = sequal("hello", "world", 0.0);
CHECK(r == 0, "shold=0.0 makes any non-empty pair 'match'");
/* threshold = 1.0: only exact-after-normalize strict strcmp */
/* threshold = 1.0: only exact-after-normalize -> strict strcmp */
r = sequal("hello", "Hello", 1.0);
CHECK(r == 0, "shold=1.0 + case-only diff still matches (normalized exact)");
r = sequal("hello", "world", 1.0);
CHECK(r != 0, "shold=1.0 + completely different non-zero");
CHECK(r != 0, "shold=1.0 + completely different -> non-zero");
/* whitespace-only strings */
r = sequal(" ", " ", 0.85);