MCPcopy Create free account
hub / github.com/apache/mesos / TEST

Function TEST

3rdparty/stout/tests/lambda_tests.cpp:58–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57
58TEST(LambdaTest, Map)
59{
60 std::vector<int> expected = {1, 2, 3};
61
62 EXPECT_EQ(
63 expected,
64 lambda::map(
65 [](std::string s) {
66 return numify<int>(s).get();
67 },
68 std::vector<std::string>{"1", "2", "3"}));
69
70 EXPECT_EQ(
71 expected,
72 lambda::map(
73 [](const std::string& s) {
74 return numify<int>(s).get();
75 },
76 std::vector<std::string>{"1", "2", "3"}));
77
78 EXPECT_EQ(
79 expected,
80 lambda::map(
81 [](std::string&& s) {
82 return numify<int>(s).get();
83 },
84 std::vector<std::string>{"1", "2", "3"}));
85
86 std::vector<std::string> concat = {"11", "22", "33"};
87
88 EXPECT_EQ(
89 concat,
90 lambda::map(
91 [](std::string&& s) {
92 return s + s;
93 },
94 function()));
95
96 std::vector<OnlyMoveable> v;
97 v.emplace_back(1);
98 v.emplace_back(2);
99
100 std::vector<OnlyMoveable> result = lambda::map(
101 [](OnlyMoveable&& o) {
102 o.j = o.i;
103 return std::move(o);
104 },
105 std::move(v));
106
107 for (const OnlyMoveable& o : result) {
108 EXPECT_EQ(o.i, o.j);
109 }
110}
111
112
113TEST(LambdaTest, Zip)

Callers

nothing calls this directly

Calls 9

mapFunction · 0.85
functionFunction · 0.85
zipFunction · 0.85
OnlyMoveableClass · 0.85
EXPECT_CALL_INVALIDFunction · 0.85
atMethod · 0.80
ObjectClass · 0.70
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected