diff options
Diffstat (limited to 'Utilities/KWIML/test')
-rw-r--r-- | Utilities/KWIML/test/CMakeLists.txt | 48 | ||||
-rw-r--r-- | Utilities/KWIML/test/test.c | 32 | ||||
-rw-r--r-- | Utilities/KWIML/test/test.cxx | 16 | ||||
-rw-r--r-- | Utilities/KWIML/test/test.h | 31 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_ABI_C.c | 22 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_ABI_CXX.cxx | 22 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_ABI_endian.h.in | 47 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_INT_C.c | 22 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_INT_CXX.cxx | 22 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_abi_C.c | 19 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_abi_CXX.cxx | 19 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_abi_endian.h | 41 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_include_C.c | 20 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_include_CXX.cxx | 20 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_int_C.c | 19 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_int_CXX.cxx | 19 | ||||
-rw-r--r-- | Utilities/KWIML/test/test_int_format.h (renamed from Utilities/KWIML/test/test_INT_format.h.in) | 83 |
17 files changed, 213 insertions, 289 deletions
diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt index a16b5cd..4f6f37b 100644 --- a/Utilities/KWIML/test/CMakeLists.txt +++ b/Utilities/KWIML/test/CMakeLists.txt @@ -1,22 +1,11 @@ -#============================================================================= -# Kitware Information Macro Library -# Copyright 2010-2011 Kitware, Inc. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# Copyright Kitware, Inc. +# Distributed under the OSI-approved BSD 3-Clause License. +# See accompanying file Copyright.txt for details. # -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= - -set(test_defs KWIML_NAMESPACE=${KWIML}) - -# Tell CMake how to follow dependencies of sources in this directory. -set_property(DIRECTORY - PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM - "KWIML_HEADER(%)=<${KWIML}/%>" - ) +if(NOT KWIML_TEST_PREFIX) + set(KWIML_TEST_PREFIX kwiml) +endif() # Suppress printf/scanf format warnings; we test if the sizes match. foreach(lang C CXX) @@ -33,38 +22,33 @@ endif() if(KWIML_LANGUAGE_C) list(APPEND test_defs KWIML_LANGUAGE_C) list(APPEND test_srcs - test_ABI_C.c - test_INT_C.c + test_abi_C.c + test_int_C.c test_include_C.c ) endif() if(KWIML_LANGUAGE_CXX) list(APPEND test_defs KWIML_LANGUAGE_CXX) list(APPEND test_srcs - test_ABI_CXX.cxx - test_INT_CXX.cxx + test_abi_CXX.cxx + test_int_CXX.cxx test_include_CXX.cxx ) endif() -foreach(th test_ABI_endian test_INT_format) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${th}.h.in - ${CMAKE_CURRENT_BINARY_DIR}/${th}.h @ONLY) -endforeach() -include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -add_executable(${KWIML}_test ${test_srcs}) -set_property(TARGET ${KWIML}_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) -set_property(TARGET ${KWIML}_test PROPERTY +add_executable(kwiml_test ${test_srcs}) +set_property(TARGET kwiml_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) +set_property(TARGET kwiml_test PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -add_test(${KWIML}.test ${CMAKE_CURRENT_BINARY_DIR}/${KWIML}_test) -set_property(TEST ${KWIML}.test PROPERTY LABELS ${KWIML_LABELS_TEST}) +add_test(NAME ${KWIML_TEST_PREFIX}.test COMMAND kwiml_test) +set_property(TEST ${KWIML_TEST_PREFIX}.test PROPERTY LABELS ${KWIML_TEST_LABELS}) # Xcode 2.x forgets to create the output directory before linking # the individual architectures. if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") add_custom_command( - TARGET ${KWIML}_test + TARGET kwiml_test PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" ) endif() diff --git a/Utilities/KWIML/test/test.c b/Utilities/KWIML/test/test.c index 131c81f..5f5b5d7 100644 --- a/Utilities/KWIML/test/test.c +++ b/Utilities/KWIML/test/test.c @@ -1,21 +1,15 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #ifdef __cplusplus extern "C" { #endif -extern int test_ABI_C(void); -extern int test_INT_C(void); -extern int test_ABI_CXX(void); -extern int test_INT_CXX(void); +extern int test_abi_C(void); +extern int test_int_C(void); +extern int test_abi_CXX(void); +extern int test_int_CXX(void); extern int test_include_C(void); extern int test_include_CXX(void); #ifdef __cplusplus @@ -26,13 +20,13 @@ int main(void) { int result = 1; #ifdef KWIML_LANGUAGE_C - result = test_ABI_C() && result; - result = test_INT_C() && result; + result = test_abi_C() && result; + result = test_int_C() && result; result = test_include_C() && result; #endif #ifdef KWIML_LANGUAGE_CXX - result = test_ABI_CXX() && result; - result = test_INT_CXX() && result; + result = test_abi_CXX() && result; + result = test_int_CXX() && result; result = test_include_CXX() && result; #endif return result? 0 : 1; diff --git a/Utilities/KWIML/test/test.cxx b/Utilities/KWIML/test/test.cxx index bf61421..464325b 100644 --- a/Utilities/KWIML/test/test.cxx +++ b/Utilities/KWIML/test/test.cxx @@ -1,12 +1,6 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include "test.c" diff --git a/Utilities/KWIML/test/test.h b/Utilities/KWIML/test/test.h index b87a0e7..44add3f 100644 --- a/Utilities/KWIML/test/test.h +++ b/Utilities/KWIML/test/test.h @@ -1,31 +1,10 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef KWIML_NAMESPACE -# error "Do not include test.h outside of KWIML test files." -#endif - -#ifndef KWIML_TEST_H -#define KWIML_TEST_H - /* - Define KWIML_HEADER macro to help the test files include kwiml - headers from the configured namespace directory. The macro can be - used like this: - - #include KWIML_HEADER(ABI.h) + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. */ -#define KWIML_HEADER(x) KWIML_HEADER0(KWIML_NAMESPACE/x) -#define KWIML_HEADER0(x) KWIML_HEADER1(x) -#define KWIML_HEADER1(x) <x> +#ifndef KWIML_TEST_H +#define KWIML_TEST_H /* Quiet MS standard library deprecation warnings. */ #ifndef _CRT_SECURE_NO_DEPRECATE diff --git a/Utilities/KWIML/test/test_ABI_C.c b/Utilities/KWIML/test/test_ABI_C.c deleted file mode 100644 index 3ca4ad3..0000000 --- a/Utilities/KWIML/test/test_ABI_C.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include "test_ABI_endian.h" -int test_ABI_C(void) -{ - if(!test_ABI_endian()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_ABI_CXX.cxx b/Utilities/KWIML/test/test_ABI_CXX.cxx deleted file mode 100644 index 7ede20e..0000000 --- a/Utilities/KWIML/test/test_ABI_CXX.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include "test_ABI_endian.h" -extern "C" int test_ABI_CXX(void) -{ - if(!test_ABI_endian()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_ABI_endian.h.in b/Utilities/KWIML/test/test_ABI_endian.h.in deleted file mode 100644 index 992baea..0000000 --- a/Utilities/KWIML/test/test_ABI_endian.h.in +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include <stdio.h> - -#ifdef __cplusplus -# define LANG "C++ " -#else -# define LANG "C " -#endif - -static int test_ABI_endian(void) -{ - int result = 1; - { -#if defined(@KWIML@_ABI_ENDIAN_ID) - int expect; - union { short s; unsigned char c[sizeof(short)]; } x; - x.s = 1; - expect = (x.c[0] == 1 ? - @KWIML@_ABI_ENDIAN_ID_LITTLE : @KWIML@_ABI_ENDIAN_ID_BIG); - printf(LANG "@KWIML@_ABI_ENDIAN_ID: expected [%d], got [%d]", - expect, @KWIML@_ABI_ENDIAN_ID); - if(@KWIML@_ABI_ENDIAN_ID == expect) - { - printf(", PASSED\n"); - } - else - { - printf(", FAILED\n"); - result = 0; - } -#else - printf(LANG "@KWIML@_ABI_ENDIAN_ID: unknown, FAILED\n"); - result = 0; -#endif - } - return result; -} diff --git a/Utilities/KWIML/test/test_INT_C.c b/Utilities/KWIML/test/test_INT_C.c deleted file mode 100644 index 5513a0b..0000000 --- a/Utilities/KWIML/test/test_INT_C.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(INT.h) -#include "test_INT_format.h" -int test_INT_C(void) -{ - if(!test_INT_format()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_INT_CXX.cxx b/Utilities/KWIML/test/test_INT_CXX.cxx deleted file mode 100644 index 9f74e96..0000000 --- a/Utilities/KWIML/test/test_INT_CXX.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(INT.h) -#include "test_INT_format.h" -extern "C" int test_INT_CXX(void) -{ - if(!test_INT_format()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_abi_C.c b/Utilities/KWIML/test/test_abi_C.c new file mode 100644 index 0000000..18b639f --- /dev/null +++ b/Utilities/KWIML/test/test_abi_C.c @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "test_abi_endian.h" +#ifndef KWIML_ABI_VERSION +# error "KWIML_ABI_VERSION not defined!" +#endif +int test_abi_C(void) +{ + if(!test_abi_endian()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_abi_CXX.cxx b/Utilities/KWIML/test/test_abi_CXX.cxx new file mode 100644 index 0000000..e8feb44 --- /dev/null +++ b/Utilities/KWIML/test/test_abi_CXX.cxx @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "test_abi_endian.h" +#ifndef KWIML_ABI_VERSION +# error "KWIML_ABI_VERSION not defined!" +#endif +extern "C" int test_abi_CXX(void) +{ + if(!test_abi_endian()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_abi_endian.h b/Utilities/KWIML/test/test_abi_endian.h new file mode 100644 index 0000000..334b018 --- /dev/null +++ b/Utilities/KWIML/test/test_abi_endian.h @@ -0,0 +1,41 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include <stdio.h> + +#ifdef __cplusplus +# define LANG "C++ " +#else +# define LANG "C " +#endif + +static int test_abi_endian(void) +{ + int result = 1; + { +#if defined(KWIML_ABI_ENDIAN_ID) + int expect; + union { short s; unsigned char c[sizeof(short)]; } x; + x.s = 1; + expect = (x.c[0] == 1 ? + KWIML_ABI_ENDIAN_ID_LITTLE : KWIML_ABI_ENDIAN_ID_BIG); + printf(LANG "KWIML_ABI_ENDIAN_ID: expected [%d], got [%d]", + expect, KWIML_ABI_ENDIAN_ID); + if(KWIML_ABI_ENDIAN_ID == expect) + { + printf(", PASSED\n"); + } + else + { + printf(", FAILED\n"); + result = 0; + } +#else + printf(LANG "KWIML_ABI_ENDIAN_ID: unknown, FAILED\n"); + result = 0; +#endif + } + return result; +} diff --git a/Utilities/KWIML/test/test_include_C.c b/Utilities/KWIML/test/test_include_C.c index fb3e4cf..518544d 100644 --- a/Utilities/KWIML/test/test_include_C.c +++ b/Utilities/KWIML/test/test_include_C.c @@ -1,20 +1,14 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include <stdio.h> /* Test KWIML header inclusion after above system headers. */ #include "test.h" -#include KWIML_HEADER(ABI.h) -#include KWIML_HEADER(INT.h) +#include "../include/kwiml/abi.h" +#include "../include/kwiml/int.h" int test_include_C(void) { diff --git a/Utilities/KWIML/test/test_include_CXX.cxx b/Utilities/KWIML/test/test_include_CXX.cxx index 111311a..82aa546 100644 --- a/Utilities/KWIML/test/test_include_CXX.cxx +++ b/Utilities/KWIML/test/test_include_CXX.cxx @@ -1,14 +1,8 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include <string> #if defined(_MSC_VER) && defined(NDEBUG) @@ -19,8 +13,8 @@ std::string test_include_CXX_use_stl_string; /* Test KWIML header inclusion after above system headers. */ #include "test.h" -#include KWIML_HEADER(ABI.h) -#include KWIML_HEADER(INT.h) +#include "../include/kwiml/abi.h" +#include "../include/kwiml/int.h" extern "C" int test_include_CXX(void) { diff --git a/Utilities/KWIML/test/test_int_C.c b/Utilities/KWIML/test/test_int_C.c new file mode 100644 index 0000000..fe8ee8e --- /dev/null +++ b/Utilities/KWIML/test/test_int_C.c @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/int.h" +#include "test_int_format.h" +#ifndef KWIML_INT_VERSION +# error "KWIML_INT_VERSION not defined!" +#endif +int test_int_C(void) +{ + if(!test_int_format()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_int_CXX.cxx b/Utilities/KWIML/test/test_int_CXX.cxx new file mode 100644 index 0000000..ffa4c9b --- /dev/null +++ b/Utilities/KWIML/test/test_int_CXX.cxx @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/int.h" +#include "test_int_format.h" +#ifndef KWIML_INT_VERSION +# error "KWIML_INT_VERSION not defined!" +#endif +extern "C" int test_int_CXX(void) +{ + if(!test_int_format()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_INT_format.h.in b/Utilities/KWIML/test/test_int_format.h index 71b443d..24dcdfb 100644 --- a/Utilities/KWIML/test/test_INT_format.h.in +++ b/Utilities/KWIML/test/test_int_format.h @@ -1,17 +1,16 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include <stdio.h> #include <string.h> +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + #ifdef __cplusplus # define LANG "C++ " #else @@ -25,8 +24,8 @@ 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); \ + " expression [%" KWIML_INT_PRI##PRI "]," \ + " literal [%" KWIML_INT_PRI##PRI "]", x, y); \ if(x == y) \ { \ printf(", PASSED\n"); \ @@ -42,8 +41,8 @@ { \ T const x = VALUE(T, U); \ char const* str = STR; \ - sprintf(buf, "%" @KWIML@_INT_PRI##PRI, x); \ - printf(LANG "@KWIML@_INT_PRI" #PRI ":" \ + sprintf(buf, "%" KWIML_INT_PRI##PRI, x); \ + printf(LANG "KWIML_INT_PRI" #PRI ":" \ " expected [%s], got [%s]", str, buf); \ if(strcmp(str, buf) == 0) \ { \ @@ -62,13 +61,13 @@ T const x = VALUE(T, U); \ T y; \ char const* str = STR; \ - if(sscanf(str, "%" @KWIML@_INT_SCN##SCN, &y) != 1) \ + if(sscanf(str, "%" KWIML_INT_SCN##SCN, &y) != 1) \ { \ y = 0; \ } \ - printf(LANG "@KWIML@_INT_SCN" #SCN ":" \ - " expected [%" @KWIML@_INT_PRI##PRI "]," \ - " got [%" @KWIML@_INT_PRI##PRI "]", x, y); \ + printf(LANG "KWIML_INT_SCN" #SCN ":" \ + " expected [%" KWIML_INT_PRI##PRI "]," \ + " got [%" KWIML_INT_PRI##PRI "]", x, y); \ if(x == y) \ { \ printf(", PASSED\n"); \ @@ -87,41 +86,41 @@ /* Concatenate T and U now to avoid expanding them. */ #define TEST(FMT, T, U, STR) \ - TEST_(FMT, @KWIML@_INT_##T, @KWIML@_INT_##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) + 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) + 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) + 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) + 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) + TEST_SCN2_(PRI, SCN, KWIML_INT_##T, KWIML_INT_##U, STR) -static int test_INT_format(void) +static int test_int_format(void) { int result = 1; char buf[256]; TEST_PRI(i8, int8_t, uint8_t, "-85") -#if defined(@KWIML@_INT_SCNi8) +#if defined(KWIML_INT_SCNi8) TEST_SCN(i8, int8_t, uint8_t, "-85") #endif TEST_PRI(d8, int8_t, uint8_t, "-85") -#if defined(@KWIML@_INT_SCNd8) +#if defined(KWIML_INT_SCNd8) TEST_SCN(d8, int8_t, uint8_t, "-85") #endif TEST_PRI(o8, uint8_t, uint8_t, "253") -#if defined(@KWIML@_INT_SCNo8) +#if defined(KWIML_INT_SCNo8) TEST_SCN(o8, uint8_t, uint8_t, "253") #endif TEST_PRI(u8, uint8_t, uint8_t, "171") -#if defined(@KWIML@_INT_SCNu8) +#if defined(KWIML_INT_SCNu8) TEST_SCN(u8, uint8_t, uint8_t, "171") #endif TEST_PRI(x8, uint8_t, uint8_t, "ab") TEST_PRI(X8, uint8_t, uint8_t, "AB") -#if defined(@KWIML@_INT_SCNx8) +#if defined(KWIML_INT_SCNx8) TEST_SCN(x8, uint8_t, uint8_t, "ab") TEST_SCN2(X8, x8, uint8_t, uint8_t, "AB") #endif @@ -141,30 +140,30 @@ static int test_INT_format(void) TEST2(X32, x32, uint32_t, uint32_t, "AB000000") TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560") -#if defined(@KWIML@_INT_SCNi64) +#if defined(KWIML_INT_SCNi64) TEST_SCN(i64, int64_t, uint64_t, "-6124895493223874560") #endif TEST_PRI(d64, int64_t, uint64_t, "-6124895493223874560") -#if defined(@KWIML@_INT_SCNd64) +#if defined(KWIML_INT_SCNd64) TEST_SCN(d64, int64_t, uint64_t, "-6124895493223874560") #endif TEST_PRI(o64, uint64_t, uint64_t, "1254000000000000000000") -#if defined(@KWIML@_INT_SCNo64) +#if defined(KWIML_INT_SCNo64) TEST_SCN(o64, uint64_t, uint64_t, "1254000000000000000000") #endif TEST_PRI(u64, uint64_t, uint64_t, "12321848580485677056") -#if defined(@KWIML@_INT_SCNu64) +#if defined(KWIML_INT_SCNu64) TEST_SCN(u64, uint64_t, uint64_t, "12321848580485677056") #endif TEST_PRI(x64, uint64_t, uint64_t, "ab00000000000000") TEST_PRI(X64, uint64_t, uint64_t, "AB00000000000000") -#if defined(@KWIML@_INT_SCNx64) +#if defined(KWIML_INT_SCNx64) TEST_SCN(x64, uint64_t, uint64_t, "ab00000000000000") TEST_SCN2(X64, x64, uint64_t, uint64_t, "AB00000000000000") #endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +#if !defined(KWIML_INT_NO_INTPTR_T) +# if KWIML_ABI_SIZEOF_DATA_PTR == 4 TEST(iPTR, intptr_t, uint32_t, "-1426063360") TEST(dPTR, intptr_t, uint32_t, "-1426063360") # else @@ -173,8 +172,8 @@ static int test_INT_format(void) # endif #endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +#if !defined(KWIML_INT_NO_UINTPTR_T) +# if KWIML_ABI_SIZEOF_DATA_PTR == 4 TEST(oPTR, uintptr_t, uintptr_t, "25300000000") TEST(uPTR, uintptr_t, uintptr_t, "2868903936") TEST(xPTR, uintptr_t, uintptr_t, "ab000000") @@ -198,3 +197,7 @@ static int test_INT_format(void) return result; } + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif |