mirror of
https://github.com/google/googletest.git
synced 2025-11-12 15:55:01 -05:00
Unconditionally use std::tuple.
Remove all mention of TR1 tuple and our own implementation of tuple. PiperOrigin-RevId: 216395043
This commit is contained in:
committed by
Gennadiy Civil
parent
5434989dbd
commit
7d3b73c85a
@@ -46,10 +46,6 @@ namespace gmock_more_actions_test {
|
||||
|
||||
using ::std::plus;
|
||||
using ::std::string;
|
||||
using testing::get;
|
||||
using testing::make_tuple;
|
||||
using testing::tuple;
|
||||
using testing::tuple_element;
|
||||
using testing::_;
|
||||
using testing::Action;
|
||||
using testing::ActionInterface;
|
||||
@@ -232,45 +228,46 @@ class Foo {
|
||||
// Tests using Invoke() with a nullary function.
|
||||
TEST(InvokeTest, Nullary) {
|
||||
Action<int()> a = Invoke(Nullary); // NOLINT
|
||||
EXPECT_EQ(1, a.Perform(make_tuple()));
|
||||
EXPECT_EQ(1, a.Perform(std::make_tuple()));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a unary function.
|
||||
TEST(InvokeTest, Unary) {
|
||||
Action<bool(int)> a = Invoke(Unary); // NOLINT
|
||||
EXPECT_FALSE(a.Perform(make_tuple(1)));
|
||||
EXPECT_TRUE(a.Perform(make_tuple(-1)));
|
||||
EXPECT_FALSE(a.Perform(std::make_tuple(1)));
|
||||
EXPECT_TRUE(a.Perform(std::make_tuple(-1)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a binary function.
|
||||
TEST(InvokeTest, Binary) {
|
||||
Action<const char*(const char*, short)> a = Invoke(Binary); // NOLINT
|
||||
const char* p = "Hello";
|
||||
EXPECT_EQ(p + 2, a.Perform(make_tuple(p, Short(2))));
|
||||
EXPECT_EQ(p + 2, a.Perform(std::make_tuple(p, Short(2))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a ternary function.
|
||||
TEST(InvokeTest, Ternary) {
|
||||
Action<int(int, char, short)> a = Invoke(Ternary); // NOLINT
|
||||
EXPECT_EQ(6, a.Perform(make_tuple(1, '\2', Short(3))));
|
||||
EXPECT_EQ(6, a.Perform(std::make_tuple(1, '\2', Short(3))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 4-argument function.
|
||||
TEST(InvokeTest, FunctionThatTakes4Arguments) {
|
||||
Action<int(int, int, int, int)> a = Invoke(SumOf4); // NOLINT
|
||||
EXPECT_EQ(1234, a.Perform(make_tuple(1000, 200, 30, 4)));
|
||||
EXPECT_EQ(1234, a.Perform(std::make_tuple(1000, 200, 30, 4)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 5-argument function.
|
||||
TEST(InvokeTest, FunctionThatTakes5Arguments) {
|
||||
Action<int(int, int, int, int, int)> a = Invoke(SumOf5); // NOLINT
|
||||
EXPECT_EQ(12345, a.Perform(make_tuple(10000, 2000, 300, 40, 5)));
|
||||
EXPECT_EQ(12345, a.Perform(std::make_tuple(10000, 2000, 300, 40, 5)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 6-argument function.
|
||||
TEST(InvokeTest, FunctionThatTakes6Arguments) {
|
||||
Action<int(int, int, int, int, int, int)> a = Invoke(SumOf6); // NOLINT
|
||||
EXPECT_EQ(123456, a.Perform(make_tuple(100000, 20000, 3000, 400, 50, 6)));
|
||||
EXPECT_EQ(123456,
|
||||
a.Perform(std::make_tuple(100000, 20000, 3000, 400, 50, 6)));
|
||||
}
|
||||
|
||||
// A helper that turns the type of a C-string literal from const
|
||||
@@ -283,9 +280,9 @@ TEST(InvokeTest, FunctionThatTakes7Arguments) {
|
||||
const char*, const char*, const char*)>
|
||||
a = Invoke(Concat7);
|
||||
EXPECT_EQ("1234567",
|
||||
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"))));
|
||||
a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 8-argument function.
|
||||
@@ -294,9 +291,9 @@ TEST(InvokeTest, FunctionThatTakes8Arguments) {
|
||||
const char*, const char*, const char*, const char*)>
|
||||
a = Invoke(Concat8);
|
||||
EXPECT_EQ("12345678",
|
||||
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"))));
|
||||
a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 9-argument function.
|
||||
@@ -305,10 +302,10 @@ TEST(InvokeTest, FunctionThatTakes9Arguments) {
|
||||
const char*, const char*, const char*, const char*,
|
||||
const char*)>
|
||||
a = Invoke(Concat9);
|
||||
EXPECT_EQ("123456789",
|
||||
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"), CharPtr("9"))));
|
||||
EXPECT_EQ("123456789", a.Perform(std::make_tuple(
|
||||
CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"), CharPtr("9"))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 10-argument function.
|
||||
@@ -318,46 +315,46 @@ TEST(InvokeTest, FunctionThatTakes10Arguments) {
|
||||
const char*, const char*)>
|
||||
a = Invoke(Concat10);
|
||||
EXPECT_EQ("1234567890",
|
||||
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"), CharPtr("9"),
|
||||
CharPtr("0"))));
|
||||
a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"), CharPtr("9"),
|
||||
CharPtr("0"))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with functions with parameters declared as Unused.
|
||||
TEST(InvokeTest, FunctionWithUnusedParameters) {
|
||||
Action<int(int, int, double, const std::string&)> a1 = Invoke(SumOfFirst2);
|
||||
tuple<int, int, double, std::string> dummy =
|
||||
make_tuple(10, 2, 5.6, std::string("hi"));
|
||||
std::tuple<int, int, double, std::string> dummy =
|
||||
std::make_tuple(10, 2, 5.6, std::string("hi"));
|
||||
EXPECT_EQ(12, a1.Perform(dummy));
|
||||
|
||||
Action<int(int, int, bool, int*)> a2 =
|
||||
Invoke(SumOfFirst2);
|
||||
EXPECT_EQ(23,
|
||||
a2.Perform(make_tuple(20, 3, true, static_cast<int*>(nullptr))));
|
||||
EXPECT_EQ(
|
||||
23, a2.Perform(std::make_tuple(20, 3, true, static_cast<int*>(nullptr))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with methods with parameters declared as Unused.
|
||||
TEST(InvokeTest, MethodWithUnusedParameters) {
|
||||
Foo foo;
|
||||
Action<int(std::string, bool, int, int)> a1 = Invoke(&foo, &Foo::SumOfLast2);
|
||||
EXPECT_EQ(12, a1.Perform(make_tuple(CharPtr("hi"), true, 10, 2)));
|
||||
EXPECT_EQ(12, a1.Perform(std::make_tuple(CharPtr("hi"), true, 10, 2)));
|
||||
|
||||
Action<int(char, double, int, int)> a2 =
|
||||
Invoke(&foo, &Foo::SumOfLast2);
|
||||
EXPECT_EQ(23, a2.Perform(make_tuple('a', 2.5, 20, 3)));
|
||||
EXPECT_EQ(23, a2.Perform(std::make_tuple('a', 2.5, 20, 3)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a functor.
|
||||
TEST(InvokeTest, Functor) {
|
||||
Action<long(long, int)> a = Invoke(plus<long>()); // NOLINT
|
||||
EXPECT_EQ(3L, a.Perform(make_tuple(1, 2)));
|
||||
EXPECT_EQ(3L, a.Perform(std::make_tuple(1, 2)));
|
||||
}
|
||||
|
||||
// Tests using Invoke(f) as an action of a compatible type.
|
||||
TEST(InvokeTest, FunctionWithCompatibleType) {
|
||||
Action<long(int, short, char, bool)> a = Invoke(SumOf4); // NOLINT
|
||||
EXPECT_EQ(4321, a.Perform(make_tuple(4000, Short(300), Char(20), true)));
|
||||
EXPECT_EQ(4321, a.Perform(std::make_tuple(4000, Short(300), Char(20), true)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with an object pointer and a method pointer.
|
||||
@@ -366,14 +363,14 @@ TEST(InvokeTest, FunctionWithCompatibleType) {
|
||||
TEST(InvokeMethodTest, Nullary) {
|
||||
Foo foo;
|
||||
Action<int()> a = Invoke(&foo, &Foo::Nullary); // NOLINT
|
||||
EXPECT_EQ(123, a.Perform(make_tuple()));
|
||||
EXPECT_EQ(123, a.Perform(std::make_tuple()));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a unary method.
|
||||
TEST(InvokeMethodTest, Unary) {
|
||||
Foo foo;
|
||||
Action<short(long)> a = Invoke(&foo, &Foo::Unary); // NOLINT
|
||||
EXPECT_EQ(4123, a.Perform(make_tuple(4000)));
|
||||
EXPECT_EQ(4123, a.Perform(std::make_tuple(4000)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a binary method.
|
||||
@@ -381,7 +378,7 @@ TEST(InvokeMethodTest, Binary) {
|
||||
Foo foo;
|
||||
Action<std::string(const std::string&, char)> a = Invoke(&foo, &Foo::Binary);
|
||||
std::string s("Hell");
|
||||
tuple<std::string, char> dummy = make_tuple(s, 'o');
|
||||
std::tuple<std::string, char> dummy = std::make_tuple(s, 'o');
|
||||
EXPECT_EQ("Hello", a.Perform(dummy));
|
||||
}
|
||||
|
||||
@@ -389,21 +386,21 @@ TEST(InvokeMethodTest, Binary) {
|
||||
TEST(InvokeMethodTest, Ternary) {
|
||||
Foo foo;
|
||||
Action<int(int, bool, char)> a = Invoke(&foo, &Foo::Ternary); // NOLINT
|
||||
EXPECT_EQ(1124, a.Perform(make_tuple(1000, true, Char(1))));
|
||||
EXPECT_EQ(1124, a.Perform(std::make_tuple(1000, true, Char(1))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 4-argument method.
|
||||
TEST(InvokeMethodTest, MethodThatTakes4Arguments) {
|
||||
Foo foo;
|
||||
Action<int(int, int, int, int)> a = Invoke(&foo, &Foo::SumOf4); // NOLINT
|
||||
EXPECT_EQ(1357, a.Perform(make_tuple(1000, 200, 30, 4)));
|
||||
EXPECT_EQ(1357, a.Perform(std::make_tuple(1000, 200, 30, 4)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 5-argument method.
|
||||
TEST(InvokeMethodTest, MethodThatTakes5Arguments) {
|
||||
Foo foo;
|
||||
Action<int(int, int, int, int, int)> a = Invoke(&foo, &Foo::SumOf5); // NOLINT
|
||||
EXPECT_EQ(12345, a.Perform(make_tuple(10000, 2000, 300, 40, 5)));
|
||||
EXPECT_EQ(12345, a.Perform(std::make_tuple(10000, 2000, 300, 40, 5)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 6-argument method.
|
||||
@@ -411,7 +408,8 @@ TEST(InvokeMethodTest, MethodThatTakes6Arguments) {
|
||||
Foo foo;
|
||||
Action<int(int, int, int, int, int, int)> a = // NOLINT
|
||||
Invoke(&foo, &Foo::SumOf6);
|
||||
EXPECT_EQ(123456, a.Perform(make_tuple(100000, 20000, 3000, 400, 50, 6)));
|
||||
EXPECT_EQ(123456,
|
||||
a.Perform(std::make_tuple(100000, 20000, 3000, 400, 50, 6)));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 7-argument method.
|
||||
@@ -421,9 +419,9 @@ TEST(InvokeMethodTest, MethodThatTakes7Arguments) {
|
||||
const char*, const char*, const char*)>
|
||||
a = Invoke(&foo, &Foo::Concat7);
|
||||
EXPECT_EQ("1234567",
|
||||
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"))));
|
||||
a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 8-argument method.
|
||||
@@ -433,9 +431,9 @@ TEST(InvokeMethodTest, MethodThatTakes8Arguments) {
|
||||
const char*, const char*, const char*, const char*)>
|
||||
a = Invoke(&foo, &Foo::Concat8);
|
||||
EXPECT_EQ("12345678",
|
||||
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"))));
|
||||
a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 9-argument method.
|
||||
@@ -445,10 +443,10 @@ TEST(InvokeMethodTest, MethodThatTakes9Arguments) {
|
||||
const char*, const char*, const char*, const char*,
|
||||
const char*)>
|
||||
a = Invoke(&foo, &Foo::Concat9);
|
||||
EXPECT_EQ("123456789",
|
||||
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"), CharPtr("9"))));
|
||||
EXPECT_EQ("123456789", a.Perform(std::make_tuple(
|
||||
CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"), CharPtr("9"))));
|
||||
}
|
||||
|
||||
// Tests using Invoke() with a 10-argument method.
|
||||
@@ -459,10 +457,10 @@ TEST(InvokeMethodTest, MethodThatTakes10Arguments) {
|
||||
const char*, const char*)>
|
||||
a = Invoke(&foo, &Foo::Concat10);
|
||||
EXPECT_EQ("1234567890",
|
||||
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"), CharPtr("9"),
|
||||
CharPtr("0"))));
|
||||
a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
|
||||
CharPtr("4"), CharPtr("5"), CharPtr("6"),
|
||||
CharPtr("7"), CharPtr("8"), CharPtr("9"),
|
||||
CharPtr("0"))));
|
||||
}
|
||||
|
||||
// Tests using Invoke(f) as an action of a compatible type.
|
||||
@@ -470,48 +468,48 @@ TEST(InvokeMethodTest, MethodWithCompatibleType) {
|
||||
Foo foo;
|
||||
Action<long(int, short, char, bool)> a = // NOLINT
|
||||
Invoke(&foo, &Foo::SumOf4);
|
||||
EXPECT_EQ(4444, a.Perform(make_tuple(4000, Short(300), Char(20), true)));
|
||||
EXPECT_EQ(4444, a.Perform(std::make_tuple(4000, Short(300), Char(20), true)));
|
||||
}
|
||||
|
||||
// Tests using WithoutArgs with an action that takes no argument.
|
||||
TEST(WithoutArgsTest, NoArg) {
|
||||
Action<int(int n)> a = WithoutArgs(Invoke(Nullary)); // NOLINT
|
||||
EXPECT_EQ(1, a.Perform(make_tuple(2)));
|
||||
EXPECT_EQ(1, a.Perform(std::make_tuple(2)));
|
||||
}
|
||||
|
||||
// Tests using WithArg with an action that takes 1 argument.
|
||||
TEST(WithArgTest, OneArg) {
|
||||
Action<bool(double x, int n)> b = WithArg<1>(Invoke(Unary)); // NOLINT
|
||||
EXPECT_TRUE(b.Perform(make_tuple(1.5, -1)));
|
||||
EXPECT_FALSE(b.Perform(make_tuple(1.5, 1)));
|
||||
EXPECT_TRUE(b.Perform(std::make_tuple(1.5, -1)));
|
||||
EXPECT_FALSE(b.Perform(std::make_tuple(1.5, 1)));
|
||||
}
|
||||
|
||||
TEST(ReturnArgActionTest, WorksForOneArgIntArg0) {
|
||||
const Action<int(int)> a = ReturnArg<0>();
|
||||
EXPECT_EQ(5, a.Perform(make_tuple(5)));
|
||||
EXPECT_EQ(5, a.Perform(std::make_tuple(5)));
|
||||
}
|
||||
|
||||
TEST(ReturnArgActionTest, WorksForMultiArgBoolArg0) {
|
||||
const Action<bool(bool, bool, bool)> a = ReturnArg<0>();
|
||||
EXPECT_TRUE(a.Perform(make_tuple(true, false, false)));
|
||||
EXPECT_TRUE(a.Perform(std::make_tuple(true, false, false)));
|
||||
}
|
||||
|
||||
TEST(ReturnArgActionTest, WorksForMultiArgStringArg2) {
|
||||
const Action<std::string(int, int, std::string, int)> a = ReturnArg<2>();
|
||||
EXPECT_EQ("seven", a.Perform(make_tuple(5, 6, std::string("seven"), 8)));
|
||||
EXPECT_EQ("seven", a.Perform(std::make_tuple(5, 6, std::string("seven"), 8)));
|
||||
}
|
||||
|
||||
TEST(SaveArgActionTest, WorksForSameType) {
|
||||
int result = 0;
|
||||
const Action<void(int n)> a1 = SaveArg<0>(&result);
|
||||
a1.Perform(make_tuple(5));
|
||||
a1.Perform(std::make_tuple(5));
|
||||
EXPECT_EQ(5, result);
|
||||
}
|
||||
|
||||
TEST(SaveArgActionTest, WorksForCompatibleType) {
|
||||
int result = 0;
|
||||
const Action<void(bool, char)> a1 = SaveArg<1>(&result);
|
||||
a1.Perform(make_tuple(true, 'a'));
|
||||
a1.Perform(std::make_tuple(true, 'a'));
|
||||
EXPECT_EQ('a', result);
|
||||
}
|
||||
|
||||
@@ -519,7 +517,7 @@ TEST(SaveArgPointeeActionTest, WorksForSameType) {
|
||||
int result = 0;
|
||||
const int value = 5;
|
||||
const Action<void(const int*)> a1 = SaveArgPointee<0>(&result);
|
||||
a1.Perform(make_tuple(&value));
|
||||
a1.Perform(std::make_tuple(&value));
|
||||
EXPECT_EQ(5, result);
|
||||
}
|
||||
|
||||
@@ -527,7 +525,7 @@ TEST(SaveArgPointeeActionTest, WorksForCompatibleType) {
|
||||
int result = 0;
|
||||
char value = 'a';
|
||||
const Action<void(bool, char*)> a1 = SaveArgPointee<1>(&result);
|
||||
a1.Perform(make_tuple(true, &value));
|
||||
a1.Perform(std::make_tuple(true, &value));
|
||||
EXPECT_EQ('a', result);
|
||||
}
|
||||
|
||||
@@ -535,28 +533,28 @@ TEST(SaveArgPointeeActionTest, WorksForLinkedPtr) {
|
||||
int result = 0;
|
||||
linked_ptr<int> value(new int(5));
|
||||
const Action<void(linked_ptr<int>)> a1 = SaveArgPointee<0>(&result);
|
||||
a1.Perform(make_tuple(value));
|
||||
a1.Perform(std::make_tuple(value));
|
||||
EXPECT_EQ(5, result);
|
||||
}
|
||||
|
||||
TEST(SetArgRefereeActionTest, WorksForSameType) {
|
||||
int value = 0;
|
||||
const Action<void(int&)> a1 = SetArgReferee<0>(1);
|
||||
a1.Perform(tuple<int&>(value));
|
||||
a1.Perform(std::tuple<int&>(value));
|
||||
EXPECT_EQ(1, value);
|
||||
}
|
||||
|
||||
TEST(SetArgRefereeActionTest, WorksForCompatibleType) {
|
||||
int value = 0;
|
||||
const Action<void(int, int&)> a1 = SetArgReferee<1>('a');
|
||||
a1.Perform(tuple<int, int&>(0, value));
|
||||
a1.Perform(std::tuple<int, int&>(0, value));
|
||||
EXPECT_EQ('a', value);
|
||||
}
|
||||
|
||||
TEST(SetArgRefereeActionTest, WorksWithExtraArguments) {
|
||||
int value = 0;
|
||||
const Action<void(bool, int, int&, const char*)> a1 = SetArgReferee<2>('a');
|
||||
a1.Perform(tuple<bool, int, int&, const char*>(true, 0, value, "hi"));
|
||||
a1.Perform(std::tuple<bool, int, int&, const char*>(true, 0, value, "hi"));
|
||||
EXPECT_EQ('a', value);
|
||||
}
|
||||
|
||||
@@ -583,7 +581,7 @@ TEST(DeleteArgActionTest, OneArg) {
|
||||
DeletionTester* t = new DeletionTester(&is_deleted);
|
||||
const Action<void(DeletionTester*)> a1 = DeleteArg<0>(); // NOLINT
|
||||
EXPECT_FALSE(is_deleted);
|
||||
a1.Perform(make_tuple(t));
|
||||
a1.Perform(std::make_tuple(t));
|
||||
EXPECT_TRUE(is_deleted);
|
||||
}
|
||||
|
||||
@@ -593,7 +591,7 @@ TEST(DeleteArgActionTest, TenArgs) {
|
||||
const Action<void(bool, int, int, const char*, bool,
|
||||
int, int, int, int, DeletionTester*)> a1 = DeleteArg<9>();
|
||||
EXPECT_FALSE(is_deleted);
|
||||
a1.Perform(make_tuple(true, 5, 6, CharPtr("hi"), false, 7, 8, 9, 10, t));
|
||||
a1.Perform(std::make_tuple(true, 5, 6, CharPtr("hi"), false, 7, 8, 9, 10, t));
|
||||
EXPECT_TRUE(is_deleted);
|
||||
}
|
||||
|
||||
@@ -601,19 +599,19 @@ TEST(DeleteArgActionTest, TenArgs) {
|
||||
|
||||
TEST(ThrowActionTest, ThrowsGivenExceptionInVoidFunction) {
|
||||
const Action<void(int n)> a = Throw('a');
|
||||
EXPECT_THROW(a.Perform(make_tuple(0)), char);
|
||||
EXPECT_THROW(a.Perform(std::make_tuple(0)), char);
|
||||
}
|
||||
|
||||
class MyException {};
|
||||
|
||||
TEST(ThrowActionTest, ThrowsGivenExceptionInNonVoidFunction) {
|
||||
const Action<double(char ch)> a = Throw(MyException());
|
||||
EXPECT_THROW(a.Perform(make_tuple('0')), MyException);
|
||||
EXPECT_THROW(a.Perform(std::make_tuple('0')), MyException);
|
||||
}
|
||||
|
||||
TEST(ThrowActionTest, ThrowsGivenExceptionInNullaryFunction) {
|
||||
const Action<double()> a = Throw(MyException());
|
||||
EXPECT_THROW(a.Perform(make_tuple()), MyException);
|
||||
EXPECT_THROW(a.Perform(std::make_tuple()), MyException);
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_EXCEPTIONS
|
||||
@@ -629,7 +627,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) {
|
||||
int* pn = n;
|
||||
char ch[4] = {};
|
||||
char* pch = ch;
|
||||
a.Perform(make_tuple(true, pn, pch));
|
||||
a.Perform(std::make_tuple(true, pn, pch));
|
||||
EXPECT_EQ(1, n[0]);
|
||||
EXPECT_EQ(2, n[1]);
|
||||
EXPECT_EQ(3, n[2]);
|
||||
@@ -644,7 +642,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) {
|
||||
a = SetArrayArgument<2>(letters.begin(), letters.end());
|
||||
std::fill_n(n, 4, 0);
|
||||
std::fill_n(ch, 4, '\0');
|
||||
a.Perform(make_tuple(true, pn, pch));
|
||||
a.Perform(std::make_tuple(true, pn, pch));
|
||||
EXPECT_EQ(0, n[0]);
|
||||
EXPECT_EQ(0, n[1]);
|
||||
EXPECT_EQ(0, n[2]);
|
||||
@@ -663,7 +661,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithEmptyRange) {
|
||||
|
||||
int n[4] = {};
|
||||
int* pn = n;
|
||||
a.Perform(make_tuple(true, pn));
|
||||
a.Perform(std::make_tuple(true, pn));
|
||||
EXPECT_EQ(0, n[0]);
|
||||
EXPECT_EQ(0, n[1]);
|
||||
EXPECT_EQ(0, n[2]);
|
||||
@@ -679,7 +677,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithConvertibleType) {
|
||||
|
||||
int codes[4] = { 111, 222, 333, 444 };
|
||||
int* pcodes = codes;
|
||||
a.Perform(make_tuple(true, pcodes));
|
||||
a.Perform(std::make_tuple(true, pcodes));
|
||||
EXPECT_EQ(97, codes[0]);
|
||||
EXPECT_EQ(98, codes[1]);
|
||||
EXPECT_EQ(99, codes[2]);
|
||||
@@ -693,17 +691,17 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithIteratorArgument) {
|
||||
Action<MyFunction> a = SetArrayArgument<1>(letters.begin(), letters.end());
|
||||
|
||||
std::string s;
|
||||
a.Perform(make_tuple(true, back_inserter(s)));
|
||||
a.Perform(std::make_tuple(true, back_inserter(s)));
|
||||
EXPECT_EQ(letters, s);
|
||||
}
|
||||
|
||||
TEST(ReturnPointeeTest, Works) {
|
||||
int n = 42;
|
||||
const Action<int()> a = ReturnPointee(&n);
|
||||
EXPECT_EQ(42, a.Perform(make_tuple()));
|
||||
EXPECT_EQ(42, a.Perform(std::make_tuple()));
|
||||
|
||||
n = 43;
|
||||
EXPECT_EQ(43, a.Perform(make_tuple()));
|
||||
EXPECT_EQ(43, a.Perform(std::make_tuple()));
|
||||
}
|
||||
|
||||
} // namespace gmock_generated_actions_test
|
||||
|
||||
Reference in New Issue
Block a user