38 #include "gtest/gtest.h" 42 using ::std::tr1::tuple;
43 using ::testing::Matcher;
44 using ::testing::internal::CompileAssertTypesEqual;
45 using ::testing::internal::MatcherTuple;
46 using ::testing::internal::Function;
47 using ::testing::internal::IgnoredValue;
51 TEST(MatcherTupleTest, ForSize0) {
52 CompileAssertTypesEqual<tuple<>, MatcherTuple<tuple<> >::type>();
55 TEST(MatcherTupleTest, ForSize1) {
56 CompileAssertTypesEqual<tuple<Matcher<int> >,
57 MatcherTuple<tuple<int> >::type>();
60 TEST(MatcherTupleTest, ForSize2) {
61 CompileAssertTypesEqual<tuple<Matcher<int>, Matcher<char> >,
62 MatcherTuple<tuple<int, char> >::type>();
65 TEST(MatcherTupleTest, ForSize5) {
66 CompileAssertTypesEqual<tuple<Matcher<int>, Matcher<char>, Matcher<bool>,
67 Matcher<double>, Matcher<char*> >,
68 MatcherTuple<tuple<int, char, bool, double, char*>
75 typedef Function<int()> F;
76 CompileAssertTypesEqual<int, F::Result>();
77 CompileAssertTypesEqual<tuple<>, F::ArgumentTuple>();
78 CompileAssertTypesEqual<tuple<>, F::ArgumentMatcherTuple>();
79 CompileAssertTypesEqual<void(), F::MakeResultVoid>();
80 CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>();
84 typedef Function<int(bool)> F;
85 CompileAssertTypesEqual<int, F::Result>();
86 CompileAssertTypesEqual<bool, F::Argument1>();
87 CompileAssertTypesEqual<tuple<bool>, F::ArgumentTuple>();
88 CompileAssertTypesEqual<tuple<Matcher<bool> >, F::ArgumentMatcherTuple>();
89 CompileAssertTypesEqual<void(bool), F::MakeResultVoid>();
90 CompileAssertTypesEqual<IgnoredValue(
bool),
91 F::MakeResultIgnoredValue>();
95 typedef Function<int(bool, const long&)> F;
96 CompileAssertTypesEqual<int, F::Result>();
97 CompileAssertTypesEqual<bool, F::Argument1>();
98 CompileAssertTypesEqual<const long&, F::Argument2>();
99 CompileAssertTypesEqual<tuple<bool, const long&>, F::ArgumentTuple>();
100 CompileAssertTypesEqual<tuple<Matcher<bool>, Matcher<const long&> >,
101 F::ArgumentMatcherTuple>();
102 CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>();
103 CompileAssertTypesEqual<IgnoredValue(
bool,
const long&),
104 F::MakeResultIgnoredValue>();
107 TEST(FunctionTest, LongArgumentList) {
108 typedef Function<char(bool, int, char*, int&, const long&)> F;
109 CompileAssertTypesEqual<char, F::Result>();
110 CompileAssertTypesEqual<bool, F::Argument1>();
111 CompileAssertTypesEqual<int, F::Argument2>();
112 CompileAssertTypesEqual<char*, F::Argument3>();
113 CompileAssertTypesEqual<int&, F::Argument4>();
114 CompileAssertTypesEqual<const long&, F::Argument5>();
115 CompileAssertTypesEqual<tuple<bool, int, char*, int&, const long&>,
117 CompileAssertTypesEqual<tuple<Matcher<bool>, Matcher<int>, Matcher<char*>,
118 Matcher<int&>, Matcher<const long&> >,
119 F::ArgumentMatcherTuple>();
120 CompileAssertTypesEqual<void(
bool,
int,
char*,
int&,
const long&),
121 F::MakeResultVoid>();
122 CompileAssertTypesEqual<
123 IgnoredValue(
bool,
int,
char*,
int&,
const long&),
124 F::MakeResultIgnoredValue>();
const char * Binary(const char *input, short n)
#define TEST(test_case_name, test_name)