From 0db900952c2aa76db801c9198923ce1b3d7c017d Mon Sep 17 00:00:00 2001 From: Wei Li Date: Tue, 9 Feb 2016 11:38:47 -0800 Subject: Add unit tests for ascii85 and hex decoders. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1666663004 . --- testing/test_support.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'testing/test_support.h') diff --git a/testing/test_support.h b/testing/test_support.h index f59d5440e7..3c7ffe5687 100644 --- a/testing/test_support.h +++ b/testing/test_support.h @@ -18,6 +18,35 @@ namespace pdfium { +#define STR_TEST_CASE(input_literal, expected_literal) \ + { \ + (const unsigned char*) input_literal, sizeof(input_literal) - 1, \ + (const unsigned char*)expected_literal, sizeof(expected_literal) - 1 \ + } + +#define DECODE_TEST_CASE(input_literal, expected_literal, processed_size) \ + { \ + (const unsigned char*) input_literal, sizeof(input_literal) - 1, \ + (const unsigned char*)expected_literal, sizeof(expected_literal) - 1, \ + processed_size \ + } + +struct StrFuncTestData { + const unsigned char* input; + unsigned int input_size; + const unsigned char* expected; + unsigned int expected_size; +}; + +struct DecodeTestData { + const unsigned char* input; + unsigned int input_size; + const unsigned char* expected; + unsigned int expected_size; + // The size of input string being processed. + unsigned int processed_size; +}; + // Used with std::unique_ptr to free() objects that can't be deleted. struct FreeDeleter { inline void operator()(void* ptr) const { free(ptr); } -- cgit v1.2.3