File: pp_call_test.cpp

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (43 lines) | stat: -rw-r--r-- 1,117 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2021 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/describe/detail/pp_utilities.hpp>
#include <boost/describe/detail/config.hpp>
#include <boost/core/lightweight_test.hpp>

#if !defined(BOOST_DESCRIBE_CXX11)

#include <boost/config/pragma_message.hpp>

BOOST_PRAGMA_MESSAGE("Skipping test because C++11 is not available")
int main() {}

#else

#define S(x) S2(x)
#define S2(x) S3(x)
#define S3(x) #x

#define F(a, x) (a, x)

#if defined(_MSC_VER)
# pragma warning(disable: 4003) // not enough arguments for macro invocation
#endif

char const * s1 = S(BOOST_DESCRIBE_PP_CALL(F, a, x));
char const * s2 = "" S(BOOST_DESCRIBE_PP_CALL(F, a, ));
char const * s3 = S(BOOST_DESCRIBE_PP_CALL(F, a, () x));
char const * s4 = S(BOOST_DESCRIBE_PP_CALL(F, a, (b, c) x));

int main()
{
    BOOST_TEST_CSTR_EQ( s1, "(a, x)" );
    BOOST_TEST_CSTR_EQ( s2, "" );
    BOOST_TEST_CSTR_EQ( s3, "(a, () x)" );
    BOOST_TEST_CSTR_EQ( s4, "(a, (b, c) x)" );

    return boost::report_errors();
}

#endif // !defined(BOOST_DESCRIBE_CXX11)