summaryrefslogtreecommitdiffstats
path: root/Utilities/KWIML/test
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-03-09 20:28:40 (GMT)
committerBrad King <brad.king@kitware.com>2012-03-09 20:28:40 (GMT)
commit289e5e6012053a356d6a7b9a9351c4b4127a50d9 (patch)
tree3c6ded515e76cf3b9de6a69012726579fcf9dcfd /Utilities/KWIML/test
parent285f0db9f4871262360b50c870aef8bdabd853e8 (diff)
parentf94ae0ecdac2fd8e8d68dde7dd16550bdee0493d (diff)
downloadCMake-289e5e6012053a356d6a7b9a9351c4b4127a50d9.zip
CMake-289e5e6012053a356d6a7b9a9351c4b4127a50d9.tar.gz
CMake-289e5e6012053a356d6a7b9a9351c4b4127a50d9.tar.bz2
Merge branch 'upstream-kwiml' into update-KWIML
Diffstat (limited to 'Utilities/KWIML/test')
-rw-r--r--Utilities/KWIML/test/test_INT_format.h.in46
1 files changed, 29 insertions, 17 deletions
diff --git a/Utilities/KWIML/test/test_INT_format.h.in b/Utilities/KWIML/test/test_INT_format.h.in
index 72a62f2..a8ea263 100644
--- a/Utilities/KWIML/test/test_INT_format.h.in
+++ b/Utilities/KWIML/test/test_INT_format.h.in
@@ -18,15 +18,13 @@
# define LANG "C "
#endif
-#define VALUE(T, U) \
- (@KWIML@_INT_##T)((@KWIML@_INT_##U)0xab << \
- ((sizeof(@KWIML@_INT_##T)-1)<<3)) \
+#define VALUE(T, U) (T)((U)0xab << ((sizeof(T)-1)<<3))
-#define TEST_C(C, V, PRI, T, U) \
+#define TEST_C_(C, V, PRI, T, U) \
{ \
- @KWIML@_INT_##T const x = VALUE(T, U); \
- @KWIML@_INT_##T y = @KWIML@_INT_##C(V); \
- printf(LANG "@KWIML@_INT_" #C ":" \
+ T const x = VALUE(T, U); \
+ T y = C(V); \
+ printf(LANG #C ":" \
" expression [%"@KWIML@_INT_PRI##PRI"]," \
" literal [%"@KWIML@_INT_PRI##PRI"]", x, y); \
if(x == y) \
@@ -40,9 +38,9 @@
} \
}
-#define TEST_PRI(PRI, T, U, STR) \
+#define TEST_PRI_(PRI, T, U, STR) \
{ \
- @KWIML@_INT_##T const x = VALUE(T, U); \
+ T const x = VALUE(T, U); \
char const* str = STR; \
sprintf(buf, "%"@KWIML@_INT_PRI##PRI, x); \
printf(LANG "@KWIML@_INT_PRI" #PRI ":" \
@@ -58,11 +56,11 @@
} \
}
-#define TEST_SCN(SCN, T, U, STR) TEST_SCN2(SCN, SCN, T, U, STR)
-#define TEST_SCN2(PRI, SCN, T, U, STR) \
+#define TEST_SCN_(SCN, T, U, STR) TEST_SCN2_(SCN, SCN, T, U, STR)
+#define TEST_SCN2_(PRI, SCN, T, U, STR) \
{ \
- @KWIML@_INT_##T const x = VALUE(T, U); \
- @KWIML@_INT_##T y; \
+ T const x = VALUE(T, U); \
+ T y; \
char const* str = STR; \
if(sscanf(str, "%"@KWIML@_INT_SCN##SCN, &y) != 1) \
{ \
@@ -82,10 +80,24 @@
} \
}
-#define TEST(FMT, T, U, STR) TEST2(FMT, FMT, T, U, STR)
-#define TEST2(PRI, SCN, T, U, STR) \
- TEST_PRI(PRI, T, U, STR) \
- TEST_SCN2(PRI, SCN, T, U, STR)
+#define TEST_(FMT, T, U, STR) TEST2_(FMT, FMT, T, U, STR)
+#define TEST2_(PRI, SCN, T, U, STR) \
+ TEST_PRI_(PRI, T, U, STR) \
+ TEST_SCN2_(PRI, SCN, T, U, STR)
+
+/* Concatenate T and U now to avoid expanding them. */
+#define TEST(FMT, T, U, STR) \
+ TEST_(FMT, @KWIML@_INT_##T, @KWIML@_INT_##U, STR)
+#define TEST2(PRI, SCN, T, U, STR) \
+ TEST2_(PRI, SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR)
+#define TEST_C(C, V, PRI, T, U) \
+ TEST_C_(@KWIML@_INT_##C, V, PRI, @KWIML@_INT_##T, @KWIML@_INT_##U)
+#define TEST_PRI(PRI, T, U, STR) \
+ TEST_PRI_(PRI, @KWIML@_INT_##T, @KWIML@_INT_##U, STR)
+#define TEST_SCN(SCN, T, U, STR) \
+ TEST_SCN_(SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR)
+#define TEST_SCN2(PRI, SCN, T, U, STR) \
+ TEST_SCN2_(PRI, SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR)
static int test_INT_format(void)
{