From e6918187568dbd01842d8d1d2c808ce16a894239 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 13:54:28 +0200 Subject: Adding upstream version 18.2.2. Signed-off-by: Daniel Baumann --- src/boost/libs/predef/test/build.jam | 117 ++++++++++++++ src/boost/libs/predef/test/check_value.cpp | 26 +++ src/boost/libs/predef/test/info_as_c.c | 7 + src/boost/libs/predef/test/info_as_cpp.cpp | 7 + src/boost/libs/predef/test/info_as_objc.m | 7 + src/boost/libs/predef/test/info_as_objcpp.mm | 7 + src/boost/libs/predef/test/macos_endian.c | 21 +++ src/boost/libs/predef/test/macos_vs_bsd.c | 19 +++ src/boost/libs/predef/test/make.cpp | 94 +++++++++++ src/boost/libs/predef/test/platform_windows.cpp | 177 +++++++++++++++++++++ src/boost/libs/predef/test/predef_info.h | 46 ++++++ .../libs/predef/test/test_cmake/CMakeLists.txt | 29 ++++ src/boost/libs/predef/test/test_cmake/main.cpp | 19 +++ src/boost/libs/predef/test/tested_at.cpp | 62 ++++++++ src/boost/libs/predef/test/tested_at_outdated.cpp | 18 +++ src/boost/libs/predef/test/version.cpp | 83 ++++++++++ src/boost/libs/predef/test/workaround.cpp | 62 ++++++++ .../libs/predef/test/workaround_strict_config.cpp | 17 ++ 18 files changed, 818 insertions(+) create mode 100644 src/boost/libs/predef/test/build.jam create mode 100644 src/boost/libs/predef/test/check_value.cpp create mode 100644 src/boost/libs/predef/test/info_as_c.c create mode 100644 src/boost/libs/predef/test/info_as_cpp.cpp create mode 100644 src/boost/libs/predef/test/info_as_objc.m create mode 100644 src/boost/libs/predef/test/info_as_objcpp.mm create mode 100644 src/boost/libs/predef/test/macos_endian.c create mode 100644 src/boost/libs/predef/test/macos_vs_bsd.c create mode 100644 src/boost/libs/predef/test/make.cpp create mode 100644 src/boost/libs/predef/test/platform_windows.cpp create mode 100644 src/boost/libs/predef/test/predef_info.h create mode 100644 src/boost/libs/predef/test/test_cmake/CMakeLists.txt create mode 100644 src/boost/libs/predef/test/test_cmake/main.cpp create mode 100644 src/boost/libs/predef/test/tested_at.cpp create mode 100644 src/boost/libs/predef/test/tested_at_outdated.cpp create mode 100644 src/boost/libs/predef/test/version.cpp create mode 100644 src/boost/libs/predef/test/workaround.cpp create mode 100644 src/boost/libs/predef/test/workaround_strict_config.cpp (limited to 'src/boost/libs/predef/test') diff --git a/src/boost/libs/predef/test/build.jam b/src/boost/libs/predef/test/build.jam new file mode 100644 index 000000000..beebe6e66 --- /dev/null +++ b/src/boost/libs/predef/test/build.jam @@ -0,0 +1,117 @@ +# Copyright Rene Rivera 2011-2019 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import ../tools/check/predef : require check : predef-require predef-check ; +import common ; +import path ; +import regex ; + +# This deals with the unfortunate aspect of a Boost monolithic release +# not having the modular include dirs. This is a kludge that just removes +# the direct dependency to the header if it can't find it. +local PREDEF_H = $(BOOST_PREDEF_INCLUDE)/boost/predef.h ; +if ! [ path.exists $(PREDEF_H) ] +{ + PREDEF_H = ; +} + +project + : requirements + $(BOOST_PREDEF_INCLUDE) + # Add explicit dependency since we don't have header scanner for + # .m and .mm files. + $(PREDEF_H) + ; + +using testing ; + +test-suite predef-info : + [ run info_as_cpp.cpp : : : always_show_run_output ] + [ run info_as_c.c : : : always_show_run_output ] + [ run info_as_objcpp.mm : : : always_show_run_output @objc ] + [ run info_as_objc.m : : : always_show_run_output @objc ] + ; + +rule objc ( props * ) +{ + if ! ( darwin in $(props) ) + { + return no ; + } +} + +test-suite predef : + [ run version.cpp ] + [ run make.cpp ] + [ compile macos_endian.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] + [ compile macos_vs_bsd.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ] + [ run check_value.cpp : : : always_show_run_output + [ predef-check "BOOST_COMP_CLANG > 0.0.0" "BOOST_OS_LINUX == 0" : : -DCHECK_VALUE=true ] ] + [ run workaround.cpp ] + [ compile workaround_strict_config.cpp ] + [ run tested_at.cpp ] + [ compile-fail tested_at_outdated.cpp : always_show_run_output ] + [ compile platform_windows.cpp ] + ; + +local HEADERS = [ path.glob + $(BOOST_PREDEF_INCLUDE)/predef + $(BOOST_PREDEF_INCLUDE)/predef/architecture + $(BOOST_PREDEF_INCLUDE)/predef/architecture/x86 + $(BOOST_PREDEF_INCLUDE)/predef/compiler + $(BOOST_PREDEF_INCLUDE)/predef/hardware + $(BOOST_PREDEF_INCLUDE)/predef/hardware/simd + $(BOOST_PREDEF_INCLUDE)/predef/hardware/simd/arm + $(BOOST_PREDEF_INCLUDE)/predef/hardware/simd/ppc + $(BOOST_PREDEF_INCLUDE)/predef/hardware/simd/x86 + $(BOOST_PREDEF_INCLUDE)/predef/hardware/simd/x86_amd + $(BOOST_PREDEF_INCLUDE)/predef/language + $(BOOST_PREDEF_INCLUDE)/predef/library + $(BOOST_PREDEF_INCLUDE)/predef/library/c + $(BOOST_PREDEF_INCLUDE)/predef/library/std + $(BOOST_PREDEF_INCLUDE)/predef/os + $(BOOST_PREDEF_INCLUDE)/predef/os/bsd + $(BOOST_PREDEF_INCLUDE)/predef/other + $(BOOST_PREDEF_INCLUDE)/predef/platform + : *.h + ] ; +local single_header_cpp ; +for local h in $(HEADERS) +{ + local header_include = [ path.relative $(h) [ path.make $(BOOST_PREDEF_INCLUDE) ] ] ; + local header_cpp = [ regex.replace $(header_include:S=.cpp) "/" "_" ] ; + .HEADER($(header_cpp:B:S=)) = $(header_include) ; + make $(header_cpp) : : @gen_single_header_cpp ; + explicit $(header_cpp) ; + compile $(header_cpp) : on all : $(header_cpp:B:S=) ; + explicit $(header_cpp:B:S=) ; + single_header_cpp += $(header_cpp:B:S=) ; +} + +test-suite predef-headers : $(single_header_cpp) ; + +.file_touch_cmd = [ common.file-touch-command ] ; + +rule gen_single_header_cpp ( target * : source * : properties * ) +{ + HEADER on $(target) = $(.HEADER($(target[1]:B))) ; +} +actions gen_single_header_cpp +{ + $(.file_touch_cmd) @($(<):<=":>=":O=F:E=#include <$(HEADER)>) +} + +# Minimal testing done for predef for CI. Since +# we don't have many we can just do all of them. +alias minimal : predef predef-info ; + +# Full testing target for regular regression tests. +alias full : predef predef-info ; + +# Extra's target. +alias extra : predef-headers ; + +explicit minimal ; +explicit extra ; diff --git a/src/boost/libs/predef/test/check_value.cpp b/src/boost/libs/predef/test/check_value.cpp new file mode 100644 index 000000000..30ae806f5 --- /dev/null +++ b/src/boost/libs/predef/test/check_value.cpp @@ -0,0 +1,26 @@ +/* +Copyright Rene Rivera 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +/* + * Simple program that just prints out the externally + * defined CHECK_VALUE def. It's used to test the check + * program and the related BB support. + */ + +#include +#include +#include + +#ifndef CHECK_VALUE +#define CHECK_VALUE "undefined" +#endif + +int main() +{ + std::cout << "CHECK_VALUE == " << CHECK_VALUE << "\n" ; + return 0; +} diff --git a/src/boost/libs/predef/test/info_as_c.c b/src/boost/libs/predef/test/info_as_c.c new file mode 100644 index 000000000..44f7e8dcd --- /dev/null +++ b/src/boost/libs/predef/test/info_as_c.c @@ -0,0 +1,7 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include "predef_info.h" diff --git a/src/boost/libs/predef/test/info_as_cpp.cpp b/src/boost/libs/predef/test/info_as_cpp.cpp new file mode 100644 index 000000000..44f7e8dcd --- /dev/null +++ b/src/boost/libs/predef/test/info_as_cpp.cpp @@ -0,0 +1,7 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include "predef_info.h" diff --git a/src/boost/libs/predef/test/info_as_objc.m b/src/boost/libs/predef/test/info_as_objc.m new file mode 100644 index 000000000..44f7e8dcd --- /dev/null +++ b/src/boost/libs/predef/test/info_as_objc.m @@ -0,0 +1,7 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include "predef_info.h" diff --git a/src/boost/libs/predef/test/info_as_objcpp.mm b/src/boost/libs/predef/test/info_as_objcpp.mm new file mode 100644 index 000000000..44f7e8dcd --- /dev/null +++ b/src/boost/libs/predef/test/info_as_objcpp.mm @@ -0,0 +1,7 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include "predef_info.h" diff --git a/src/boost/libs/predef/test/macos_endian.c b/src/boost/libs/predef/test/macos_endian.c new file mode 100644 index 000000000..7f29f900f --- /dev/null +++ b/src/boost/libs/predef/test/macos_endian.c @@ -0,0 +1,21 @@ +/* +Copyright Rene Rivera 2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +/* + * OSX can define the BSD symbols if sys/param.h is included + * before detection. This causes the endian detection to misfire + * as both MACOS and BSD are "detected" (currently). This just + * tests that the sys/param.h include can be included before + * endian detection and still have it work correctly. + */ + +#if defined(__APPLE__) +# include +# include +# include +# include +#endif diff --git a/src/boost/libs/predef/test/macos_vs_bsd.c b/src/boost/libs/predef/test/macos_vs_bsd.c new file mode 100644 index 000000000..173b5a42a --- /dev/null +++ b/src/boost/libs/predef/test/macos_vs_bsd.c @@ -0,0 +1,19 @@ +/* +Copyright Rene Rivera 2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +/* + * OSX can masquerade as BSD when sys/param.h is previously included. + * So we test that we only detect OSX in this combination. + */ +#if defined(__APPLE__) +# include +# include +# include +# if !BOOST_OS_MACOS || BOOST_OS_BSD +# error "BOOST_OS_MACOS not detected and/or BOOST_OS_BSD mis-detected." +# endif +#endif diff --git a/src/boost/libs/predef/test/make.cpp b/src/boost/libs/predef/test/make.cpp new file mode 100644 index 000000000..6b8462466 --- /dev/null +++ b/src/boost/libs/predef/test/make.cpp @@ -0,0 +1,94 @@ +/* +Copyright Rene Rivera 2011-2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include +#include +#include +#include +#include +#include + +namespace +{ + struct test_info + { + std::string value; + bool passed; + + test_info(std::string const & v, bool p) : value(v), passed(p) {} + test_info(test_info const & o) : value(o.value), passed(o.passed) {} + }; + + std::vector test_results; +} + +#define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X))) + +void test_BOOST_VERSION_NUMBER() +{ + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRP(0xFFF) == BOOST_VERSION_NUMBER(0xF,0xF,0xF)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRP(0xFFFF) == BOOST_VERSION_NUMBER(0xFF,0xF,0xF)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRPP(0xFFFF) == BOOST_VERSION_NUMBER(0xF,0xF,0xFF)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRR(0xFFFF) == BOOST_VERSION_NUMBER(0xFF,0xFF,0x0)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRRPPPP(0xFFFFFFF) == BOOST_VERSION_NUMBER(0xF,0xFF,0xFFFF)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRRP(0xFFFFF) == BOOST_VERSION_NUMBER(0xFF,0xFF,0xF)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRRPP000(0xFFFFF000) == BOOST_VERSION_NUMBER(0xF,0xFF,0xFF)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRRPP(0xFFFFFF) == BOOST_VERSION_NUMBER(0xFF,0xFF,0xFF)); + + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VR0(980) == BOOST_VERSION_NUMBER(9,8,0)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRP(999) == BOOST_VERSION_NUMBER(9,9,9)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VPPP(9999) == BOOST_VERSION_NUMBER(9,0,999)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRRPP(999999) == BOOST_VERSION_NUMBER(99,99,99)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR(9999) == BOOST_VERSION_NUMBER(99,99,0)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRRP(98765) == BOOST_VERSION_NUMBER(98,76,5)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRPP(9999) == BOOST_VERSION_NUMBER(9,9,99)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRRPP(99999) == BOOST_VERSION_NUMBER(9,99,99)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRPPPP(460002) == BOOST_VERSION_NUMBER(4,6,2)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRPPPP(491000) == BOOST_VERSION_NUMBER(4,9,1000)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRP000(999000) == BOOST_VERSION_NUMBER(9,9,9)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRR000(999000) == BOOST_VERSION_NUMBER(9,99,0)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR00PP00(2199009900u) == BOOST_VERSION_NUMBER(21,99,99)); + /* PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR00PP00(9999009900ull) == BOOST_VERSION_NUMBER(99,99,99)); */ + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR0PP00(999909900) == BOOST_VERSION_NUMBER(99,99,99)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VV00(9900) == BOOST_VERSION_NUMBER(99,00,00)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR0PPPP(999909999) == BOOST_VERSION_NUMBER(99,99,9999)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRR(999) == BOOST_VERSION_NUMBER(9,99,00)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRRPPP(903122) == BOOST_VERSION_NUMBER(9,3,122)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRRPPP(1101002) == BOOST_VERSION_NUMBER(11,1,2)); + + PREDEF_CHECK(BOOST_PREDEF_MAKE_DATE(1971,1,1) == BOOST_VERSION_NUMBER(1,1,1)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(19700101) == BOOST_VERSION_NUMBER(0,1,1)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(19710101) == BOOST_VERSION_NUMBER(1,1,1)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(20691231) == BOOST_VERSION_NUMBER(99,12,31)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMM(197001) == BOOST_VERSION_NUMBER(0,1,1)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMM(197101) == BOOST_VERSION_NUMBER(1,1,1)); + PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMM(206912) == BOOST_VERSION_NUMBER(99,12,1)); +} + +int main() +{ + test_BOOST_VERSION_NUMBER(); + + unsigned fail_count = 0; + std::vector::iterator i = test_results.begin(); + std::vector::iterator e = test_results.end(); + for (; i != e; ++i) + { + std::cout + << (i->passed ? "[passed]" : "[failed]") + << " " << i->value + << std::endl; + fail_count += i->passed ? 0 : 1; + } + std::cout + << std::endl + << "TOTAL: " + << "passed " << (test_results.size()-fail_count) << ", " + << "failed " << (fail_count) << ", " + << "of " << (test_results.size()) + << std::endl; + return fail_count; +} diff --git a/src/boost/libs/predef/test/platform_windows.cpp b/src/boost/libs/predef/test/platform_windows.cpp new file mode 100644 index 000000000..53f3ecc52 --- /dev/null +++ b/src/boost/libs/predef/test/platform_windows.cpp @@ -0,0 +1,177 @@ +/* +Copyright James E. King, III - 2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#include + +// +// This file is used to verify the BOOST_PLAT_WINDOWS_* logic. +// +// To exercise all of the combinations the CI build needs many +// jobs where it defines all the different possible WINAPI_FAMILY +// values on all supported platforms. +// + +// +// UWP is available on Windows SDK 8.0 or later, or on MinGW-w64 major release 3 or later +// +#if (defined(__MINGW64__) && (__MINGW64_VERSION_MAJOR >= 3)) || (BOOST_PLAT_WINDOWS_SDK_VERSION >= 9200) +#if !BOOST_PLAT_WINDOWS_UWP +#error "BOOST_PLAT_WINDOWS_UWP should be available" +#endif +#else +#if BOOST_PLAT_WINDOWS_UWP +#error "BOOST_PLAT_WINDOWS_UWP should not be available" +#endif +#endif + +#if !BOOST_PLAT_WINDOWS_UWP + +// +// If BOOST_PLAT_WINDOWS_UWP is not available, none of the other BOOST_PLAT_WINDOWS_* are either +// except for BOOST_PLAT_WINDOWS_DESKTOP which is available for backwards compatibility. +// + +#if BOOST_OS_WINDOWS && !BOOST_PLAT_WINDOWS_DESKTOP +#error "BOOST_PLAT_WINDOWS_DESKTOP should be available" +#endif +#if BOOST_PLAT_WINDOWS_PHONE +#error "BOOST_PLAT_WINDOWS_PHONE should not be available" +#endif +#if BOOST_PLAT_WINDOWS_RUNTIME /* deprecated */ +#error "BOOST_PLAT_WINDOWS_RUNTIME should not be available" +#endif +#if BOOST_PLAT_WINDOWS_SERVER +#error "BOOST_PLAT_WINDOWS_SERVER should not be available" +#endif +#if BOOST_PLAT_WINDOWS_STORE +#error "BOOST_PLAT_WINDOWS_STORE should not be available" +#endif +#if BOOST_PLAT_WINDOWS_SYSTEM +#error "BOOST_PLAT_WINDOWS_SYSTEM should not be available" +#endif + +#else // !BOOST_PLAT_WINDOWS_UWP + +// +// If BOOST_PLAT_WINDOWS_UWP is available, and the SDK supports a particular family, +// and if WINAPI_FAMILY is set to it, then it and only it should be available. +// + +#if !defined(WINAPI_FAMILY) +#error "windows_uwp.h should have included which should have defined supported families" +#endif + +#if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP +#if !BOOST_PLAT_WINDOWS_DESKTOP +#error "BOOST_PLAT_WINDOWS_DESKTOP should be available" +#endif +#if BOOST_PLAT_WINDOWS_PHONE +#error "BOOST_PLAT_WINDOWS_PHONE should not be available" +#endif +#if BOOST_PLAT_WINDOWS_RUNTIME /* deprecated */ +#error "BOOST_PLAT_WINDOWS_RUNTIME should not be available" +#endif +#if BOOST_PLAT_WINDOWS_SERVER +#error "BOOST_PLAT_WINDOWS_SERVER should not be available" +#endif +#if BOOST_PLAT_WINDOWS_STORE +#error "BOOST_PLAT_WINDOWS_STORE should not be available" +#endif +#if BOOST_PLAT_WINDOWS_SYSTEM +#error "BOOST_PLAT_WINDOWS_SYSTEM should not be available" +#endif +#endif + +#if defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if BOOST_PLAT_WINDOWS_DESKTOP +#error "BOOST_PLAT_WINDOWS_DESKTOP should not be available" +#endif +#if !BOOST_PLAT_WINDOWS_PHONE +#error "BOOST_PLAT_WINDOWS_PHONE should be available" +#endif +#if !BOOST_PLAT_WINDOWS_RUNTIME /* deprecated */ +#error "BOOST_PLAT_WINDOWS_RUNTIME should be available" +#endif +#if BOOST_PLAT_WINDOWS_SERVER +#error "BOOST_PLAT_WINDOWS_SERVER should not be available" +#endif +#if BOOST_PLAT_WINDOWS_STORE +#error "BOOST_PLAT_WINDOWS_STORE should not be available" +#endif +#if BOOST_PLAT_WINDOWS_SYSTEM +#error "BOOST_PLAT_WINDOWS_SYSTEM should not be available" +#endif +#endif + +#if defined(WINAPI_FAMILY_SERVER_APP) && WINAPI_FAMILY == WINAPI_FAMILY_SERVER_APP +#if BOOST_PLAT_WINDOWS_DESKTOP +#error "BOOST_PLAT_WINDOWS_DESKTOP should not be available" +#endif +#if BOOST_PLAT_WINDOWS_PHONE +#error "BOOST_PLAT_WINDOWS_PHONE should not be available" +#endif +#if BOOST_PLAT_WINDOWS_RUNTIME /* deprecated */ +#error "BOOST_PLAT_WINDOWS_RUNTIME should not be available" +#endif +#if !BOOST_PLAT_WINDOWS_SERVER +#error "BOOST_PLAT_WINDOWS_SERVER should be available" +#endif +#if BOOST_PLAT_WINDOWS_STORE +#error "BOOST_PLAT_WINDOWS_STORE should not be available" +#endif +#if BOOST_PLAT_WINDOWS_SYSTEM +#error "BOOST_PLAT_WINDOWS_SYSTEM should not be available" +#endif +#endif + +// Store is WINAPI_FAMILY_APP in MinGW-w64 and in Windows SDK 8.0 +// then in Windows SDK 8.1 it was deprecated in favor of WINAPI_FAMILY_PC_APP + +#if ((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || \ + (defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP)) +#if BOOST_PLAT_WINDOWS_DESKTOP +#error "BOOST_PLAT_WINDOWS_DESKTOP should not be available" +#endif +#if BOOST_PLAT_WINDOWS_PHONE +#error "BOOST_PLAT_WINDOWS_PHONE should not be available" +#endif +#if !BOOST_PLAT_WINDOWS_RUNTIME /* deprecated */ +#error "BOOST_PLAT_WINDOWS_RUNTIME should be available" +#endif +#if BOOST_PLAT_WINDOWS_SERVER +#error "BOOST_PLAT_WINDOWS_SERVER should not be available" +#endif +#if !BOOST_PLAT_WINDOWS_STORE +#error "BOOST_PLAT_WINDOWS_STORE should be available" +#endif +#if BOOST_PLAT_WINDOWS_SYSTEM +#error "BOOST_PLAT_WINDOWS_SYSTEM should not be available" +#endif +#endif + +#if defined(WINAPI_FAMILY_SYSTEM_APP) && WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM_APP +#if BOOST_PLAT_WINDOWS_DESKTOP +#error "BOOST_PLAT_WINDOWS_DESKTOP should not be available" +#endif +#if BOOST_PLAT_WINDOWS_PHONE +#error "BOOST_PLAT_WINDOWS_PHONE should not be available" +#endif +#if BOOST_PLAT_WINDOWS_RUNTIME /* deprecated */ +#error "BOOST_PLAT_WINDOWS_RUNTIME should not be available" +#endif +#if BOOST_PLAT_WINDOWS_SERVER +#error "BOOST_PLAT_WINDOWS_SERVER should not be available" +#endif +#if BOOST_PLAT_WINDOWS_STORE +#error "BOOST_PLAT_WINDOWS_STORE should not be available" +#endif +#if !BOOST_PLAT_WINDOWS_SYSTEM +#error "BOOST_PLAT_WINDOWS_SYSTEM should be available" +#endif +#endif + +#endif // !BOOST_PLAT_WINDOWS_UWP diff --git a/src/boost/libs/predef/test/predef_info.h b/src/boost/libs/predef/test/predef_info.h new file mode 100644 index 000000000..213d94b47 --- /dev/null +++ b/src/boost/libs/predef/test/predef_info.h @@ -0,0 +1,46 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include + +int main() +{ + unsigned x = 0; + create_predef_entries(); + qsort(generated_predef_info,generated_predef_info_count, + sizeof(predef_info),predef_info_compare); + /* + for (x = 0; x < generated_predef_info_count; ++x) + { + printf("%s: %d\n", generated_predef_info[x].name, generated_predef_info[x].value); + } + */ + puts("** Detected **"); + for (x = 0; x < generated_predef_info_count; ++x) + { + if (generated_predef_info[x].value > 0) + printf("%s = %u (%u,%u,%u) | %s\n", + generated_predef_info[x].name, + generated_predef_info[x].value, + (generated_predef_info[x].value/10000000)%100, + (generated_predef_info[x].value/100000)%100, + (generated_predef_info[x].value)%100000, + generated_predef_info[x].description); + } + puts("** Not Detected **"); + for (x = 0; x < generated_predef_info_count; ++x) + { + if (generated_predef_info[x].value == 0) + printf("%s = %u | %s\n", + generated_predef_info[x].name, + generated_predef_info[x].value, + generated_predef_info[x].description); + } + if (generated_predef_info_count > 0) + return 0; + else + return 1; +} diff --git a/src/boost/libs/predef/test/test_cmake/CMakeLists.txt b/src/boost/libs/predef/test/test_cmake/CMakeLists.txt new file mode 100644 index 000000000..9bdbd62d8 --- /dev/null +++ b/src/boost/libs/predef/test/test_cmake/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright Mike Dev 2018 +# Copyright Rene Rivera 2018 +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt + +# NOTE: +# This does NOT run the unit tests for Boost.Predef. +# It only tests, if the CMakeLists.txt file in predef's +# root directory works as expected (i.e. it provides the +# target Boost::predef which in turn provides the +# correct include directory ) + +# We have very simple cmake requirements we we still require the new style +# declarative targets. +cmake_minimum_required( VERSION 3.0 ) + +project( PredefCMakeSelfTest ) + +# Process cmake file at root of library and use +# ${CMAKE_CURRENT_BINARY_DIR}/libs/predef as workspace +add_subdirectory( ../.. ${CMAKE_CURRENT_BINARY_DIR}/libs/predef ) + +# The executable just includes a predef header to verify that it's used. +add_executable( predef_cmake_test_prj main.cpp ) + +# The executable needs to "use" the Predef "library" to get the usage +# requirements added to the executable build. +target_link_libraries( predef_cmake_test_prj Boost::predef ) diff --git a/src/boost/libs/predef/test/test_cmake/main.cpp b/src/boost/libs/predef/test/test_cmake/main.cpp new file mode 100644 index 000000000..c8005bc4a --- /dev/null +++ b/src/boost/libs/predef/test/test_cmake/main.cpp @@ -0,0 +1,19 @@ +/* +Copyright Mike Dev 2018 +Copyright 2018 Rene Rivera +Distributed under the Boost Software License, Version 1.0. +See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt +*/ + +/* +Dummy executable, just to make sure that we can find the Boost Predef header +files. +*/ + +#include + +int main() +{ + return 0; +} diff --git a/src/boost/libs/predef/test/tested_at.cpp b/src/boost/libs/predef/test/tested_at.cpp new file mode 100644 index 000000000..2c4816eb5 --- /dev/null +++ b/src/boost/libs/predef/test/tested_at.cpp @@ -0,0 +1,62 @@ +/* +Copyright Rene Rivera 2011-2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include +#include +#include +#include +#include +#include + +namespace +{ + struct test_info + { + std::string value; + bool passed; + + test_info(std::string const & v, bool p) : value(v), passed(p) {} + test_info(test_info const & o) : value(o.value), passed(o.passed) {} + }; + + std::vector test_results; +} + +#define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X))) + +void test_BOOST_PREDEF_TESTED_AT() +{ + PREDEF_CHECK(BOOST_PREDEF_TESTED_AT(BOOST_VERSION_NUMBER(15,15,15),0xF,0xF,0xF)); + PREDEF_CHECK(BOOST_PREDEF_TESTED_AT(BOOST_VERSION_NUMBER(1,0,0),1,0,0)); + PREDEF_CHECK(BOOST_PREDEF_TESTED_AT(BOOST_VERSION_NUMBER(0,9,0),1,0,0)); + PREDEF_CHECK(BOOST_PREDEF_TESTED_AT(BOOST_VERSION_NUMBER(2,0,0),1,0,0)); + PREDEF_CHECK(!BOOST_PREDEF_TESTED_AT(BOOST_VERSION_NUMBER_NOT_AVAILABLE,1,0,0)); +} + +int main() +{ + test_BOOST_PREDEF_TESTED_AT(); + + unsigned fail_count = 0; + std::vector::iterator i = test_results.begin(); + std::vector::iterator e = test_results.end(); + for (; i != e; ++i) + { + std::cout + << (i->passed ? "[passed]" : "[failed]") + << " " << i->value + << std::endl; + fail_count += i->passed ? 0 : 1; + } + std::cout + << std::endl + << "TOTAL: " + << "passed " << (test_results.size()-fail_count) << ", " + << "failed " << (fail_count) << ", " + << "of " << (test_results.size()) + << std::endl; + return fail_count; +} diff --git a/src/boost/libs/predef/test/tested_at_outdated.cpp b/src/boost/libs/predef/test/tested_at_outdated.cpp new file mode 100644 index 000000000..534ebafe7 --- /dev/null +++ b/src/boost/libs/predef/test/tested_at_outdated.cpp @@ -0,0 +1,18 @@ +/* +Copyright Rene Rivera 2011-2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include +#define BOOST_DETECT_OUTDATED_WORKAROUNDS +#include + +int main() +{ +#if BOOST_PREDEF_TESTED_AT(BOOST_VERSION_NUMBER(2,0,0),1,0,0) + return 1; +#else + return 0; +#endif +} diff --git a/src/boost/libs/predef/test/version.cpp b/src/boost/libs/predef/test/version.cpp new file mode 100644 index 000000000..68e724fb2 --- /dev/null +++ b/src/boost/libs/predef/test/version.cpp @@ -0,0 +1,83 @@ +/* +Copyright Rene Rivera 2011-2012 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include +#include +#include +#include +#include + +namespace +{ + struct test_info + { + std::string value; + bool passed; + + test_info(std::string const & v, bool p) : value(v), passed(p) {} + test_info(test_info const & o) : value(o.value), passed(o.passed) {} + }; + + std::vector test_results; +} + +#define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X))) + +void test_BOOST_VERSION_NUMBER() +{ + PREDEF_CHECK(BOOST_VERSION_NUMBER(0,0,1) == 1L); + PREDEF_CHECK(BOOST_VERSION_NUMBER(99,99,99999) == 999999999L); + PREDEF_CHECK(BOOST_VERSION_NUMBER(299UL,99UL,99999UL) != 2999999999UL); + PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) != 1009999999L); + PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) == 9999999L); + PREDEF_CHECK(BOOST_VERSION_NUMBER(100,100,100000) == 0L); + + PREDEF_CHECK( + BOOST_VERSION_NUMBER_MAJOR(BOOST_VERSION_NUMBER(0,0,0)) == 0); + PREDEF_CHECK( + BOOST_VERSION_NUMBER_MAJOR(BOOST_VERSION_NUMBER(3,3,3)) == 3); + PREDEF_CHECK( + BOOST_VERSION_NUMBER_MAJOR(BOOST_VERSION_NUMBER(99,99,99999)) == 99); + + PREDEF_CHECK( + BOOST_VERSION_NUMBER_MINOR(BOOST_VERSION_NUMBER(0,0,0)) == 0); + PREDEF_CHECK( + BOOST_VERSION_NUMBER_MINOR(BOOST_VERSION_NUMBER(3,3,3)) == 3); + PREDEF_CHECK( + BOOST_VERSION_NUMBER_MINOR(BOOST_VERSION_NUMBER(99,99,99999)) == 99); + + PREDEF_CHECK( + BOOST_VERSION_NUMBER_PATCH(BOOST_VERSION_NUMBER(0,0,0)) == 0); + PREDEF_CHECK( + BOOST_VERSION_NUMBER_PATCH(BOOST_VERSION_NUMBER(3,3,3)) == 3); + PREDEF_CHECK( + BOOST_VERSION_NUMBER_PATCH(BOOST_VERSION_NUMBER(99,99,99999)) == 99999); +} + +int main() +{ + test_BOOST_VERSION_NUMBER(); + + unsigned fail_count = 0; + std::vector::iterator i = test_results.begin(); + std::vector::iterator e = test_results.end(); + for (; i != e; ++i) + { + std::cout + << (i->passed ? "[passed]" : "[failed]") + << " " << i->value + << std::endl; + fail_count += i->passed ? 0 : 1; + } + std::cout + << std::endl + << "TOTAL: " + << "passed " << (test_results.size()-fail_count) << ", " + << "failed " << (fail_count) << ", " + << "of " << (test_results.size()) + << std::endl; + return fail_count; +} diff --git a/src/boost/libs/predef/test/workaround.cpp b/src/boost/libs/predef/test/workaround.cpp new file mode 100644 index 000000000..368daea3a --- /dev/null +++ b/src/boost/libs/predef/test/workaround.cpp @@ -0,0 +1,62 @@ +/* +Copyright Rene Rivera 2011-2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include +#include +#include +#include +#include +#include + +namespace +{ + struct test_info + { + std::string value; + bool passed; + + test_info(std::string const & v, bool p) : value(v), passed(p) {} + test_info(test_info const & o) : value(o.value), passed(o.passed) {} + }; + + std::vector test_results; +} + +#define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X))) + +void test_BOOST_PREDEF_WORKAROUND() +{ + PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(15,15,15),==,0xF,0xF,0xF)); + PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(0,9,0),<,1,0,0)); + PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(0,9,0),!=,1,0,0)); + PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER_MIN,<,1,0,0)); + PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER_MIN,>,0,0,0)); +} + +int main() +{ + test_BOOST_PREDEF_WORKAROUND(); + + unsigned fail_count = 0; + std::vector::iterator i = test_results.begin(); + std::vector::iterator e = test_results.end(); + for (; i != e; ++i) + { + std::cout + << (i->passed ? "[passed]" : "[failed]") + << " " << i->value + << std::endl; + fail_count += i->passed ? 0 : 1; + } + std::cout + << std::endl + << "TOTAL: " + << "passed " << (test_results.size()-fail_count) << ", " + << "failed " << (fail_count) << ", " + << "of " << (test_results.size()) + << std::endl; + return fail_count; +} diff --git a/src/boost/libs/predef/test/workaround_strict_config.cpp b/src/boost/libs/predef/test/workaround_strict_config.cpp new file mode 100644 index 000000000..df7b1764b --- /dev/null +++ b/src/boost/libs/predef/test/workaround_strict_config.cpp @@ -0,0 +1,17 @@ +/* +Copyright Rene Rivera 2011-2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include +#define BOOST_STRICT_CONFIG +#include + +int main() +{ +#if BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER_AVAILABLE,==,0,0,1) + fail(); +#endif + return 0; +} -- cgit v1.2.3