Sacado Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
test
GTestSuite
googletest
googlemock
test
gmock-pp_test.cc
Go to the documentation of this file.
1
#include "
gmock/internal/gmock-pp.h
"
2
3
// Used to test MSVC treating __VA_ARGS__ with a comma in it as one value
4
#define GMOCK_TEST_REPLACE_comma_WITH_COMMA_I_comma ,
5
#define GMOCK_TEST_REPLACE_comma_WITH_COMMA(x) \
6
GMOCK_PP_CAT(GMOCK_TEST_REPLACE_comma_WITH_COMMA_I_, x)
7
8
// Static assertions.
9
namespace
testing
{
10
namespace
internal {
11
namespace
gmockpp
{
12
13
static_assert
(
GMOCK_PP_CAT
(1, 4) == 14,
""
);
14
static_assert
(
GMOCK_PP_INTERNAL_INTERNAL_16TH
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
15
12, 13, 14, 15, 16, 17, 18) == 16,
16
""
);
17
static_assert
(
GMOCK_PP_NARG
() == 1,
""
);
18
static_assert
(
GMOCK_PP_NARG
(x) == 1,
""
);
19
static_assert
(
GMOCK_PP_NARG
(x, y) == 2,
""
);
20
static_assert
(
GMOCK_PP_NARG
(x, y, z) == 3,
""
);
21
static_assert
(
GMOCK_PP_NARG
(x, y, z, w) == 4,
""
);
22
static_assert
(!
GMOCK_PP_HAS_COMMA
(),
""
);
23
static_assert
(
GMOCK_PP_HAS_COMMA
(b, ),
""
);
24
static_assert
(!
GMOCK_PP_HAS_COMMA
((, )),
""
);
25
static_assert
(
GMOCK_PP_HAS_COMMA
(
GMOCK_TEST_REPLACE_comma_WITH_COMMA
(comma)),
26
""
);
27
static_assert
(
28
GMOCK_PP_HAS_COMMA
(
GMOCK_TEST_REPLACE_comma_WITH_COMMA
(comma(unrelated))),
29
""
);
30
static_assert
(!
GMOCK_PP_IS_EMPTY
(, ),
""
);
31
static_assert
(!
GMOCK_PP_IS_EMPTY
(
a
),
""
);
32
static_assert
(!
GMOCK_PP_IS_EMPTY
(()),
""
);
33
static_assert
(
GMOCK_PP_IF
(1, 1, 2) == 1,
""
);
34
static_assert
(
GMOCK_PP_IF
(0, 1, 2) == 2,
""
);
35
static_assert
(
GMOCK_PP_NARG0
(x) == 1,
""
);
36
static_assert
(
GMOCK_PP_NARG0
(x, y) == 2,
""
);
37
static_assert
(
GMOCK_PP_HEAD
(1) == 1,
""
);
38
static_assert
(
GMOCK_PP_HEAD
(1, 2) == 1,
""
);
39
static_assert
(
GMOCK_PP_HEAD
(1, 2, 3) == 1,
""
);
40
static_assert
(
GMOCK_PP_TAIL
(1, 2) == 2,
""
);
41
static_assert
(
GMOCK_PP_HEAD
(
GMOCK_PP_TAIL
(1, 2, 3)) == 2,
""
);
42
static_assert
(!
GMOCK_PP_IS_BEGIN_PARENS
(sss),
""
);
43
static_assert
(!
GMOCK_PP_IS_BEGIN_PARENS
(sss()),
""
);
44
static_assert
(!
GMOCK_PP_IS_BEGIN_PARENS
(sss() sss),
""
);
45
static_assert
(
GMOCK_PP_IS_BEGIN_PARENS
((sss)),
""
);
46
static_assert
(
GMOCK_PP_IS_BEGIN_PARENS
((sss)ss),
""
);
47
static_assert
(!
GMOCK_PP_IS_ENCLOSED_PARENS
(sss),
""
);
48
static_assert
(!
GMOCK_PP_IS_ENCLOSED_PARENS
(sss()),
""
);
49
static_assert
(!
GMOCK_PP_IS_ENCLOSED_PARENS
(sss() sss),
""
);
50
static_assert
(!
GMOCK_PP_IS_ENCLOSED_PARENS
((sss)ss),
""
);
51
static_assert
(
GMOCK_PP_REMOVE_PARENS
((1 + 1)) * 2 == 3,
""
);
52
static_assert
(
GMOCK_PP_INC
(4) == 5,
""
);
53
54
template
<
class
... Args>
55
struct
Test
{
56
static
constexpr
int
kArgs
=
sizeof
...(Args);
57
};
58
#define GMOCK_PP_INTERNAL_TYPE_TEST(_i, _Data, _element) \
59
GMOCK_PP_COMMA_IF(_i) _element
60
static_assert
(
Test
<
GMOCK_PP_FOR_EACH
(
GMOCK_PP_INTERNAL_TYPE_TEST
, ~,
61
(
int
,
float
,
double
,
char
))>::kArgs == 4,
62
""
);
63
#define GMOCK_PP_INTERNAL_VAR_TEST_1(_x) 1
64
#define GMOCK_PP_INTERNAL_VAR_TEST_2(_x, _y) 2
65
#define GMOCK_PP_INTERNAL_VAR_TEST_3(_x, _y, _z) 3
66
67
#define GMOCK_PP_INTERNAL_VAR_TEST(...) \
68
GMOCK_PP_VARIADIC_CALL(GMOCK_PP_INTERNAL_VAR_TEST_, __VA_ARGS__)
69
static_assert
(
GMOCK_PP_INTERNAL_VAR_TEST
(x, y) == 2,
""
);
70
static_assert
(
GMOCK_PP_INTERNAL_VAR_TEST
(silly) == 1,
""
);
71
static_assert
(
GMOCK_PP_INTERNAL_VAR_TEST
(x, y, z) == 3,
""
);
72
73
// TODO(iserna): The following asserts fail in --config=lexan.
74
#define GMOCK_PP_INTERNAL_IS_EMPTY_TEST_1
75
static_assert
(
GMOCK_PP_IS_EMPTY
(
GMOCK_PP_INTERNAL_IS_EMPTY_TEST_1
),
""
);
76
static_assert
(
GMOCK_PP_IS_EMPTY
(),
""
);
77
static_assert
(
GMOCK_PP_IS_ENCLOSED_PARENS
((sss)),
""
);
78
static_assert
(
GMOCK_PP_IS_EMPTY
(
GMOCK_PP_TAIL
(1)),
""
);
79
static_assert
(
GMOCK_PP_NARG0
() == 0,
""
);
80
81
}
// namespace gmockpp
82
}
// namespace internal
83
}
// namespace testing
a
a
Definition
Sacado_CacheFad_Ops.hpp:426
Test
Definition
gtest.h:414
GMOCK_PP_INTERNAL_IS_EMPTY_TEST_1
#define GMOCK_PP_INTERNAL_IS_EMPTY_TEST_1
gmock-pp.h
GMOCK_PP_NARG0
#define GMOCK_PP_NARG0(...)
Definition
gmock-pp.h:110
GMOCK_PP_CAT
#define GMOCK_PP_CAT(_1, _2)
Definition
gmock-pp.h:5
GMOCK_PP_IS_ENCLOSED_PARENS
#define GMOCK_PP_IS_ENCLOSED_PARENS(...)
Definition
gmock-pp.h:120
GMOCK_PP_TAIL
#define GMOCK_PP_TAIL(...)
Definition
gmock-pp.h:44
GMOCK_PP_IS_EMPTY
#define GMOCK_PP_IS_EMPTY(...)
Definition
gmock-pp.h:79
GMOCK_PP_REMOVE_PARENS
#define GMOCK_PP_REMOVE_PARENS(...)
Definition
gmock-pp.h:125
GMOCK_PP_IS_BEGIN_PARENS
#define GMOCK_PP_IS_BEGIN_PARENS(...)
Definition
gmock-pp.h:115
GMOCK_PP_IF
#define GMOCK_PP_IF(_Cond, _Then, _Else)
Definition
gmock-pp.h:86
GMOCK_PP_NARG
#define GMOCK_PP_NARG(...)
Definition
gmock-pp.h:29
GMOCK_PP_HAS_COMMA
#define GMOCK_PP_HAS_COMMA(...)
Definition
gmock-pp.h:35
GMOCK_PP_FOR_EACH
#define GMOCK_PP_FOR_EACH(_Macro, _Data, _Tuple)
Definition
gmock-pp.h:131
GMOCK_PP_INC
#define GMOCK_PP_INC(_i)
Definition
gmock-pp.h:144
GMOCK_PP_INTERNAL_INTERNAL_16TH
#define GMOCK_PP_INTERNAL_INTERNAL_16TH(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...)
Definition
gmock-pp.h:167
GMOCK_PP_HEAD
#define GMOCK_PP_HEAD(...)
Definition
gmock-pp.h:40
GMOCK_TEST_REPLACE_comma_WITH_COMMA
#define GMOCK_TEST_REPLACE_comma_WITH_COMMA(x)
Definition
gmock-pp_test.cc:5
GMOCK_PP_INTERNAL_TYPE_TEST
#define GMOCK_PP_INTERNAL_TYPE_TEST(_i, _Data, _element)
Definition
gmock-pp_test.cc:58
GMOCK_PP_INTERNAL_VAR_TEST
#define GMOCK_PP_INTERNAL_VAR_TEST(...)
Definition
gmock-pp_test.cc:67
testing::internal::gmockpp
Definition
gmock-pp_test.cc:11
testing
Definition
gmock-actions.h:154
testing::internal::gmockpp::Test
Definition
gmock-pp_test.cc:55
testing::internal::gmockpp::Test::kArgs
static constexpr int kArgs
Definition
gmock-pp_test.cc:56
Generated by
1.17.0