summaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock-internal-utils_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-01-07 22:06:16 (GMT)
committergennadiycivil <misterg@google.com>2019-01-08 16:50:56 (GMT)
commit216c37f057ae0fff38062984c890df912f40ccf6 (patch)
tree19bd4362670a0c0440f08b0360eaca8a5e44d9ed /googlemock/test/gmock-internal-utils_test.cc
parent644319b9f06f6ca9bf69fe791be399061044bc3d (diff)
downloadgoogletest-216c37f057ae0fff38062984c890df912f40ccf6.zip
googletest-216c37f057ae0fff38062984c890df912f40ccf6.tar.gz
googletest-216c37f057ae0fff38062984c890df912f40ccf6.tar.bz2
Googletest export
Drop generated file gmock-generated-internal-utils.h. PiperOrigin-RevId: 228232195
Diffstat (limited to 'googlemock/test/gmock-internal-utils_test.cc')
-rw-r--r--googlemock/test/gmock-internal-utils_test.cc64
1 files changed, 64 insertions, 0 deletions
diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc
index b322f2d..0adcdfb 100644
--- a/googlemock/test/gmock-internal-utils_test.cc
+++ b/googlemock/test/gmock-internal-utils_test.cc
@@ -690,6 +690,70 @@ TEST(StlContainerViewTest, WorksForDynamicNativeArray) {
EXPECT_EQ(0, a3.begin()[0]);
}
+// Tests the Function template struct.
+
+TEST(FunctionTest, Nullary) {
+ typedef Function<int()> F; // NOLINT
+ EXPECT_EQ(0u, F::ArgumentCount);
+ CompileAssertTypesEqual<int, F::Result>();
+ CompileAssertTypesEqual<std::tuple<>, F::ArgumentTuple>();
+ CompileAssertTypesEqual<std::tuple<>, F::ArgumentMatcherTuple>();
+ CompileAssertTypesEqual<void(), F::MakeResultVoid>();
+ CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>();
+}
+
+TEST(FunctionTest, Unary) {
+ typedef Function<int(bool)> F; // NOLINT
+ EXPECT_EQ(1u, F::ArgumentCount);
+ CompileAssertTypesEqual<int, F::Result>();
+ CompileAssertTypesEqual<bool, F::Arg<0>::type>();
+ CompileAssertTypesEqual<std::tuple<bool>, F::ArgumentTuple>();
+ CompileAssertTypesEqual<std::tuple<Matcher<bool> >,
+ F::ArgumentMatcherTuple>();
+ CompileAssertTypesEqual<void(bool), F::MakeResultVoid>(); // NOLINT
+ CompileAssertTypesEqual<IgnoredValue(bool), // NOLINT
+ F::MakeResultIgnoredValue>();
+}
+
+TEST(FunctionTest, Binary) {
+ typedef Function<int(bool, const long&)> F; // NOLINT
+ EXPECT_EQ(2u, F::ArgumentCount);
+ CompileAssertTypesEqual<int, F::Result>();
+ CompileAssertTypesEqual<bool, F::Arg<0>::type>();
+ CompileAssertTypesEqual<const long&, F::Arg<1>::type>(); // NOLINT
+ CompileAssertTypesEqual<std::tuple<bool, const long&>, // NOLINT
+ F::ArgumentTuple>();
+ CompileAssertTypesEqual<
+ std::tuple<Matcher<bool>, Matcher<const long&> >, // NOLINT
+ F::ArgumentMatcherTuple>();
+ CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>(); // NOLINT
+ CompileAssertTypesEqual<IgnoredValue(bool, const long&), // NOLINT
+ F::MakeResultIgnoredValue>();
+}
+
+TEST(FunctionTest, LongArgumentList) {
+ typedef Function<char(bool, int, char*, int&, const long&)> F; // NOLINT
+ EXPECT_EQ(5u, F::ArgumentCount);
+ CompileAssertTypesEqual<char, F::Result>();
+ CompileAssertTypesEqual<bool, F::Arg<0>::type>();
+ CompileAssertTypesEqual<int, F::Arg<1>::type>();
+ CompileAssertTypesEqual<char*, F::Arg<2>::type>();
+ CompileAssertTypesEqual<int&, F::Arg<3>::type>();
+ CompileAssertTypesEqual<const long&, F::Arg<4>::type>(); // NOLINT
+ CompileAssertTypesEqual<
+ std::tuple<bool, int, char*, int&, const long&>, // NOLINT
+ F::ArgumentTuple>();
+ CompileAssertTypesEqual<
+ std::tuple<Matcher<bool>, Matcher<int>, Matcher<char*>, Matcher<int&>,
+ Matcher<const long&> >, // NOLINT
+ F::ArgumentMatcherTuple>();
+ CompileAssertTypesEqual<void(bool, int, char*, int&, const long&), // NOLINT
+ F::MakeResultVoid>();
+ CompileAssertTypesEqual<
+ IgnoredValue(bool, int, char*, int&, const long&), // NOLINT
+ F::MakeResultIgnoredValue>();
+}
+
} // namespace
} // namespace internal
} // namespace testing