Update tests for new check library & osx

This commit is contained in:
Nils O. Selåsdal
2025-06-28 00:56:58 +02:00
parent 9d2ed015f3
commit fb8979d695
29 changed files with 449 additions and 27 deletions
+14
View File
@@ -9,6 +9,7 @@
START_TEST (test_read_file_non_existing_file)
{
char *content;
size_t len;
int saved_errno;
@@ -19,9 +20,11 @@ START_TEST (test_read_file_non_existing_file)
fail_if(content != NULL);
fail_if(saved_errno == 0);
}
END_TEST
START_TEST (test_read_file_simple)
{
char *content;
const char *filename = "test_read_file_simple";
size_t len;
@@ -43,9 +46,11 @@ START_TEST (test_read_file_simple)
fail_if(strlen(content) != 5);
fail_if(strcmp("hello", content) != 0);
free(content);
}
END_TEST
START_TEST (test_read_file_greater_than_max)
{
char *content;
const char *filename = "test_read_file_simple";
size_t len;
@@ -66,9 +71,11 @@ START_TEST (test_read_file_greater_than_max)
fail_if(content != NULL);
fail_if(saved_errno != EMSGSIZE, "was %d", saved_errno);
}
END_TEST
START_TEST (test_read_file_boundary)
{
char *content;
const char *filename = "test_read_file_boundary";
size_t len;
@@ -91,9 +98,11 @@ START_TEST (test_read_file_boundary)
fail_if(len != sizeof buf);
fail_if(strcmp("foobar", &content[1022]) != 0);
free(content);
}
END_TEST
START_TEST (test_read_file_devnull)
{
char *content;
size_t len = 123;
@@ -102,9 +111,11 @@ START_TEST (test_read_file_devnull)
fail_if(len != 0);
free(content);
}
END_TEST
START_TEST (test_read_file_too_big)
{
char *content;
const char *filename = "test_read_file_too_big";
size_t len;
@@ -124,9 +135,11 @@ START_TEST (test_read_file_too_big)
fail_if(content != NULL);
unlink(filename);
}
END_TEST
START_TEST (test_read_file_big)
{
char *content;
const char *filename = "test_read_file_big";
char buf[4096 * 16];
@@ -150,6 +163,7 @@ START_TEST (test_read_file_big)
free(content);
unlink(filename);
}
END_TEST
Suite *read_file_suite(void)