From d8002f1dde94771952b301f4ebe331c52bc71871 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 May 2020 17:56:44 +0200 Subject: video: separate repacking code from zimg and make it independent For whatever purpose. If anything, this makes the zimg wrapper cleaner. The added tests are not particular exhaustive, but nice to have. This also makes the scale_zimg.c test pretty useless, because it only tests repacking (going through the zimg wrapper). In theory, the repack_tests things could also be used on scalers, but I guess it doesn't matter. Some things are added over the previous zimg wrapper code. For example, some fringe formats can now be expanded to 8 bit per component for convenience. --- test/tests.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/tests.h') diff --git a/test/tests.h b/test/tests.h index f4065f596f..8b2eb98174 100644 --- a/test/tests.h +++ b/test/tests.h @@ -43,6 +43,7 @@ extern const struct unittest test_json; extern const struct unittest test_linked_list; extern const struct unittest test_repack_sws; extern const struct unittest test_repack_zimg; +extern const struct unittest test_repack; extern const struct unittest test_paths; #define assert_true(x) assert(x) @@ -54,6 +55,10 @@ extern const struct unittest test_paths; #define assert_float_equal(a, b, tolerance) \ assert_float_equal_impl(__FILE__, __LINE__, (a), (b), (tolerance)) +// Assert that memcmp(a,b,s)==0, or hexdump output on failure. +#define assert_memcmp(a, b, s) \ + assert_memcmp_impl(__FILE__, __LINE__, (a), (b), (s)) + // Require that the files "ref" and "new" are the same. The paths can be // relative to ref_path and out_path respectively. If they're not the same, // the output of "diff" is shown, the err message (if not NULL), and the test @@ -69,6 +74,8 @@ void assert_float_equal_impl(const char *file, int line, void assert_text_files_equal_impl(const char *file, int line, struct test_ctx *ctx, const char *ref, const char *new, const char *err); +void assert_memcmp_impl(const char *file, int line, + const void *a, const void *b, size_t size); // Open a new file in the out_path. Always succeeds. FILE *test_open_out(struct test_ctx *ctx, const char *name); -- cgit v1.2.3