Get more Python tests passing (#141)

This commit is contained in:
Justine Tunney 2021-08-16 15:26:31 -07:00
parent 916f19eea1
commit 59e1c245d1
141 changed files with 3536 additions and 1203 deletions

View file

@ -67,6 +67,15 @@ TEST(wcscasecmp, emptyString) {
EXPECT_NE(0, wcscasecmp(L"", L"a"));
}
TEST(strncmp, nullString) {
char *s1 = malloc(0);
char *s2 = malloc(0);
ASSERT_NE(s1, s2);
ASSERT_EQ(0, strncmp(s1, s2, 0));
free(s2);
free(s1);
}
TEST(strncmp, emptyString) {
char *s1 = strcpy(malloc(1), "");
char *s2 = strcpy(malloc(1), "");
@ -537,44 +546,37 @@ BENCH(bench_00_strcmp, bench) {
data = gc(malloc(size));
dupe = gc(malloc(size));
fprintf(stderr, "\n");
EZBENCH2("strcmp [identity]", longstringislong(size, data),
EXPROPRIATE(strcmp(VEIL("r", data), data)));
fprintf(stderr, "\n");
EZBENCH2("strcmp [2 diff]", donothing,
EXPROPRIATE(strcmp(VEIL("r", "hi"), VEIL("r", "there"))));
EZBENCH2("strcmp_pure [2 diff]", donothing,
EXPROPRIATE(strcmp_pure(VEIL("r", "hi"), VEIL("r", "there"))));
fprintf(stderr, "\n");
EZBENCH2("strcmp [2 dupe]", randomize_buf2str_dupe(2, data, dupe),
EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe))));
EZBENCH2("strcmp_pure [2 dupe]", randomize_buf2str_dupe(2, data, dupe),
EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe))));
fprintf(stderr, "\n");
EZBENCH2("strcmp [4 dupe]", randomize_buf2str_dupe(4, data, dupe),
EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe))));
EZBENCH2("strcmp_pure [4 dupe]", randomize_buf2str_dupe(4, data, dupe),
EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe))));
fprintf(stderr, "\n");
EZBENCH2("strcmp [8 dupe]", randomize_buf2str_dupe(8, data, dupe),
EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe))));
EZBENCH2("strcmp_pure [8 dupe]", randomize_buf2str_dupe(8, data, dupe),
EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe))));
fprintf(stderr, "\n");
EZBENCH2("strcmp [short dupe]", randomize_buf2str_dupe(size, data, dupe),
EZBENCH2("strcmp [sdupe]", randomize_buf2str_dupe(size, data, dupe),
EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe))));
EZBENCH2("strcmp_pure [short dupe]", randomize_buf2str_dupe(size, data, dupe),
EZBENCH2("strcmp_pure [sdupe]", randomize_buf2str_dupe(size, data, dupe),
EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe))));
fprintf(stderr, "\n");
EZBENCH2("strcmp [long dupe]", longstringislong_dupe(size, data, dupe),
EZBENCH2("strcmp [ldupe]", longstringislong_dupe(size, data, dupe),
EXPROPRIATE(strcmp(VEIL("r", data), VEIL("r", dupe))));
EZBENCH2("strcmp_pure [long dupe]", longstringislong_dupe(size, data, dupe),
EZBENCH2("strcmp_pure [ldupe]", longstringislong_dupe(size, data, dupe),
EXPROPRIATE(strcmp_pure(VEIL("r", data), VEIL("r", dupe))));
}
@ -586,22 +588,17 @@ BENCH(bench_01_strcasecmp, bench) {
data = gc(malloc(size));
dupe = gc(malloc(size));
fprintf(stderr, "\n");
EZBENCH2("strcasecmp [identity]", longstringislong(size, data),
EXPROPRIATE(strcasecmp(VEIL("r", data), data)));
fprintf(stderr, "\n");
EZBENCH2("strcasecmp [short dupe]", randomize_buf2str_dupe(size, data, dupe),
EZBENCH2("strcasecmp [sdupe]", randomize_buf2str_dupe(size, data, dupe),
EXPROPRIATE(strcasecmp(VEIL("r", data), VEIL("r", dupe))));
EZBENCH2("strcasecmp_pure [short dupe]",
randomize_buf2str_dupe(size, data, dupe),
EZBENCH2("strcasecmp_pure [sdupe]", randomize_buf2str_dupe(size, data, dupe),
EXPROPRIATE(strcasecmp_pure(VEIL("r", data), VEIL("r", dupe))));
fprintf(stderr, "\n");
EZBENCH2("strcasecmp [long dupe]", longstringislong_dupe(size, data, dupe),
EZBENCH2("strcasecmp [ldupe]", longstringislong_dupe(size, data, dupe),
EXPROPRIATE(strcasecmp(VEIL("r", data), VEIL("r", dupe))));
EZBENCH2("strcasecmp_pure [long dupe]",
longstringislong_dupe(size, data, dupe),
EZBENCH2("strcasecmp_pure [ldupe]", longstringislong_dupe(size, data, dupe),
EXPROPRIATE(strcasecmp_pure(VEIL("r", data), VEIL("r", dupe))));
}