summaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock-more-actions_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'googlemock/test/gmock-more-actions_test.cc')
-rw-r--r--googlemock/test/gmock-more-actions_test.cc151
1 files changed, 77 insertions, 74 deletions
diff --git a/googlemock/test/gmock-more-actions_test.cc b/googlemock/test/gmock-more-actions_test.cc
index 77e15bd..f5e28ea 100644
--- a/googlemock/test/gmock-more-actions_test.cc
+++ b/googlemock/test/gmock-more-actions_test.cc
@@ -94,12 +94,12 @@ const char* Plus1(const char* s) { return s + 1; }
void VoidUnary(int /* n */) { g_done = true; }
-bool ByConstRef(const string& s) { return s == "Hi"; }
+bool ByConstRef(const std::string& s) { return s == "Hi"; }
const double g_double = 0;
bool ReferencesGlobalDouble(const double& x) { return &x == &g_double; }
-string ByNonConstRef(string& s) { return s += "+"; } // NOLINT
+std::string ByNonConstRef(std::string& s) { return s += "+"; } // NOLINT
struct UnaryFunctor {
int operator()(bool x) { return x ? 1 : -1; }
@@ -119,9 +119,9 @@ int SumOfFirst2(int a, int b, Unused, Unused) { return a + b; }
void VoidFunctionWithFourArguments(char, int, float, double) { g_done = true; }
-string Concat4(const char* s1, const char* s2, const char* s3,
- const char* s4) {
- return string(s1) + s2 + s3 + s4;
+std::string Concat4(const char* s1, const char* s2, const char* s3,
+ const char* s4) {
+ return std::string(s1) + s2 + s3 + s4;
}
int SumOf5(int a, int b, int c, int d, int e) { return a + b + c + d + e; }
@@ -132,9 +132,9 @@ struct SumOf5Functor {
}
};
-string Concat5(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5) {
- return string(s1) + s2 + s3 + s4 + s5;
+std::string Concat5(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5) {
+ return std::string(s1) + s2 + s3 + s4 + s5;
}
int SumOf6(int a, int b, int c, int d, int e, int f) {
@@ -147,34 +147,34 @@ struct SumOf6Functor {
}
};
-string Concat6(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6) {
- return string(s1) + s2 + s3 + s4 + s5 + s6;
+std::string Concat6(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6;
}
-string Concat7(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
+std::string Concat7(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
}
-string Concat8(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
+std::string Concat8(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
}
-string Concat9(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
+std::string Concat9(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
}
-string Concat10(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9,
- const char* s10) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
+std::string Concat10(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9,
+ const char* s10) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
}
class Foo {
@@ -185,7 +185,7 @@ class Foo {
short Unary(long x) { return static_cast<short>(value_ + x); } // NOLINT
- string Binary(const string& str, char c) const { return str + c; }
+ std::string Binary(const std::string& str, char c) const { return str + c; }
int Ternary(int x, bool y, char z) { return value_ + x + y*z; }
@@ -201,29 +201,29 @@ class Foo {
return a + b + c + d + e + f;
}
- string Concat7(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
+ std::string Concat7(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
}
- string Concat8(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
+ std::string Concat8(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
}
- string Concat9(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
+ std::string Concat9(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
}
- string Concat10(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9,
- const char* s10) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
+ std::string Concat10(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9,
+ const char* s10) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
}
private:
@@ -280,9 +280,9 @@ inline const char* CharPtr(const char* s) { return s; }
// Tests using Invoke() with a 7-argument function.
TEST(InvokeTest, FunctionThatTakes7Arguments) {
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*)> a =
- Invoke(Concat7);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ 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"),
@@ -291,9 +291,9 @@ TEST(InvokeTest, FunctionThatTakes7Arguments) {
// Tests using Invoke() with a 8-argument function.
TEST(InvokeTest, FunctionThatTakes8Arguments) {
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*)> a =
- Invoke(Concat8);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ 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"),
@@ -302,9 +302,10 @@ TEST(InvokeTest, FunctionThatTakes8Arguments) {
// Tests using Invoke() with a 9-argument function.
TEST(InvokeTest, FunctionThatTakes9Arguments) {
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*,
- const char*)> a = Invoke(Concat9);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ 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"),
@@ -313,9 +314,10 @@ TEST(InvokeTest, FunctionThatTakes9Arguments) {
// Tests using Invoke() with a 10-argument function.
TEST(InvokeTest, FunctionThatTakes10Arguments) {
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*,
- const char*, const char*)> a = Invoke(Concat10);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*,
+ 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"),
@@ -339,8 +341,7 @@ TEST(InvokeTest, FunctionWithUnusedParameters) {
// Tests using Invoke() with methods with parameters declared as Unused.
TEST(InvokeTest, MethodWithUnusedParameters) {
Foo foo;
- Action<int(string, bool, int, int)> a1 =
- Invoke(&foo, &Foo::SumOfLast2);
+ Action<int(std::string, bool, int, int)> a1 = Invoke(&foo, &Foo::SumOfLast2);
EXPECT_EQ(12, a1.Perform(make_tuple(CharPtr("hi"), true, 10, 2)));
Action<int(char, double, int, int)> a2 =
@@ -417,9 +418,9 @@ TEST(InvokeMethodTest, MethodThatTakes6Arguments) {
// Tests using Invoke() with a 7-argument method.
TEST(InvokeMethodTest, MethodThatTakes7Arguments) {
Foo foo;
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*)> a =
- Invoke(&foo, &Foo::Concat7);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ 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"),
@@ -429,9 +430,9 @@ TEST(InvokeMethodTest, MethodThatTakes7Arguments) {
// Tests using Invoke() with a 8-argument method.
TEST(InvokeMethodTest, MethodThatTakes8Arguments) {
Foo foo;
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*)> a =
- Invoke(&foo, &Foo::Concat8);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ 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"),
@@ -441,9 +442,10 @@ TEST(InvokeMethodTest, MethodThatTakes8Arguments) {
// Tests using Invoke() with a 9-argument method.
TEST(InvokeMethodTest, MethodThatTakes9Arguments) {
Foo foo;
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*,
- const char*)> a = Invoke(&foo, &Foo::Concat9);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ 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"),
@@ -453,9 +455,10 @@ TEST(InvokeMethodTest, MethodThatTakes9Arguments) {
// Tests using Invoke() with a 10-argument method.
TEST(InvokeMethodTest, MethodThatTakes10Arguments) {
Foo foo;
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*,
- const char*, const char*)> a = Invoke(&foo, &Foo::Concat10);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*,
+ 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"),
@@ -495,8 +498,8 @@ TEST(ReturnArgActionTest, WorksForMultiArgBoolArg0) {
}
TEST(ReturnArgActionTest, WorksForMultiArgStringArg2) {
- const Action<string(int, int, string, int)> a = ReturnArg<2>();
- EXPECT_EQ("seven", a.Perform(make_tuple(5, 6, string("seven"), 8)));
+ 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)));
}
TEST(SaveArgActionTest, WorksForSameType) {