Add user-defined error and status codes.

This commit is contained in:
Nigel Tao committed 2017-06-09 12:26:00 +10:00
1 parent 90e49caf51
commit 3863427127
10 files changed
+282 -42

No files matched your search

+14
View File
@@ -93,6 +93,10 @@ void test_status_is_error() {
FAIL("test_status_is_error: is_error(short_write) returned true");
return;
}
if (!puffs_gif_status_is_error(puffs_gif_error_bad_gif_image)) {
FAIL("test_status_is_error: is_error(bad_gif_image) returned false");
return;
}
}
void test_status_strings() {
@@ -111,6 +115,16 @@ void test_status_strings() {
FAIL("test_status_strings: got \"%s\", want \"gif: short write\"", s2);
return;
}
const char* s3 = puffs_gif_status_string(puffs_gif_error_bad_gif_image);
if (strcmp(s3, "gif: bad GIF image")) {
FAIL("test_status_strings: got \"%s\", want \"gif: bad GIF image\"", s3);
return;
}
const char* s4 = puffs_gif_status_string(-254);
if (strcmp(s4, "gif: unknown status")) {
FAIL("test_status_strings: got \"%s\", want \"gif: unknown status\"", s4);
return;
}
}
// The empty comments forces clang-format to place one element per line.