summaryrefslogtreecommitdiff
path: root/testing/test_support.h
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-02-09 11:38:47 -0800
committerWei Li <weili@chromium.org>2016-02-09 11:38:47 -0800
commit0db900952c2aa76db801c9198923ce1b3d7c017d (patch)
tree4ec9636e7785c5b0c5ac67e7f71df90dae1516b8 /testing/test_support.h
parentc74acf4552944c5485b1175c008708d19b57d322 (diff)
downloadpdfium-0db900952c2aa76db801c9198923ce1b3d7c017d.tar.xz
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1666663004 .
Diffstat (limited to 'testing/test_support.h')
-rw-r--r--testing/test_support.h29
1 files changed, 29 insertions, 0 deletions
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); }