mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +01:00
Add PUFFS_MAGIC.
This commit is contained in:
1 parent
a9bb43229a
commit
56bc1d7945
4 files changed
+38
-14
No files matched your search
+19
-14
@@ -12,29 +12,34 @@ done
|
||||
Each edition should print "PASS", amongst other information, and exit(0).
|
||||
*/
|
||||
|
||||
#include "../testlib/testlib.c"
|
||||
|
||||
#include "../../../gen/c/gif.c"
|
||||
#include "../testlib/testlib.c"
|
||||
|
||||
const char* test_filename = "gif/basic.c";
|
||||
|
||||
void test_default_literal_width() {
|
||||
void test_puffs_version_bad() {
|
||||
puffs_gif_lzw_decoder dec;
|
||||
puffs_gif_lzw_decoder_constructor(&dec, PUFFS_VERSION);
|
||||
if (dec.f_literal_width != 0) {
|
||||
FAIL("test_default_literal_width: got %d, want %d", dec.f_literal_width, 0);
|
||||
puffs_gif_lzw_decoder_constructor(&dec, 0); // 0 is not PUFFS_VERSION.
|
||||
if (dec.status != puffs_gif_error_bad_version) {
|
||||
FAIL("test_puffs_version_bad: status: got %d, want %d", dec.status,
|
||||
puffs_gif_error_bad_version);
|
||||
goto cleanup0;
|
||||
}
|
||||
cleanup0:
|
||||
puffs_gif_lzw_decoder_destructor(&dec);
|
||||
}
|
||||
|
||||
void test_puffs_version_bad() {
|
||||
void test_puffs_version_good() {
|
||||
puffs_gif_lzw_decoder dec;
|
||||
puffs_gif_lzw_decoder_constructor(&dec, 0); // 0 is not PUFFS_VERSION.
|
||||
if (dec.status != puffs_gif_error_bad_version) {
|
||||
FAIL("test_puffs_version_bad: got %d, want %d", dec.status,
|
||||
puffs_gif_error_bad_version);
|
||||
puffs_gif_lzw_decoder_constructor(&dec, PUFFS_VERSION);
|
||||
if (dec.magic != PUFFS_MAGIC) {
|
||||
FAIL("test_puffs_version_good: magic: got %u, want %u", dec.magic,
|
||||
PUFFS_MAGIC);
|
||||
goto cleanup0;
|
||||
}
|
||||
if (dec.f_literal_width != 0) {
|
||||
FAIL("test_puffs_version_good: f_literal_width: got %u, want %u",
|
||||
dec.f_literal_width, 0);
|
||||
goto cleanup0;
|
||||
}
|
||||
cleanup0:
|
||||
@@ -43,7 +48,7 @@ cleanup0:
|
||||
|
||||
// The empty comments forces clang-format to place one element per line.
|
||||
test tests[] = {
|
||||
test_default_literal_width, //
|
||||
test_puffs_version_bad, //
|
||||
NULL, //
|
||||
test_puffs_version_bad, //
|
||||
test_puffs_version_good, //
|
||||
NULL, //
|
||||
};
|
||||
Reference in new issue
Block a user