Re-organize some test/c/std/gif.c code.
@@ -188,14 +188,6 @@ void test_lzw_decode_xxx(const char* src_filename,
puffs_base_buf1 want = {.ptr = global_want_buffer, .len = BUFFER_SIZE};
puffs_base_buf1 src = {.ptr = global_src_buffer, .len = BUFFER_SIZE};
- if (!read_file(&want, want_filename)) {
- goto cleanup0;
- }
- if (want.wi != want_size) {
- FAIL("want size: got %d, want %d", (int)(want.wi), (int)(want_size));
- goto cleanup0;
- }
-
if (!read_file(&src, src_filename)) {
goto cleanup0;
}
@@ -211,6 +203,14 @@ void test_lzw_decode_xxx(const char* src_filename,
}
src.ri++;
+ if (!read_file(&want, want_filename)) {
+ goto cleanup0;
+ }
+ if (want.wi != want_size) {
+ FAIL("want size: got %d, want %d", (int)(want.wi), (int)(want_size));
+ goto cleanup0;
+ }
+
puffs_gif_lzw_decoder dec;
puffs_gif_lzw_decoder_constructor(&dec, PUFFS_VERSION, 0);
puffs_gif_lzw_decoder_set_literal_width(&dec, literal_width);
@@ -349,7 +349,7 @@ void bench_lzw_decode_100k() {
// ---------------- GIF Tests
-void test_gif_decode_input_is_a_xxx(const char* filename,
+void test_gif_decode_xxx(const char* filename,
const char* palette_filename,
const char* indexes_filename,
puffs_gif_status want) {
@@ -410,7 +410,7 @@ cleanup0:;
void test_gif_decode_input_is_a_gif() {
proc_funcname = __func__;
- test_gif_decode_input_is_a_xxx("../../testdata/bricks-dither.gif",
+ test_gif_decode_xxx("../../testdata/bricks-dither.gif",
"../../testdata/bricks-dither.palette",
"../../testdata/bricks-dither.indexes",
puffs_gif_status_ok);
@@ -418,7 +418,7 @@ void test_gif_decode_input_is_a_gif() {
void test_gif_decode_input_is_a_png() {
proc_funcname = __func__;
- test_gif_decode_input_is_a_xxx("../../testdata/bricks-dither.png", "", "",
+ test_gif_decode_xxx("../../testdata/bricks-dither.png", "", "",
puffs_gif_error_bad_gif_header);
}
