]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/vmd/test/test_is_empty.cxx
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / boost / libs / vmd / test / test_is_empty.cxx
1
2 // (C) Copyright Edward Diener 2011-2015,2019
3 // Use, modification and distribution are subject to the Boost Software License,
4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt).
6
7 #include <boost/vmd/is_empty.hpp>
8 #include <boost/preprocessor/facilities/empty.hpp>
9 #include <boost/preprocessor/variadic/has_opt.hpp>
10 #include <boost/detail/lightweight_test.hpp>
11
12 int main()
13 {
14
15 #if BOOST_PP_VARIADICS
16
17 #define DATA
18 #define OBJECT OBJECT2
19 #define OBJECT2
20 #define FUNC(x) FUNC2(x)
21 #define FUNC2(x)
22
23 BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_PP_EMPTY()));
24 BOOST_TEST(BOOST_VMD_IS_EMPTY(DATA BOOST_PP_EMPTY()));
25 BOOST_TEST(!BOOST_VMD_IS_EMPTY(x BOOST_PP_EMPTY()));
26 BOOST_TEST(BOOST_VMD_IS_EMPTY(OBJECT BOOST_PP_EMPTY()));
27 BOOST_TEST(BOOST_VMD_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()));
28
29 #define FUNC_GEN() ()
30 #define FUNC_GEN2(x) ()
31 #define FUNC_GEN3() anything
32 #define FUNC_GEN4(x) anything
33
34 #if BOOST_PP_VARIADIC_HAS_OPT()
35
36 #define FUNC_GEN5(x,y) ()
37 #define FUNC_GEN6(x,y) anything
38 #define FUNC_GEN7() (y,z)
39 #define FUNC_GEN5A() (&)
40 #define FUNC_GEN6A(x) (y)
41 #define FUNC_GEN7A() (y,z)
42
43 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN));
44 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN2));
45
46 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN5));
47 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN6));
48 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN7));
49
50 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN5A));
51 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN6A));
52 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN7A));
53
54 #elif BOOST_VMD_MSVC
55
56 #define FUNC_GEN5(x,y) ()
57 #define FUNC_GEN6(x,y) anything
58
59 /* This shows that VC++ does not work correctly in these cases. */
60
61 BOOST_TEST(BOOST_VMD_IS_EMPTY(FUNC_GEN)); /* This produces the wrong result */
62 BOOST_TEST(BOOST_VMD_IS_EMPTY(FUNC_GEN2)); /* This produces the wrong result */
63
64 BOOST_TEST(BOOST_VMD_IS_EMPTY(FUNC_GEN5)); /* This should produce a compiler error but does not and produces the incorrect result */
65 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN6)); /* This should produce a compiler error but does not */
66
67 #else
68
69 #define FUNC_GEN5() (&)
70 #define FUNC_GEN6(x) (y)
71 #define FUNC_GEN7() (y,z)
72
73 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN));
74 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN2));
75
76 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN5));
77 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN6));
78 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN7));
79
80 #endif /* BOOST_VMD_MSVC */
81
82 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN3));
83 BOOST_TEST(!BOOST_VMD_IS_EMPTY(FUNC_GEN4));
84
85 #else
86
87 BOOST_ERROR("No variadic macro support");
88
89 #endif /* BOOST_PP_VARIADICS */
90
91 return boost::report_errors();
92
93 }