mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Have read_u8 honor the limit.
This commit is contained in:
1 parent
7a3ddbc025
commit
0088c7e257
4 files changed
+120
-44
No files matched your search
+12
-2
@@ -242,6 +242,7 @@ cleanup0:;
|
||||
|
||||
void test_gif_decode_input_is_a_xxx(const char* filename,
|
||||
const char* palette_filename,
|
||||
const char* indexes_filename,
|
||||
puffs_gif_status want) {
|
||||
puffs_base_buf1 dst = {.ptr = global_got_buffer, .len = BUFFER_SIZE};
|
||||
puffs_base_buf1 src = {.ptr = global_src_buffer, .len = BUFFER_SIZE};
|
||||
@@ -285,6 +286,14 @@ void test_gif_decode_input_is_a_xxx(const char* filename,
|
||||
goto cleanup1;
|
||||
}
|
||||
|
||||
puffs_base_buf1 ind_want = {.ptr = global_want_buffer, .len = BUFFER_SIZE};
|
||||
if (!read_file(&ind_want, indexes_filename)) {
|
||||
goto cleanup1;
|
||||
}
|
||||
if (!buf1s_equal("indexes ", &dst, &ind_want)) {
|
||||
goto cleanup1;
|
||||
}
|
||||
|
||||
cleanup1:
|
||||
puffs_gif_decoder_destructor(&dec);
|
||||
cleanup0:;
|
||||
@@ -294,13 +303,14 @@ void test_gif_decode_input_is_a_gif() {
|
||||
test_funcname = __func__;
|
||||
test_gif_decode_input_is_a_xxx("../../testdata/bricks-dither.gif",
|
||||
"../../testdata/bricks-dither.palette",
|
||||
"../../testdata/bricks-dither.indexes",
|
||||
// TODO: puffs_gif_status_ok);
|
||||
puffs_gif_error_lzw_code_is_out_of_range);
|
||||
puffs_gif_status_short_read);
|
||||
}
|
||||
|
||||
void test_gif_decode_input_is_a_png() {
|
||||
test_funcname = __func__;
|
||||
test_gif_decode_input_is_a_xxx("../../testdata/bricks-dither.png", "",
|
||||
test_gif_decode_input_is_a_xxx("../../testdata/bricks-dither.png", "", "",
|
||||
puffs_gif_error_bad_gif_header);
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ bool buf1s_equal(const char* prefix,
|
||||
puffs_base_buf1* got,
|
||||
puffs_base_buf1* want) {
|
||||
if (!got || !want) {
|
||||
FAIL("%sbufs1_equal: NULL argument", prefix);
|
||||
FAIL("%sbuf1s_equal: NULL argument", prefix);
|
||||
return false;
|
||||
}
|
||||
char* msg = fail_msg;
|
||||
@@ -167,10 +167,10 @@ bool buf1s_equal(const char* prefix,
|
||||
}
|
||||
}
|
||||
if (got->wi != want->wi) {
|
||||
INCR_FAIL(msg, "%sbufs1_equal: wi: got %zu, want %zu.\n", prefix, got->wi,
|
||||
INCR_FAIL(msg, "%sbuf1s_equal: wi: got %zu, want %zu.\n", prefix, got->wi,
|
||||
want->wi);
|
||||
} else if (i < got->wi) {
|
||||
INCR_FAIL(msg, "%sbufs1_equal:\n", prefix);
|
||||
INCR_FAIL(msg, "%sbuf1s_equal:\n", prefix);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user