summaryrefslogtreecommitdiff
path: root/test/cairo-test.h
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-03-16 16:48:18 +0100
committerAndrea Canciani <ranma42@gmail.com>2011-03-17 17:45:57 +0100
commit75fea162d985bea622afa59771fb2d07f5241d1b (patch)
tree5876692cd2ba574481210fae292eaf7f06005028 /test/cairo-test.h
parent4ef32a36ba1e457e8dd6244a6483866d33477aac (diff)
downloadcairo-75fea162d985bea622afa59771fb2d07f5241d1b.tar.gz
test: Cleanup macros
The ARRAY_LENGTH macro is used by many tests, although sometimes it is named ARRAY_SIZE. Define it just once in cairo-test.h and reuse it. In a similar way, MAX() and MIN() are currently defined in some specific tests, while they could be reused.
Diffstat (limited to 'test/cairo-test.h')
-rw-r--r--test/cairo-test.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/cairo-test.h b/test/cairo-test.h
index c7abd3d65..c4f38c559 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -79,6 +79,18 @@ cairo_test_NaN (void)
#endif
}
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef ARRAY_LENGTH
+#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
+#endif
+
#define CAIRO_TEST_OUTPUT_DIR "output"
#define CAIRO_TEST_LOG_SUFFIX ".log"