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

Function TEST

3rdparty/libprocess/src/tests/collect_tests.cpp:29–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27using std::vector;
28
29TEST(CollectTest, Ready)
30{
31 // First ensure an empty list functions correctly.
32 vector<Future<int>> empty;
33 Future<vector<int>> collect = process::collect(empty);
34
35 AWAIT_READY(collect);
36 EXPECT_TRUE(collect->empty());
37
38 Promise<int> promise1;
39 Promise<int> promise2;
40 Promise<int> promise3;
41 Promise<int> promise4;
42
43 vector<Future<int>> futures = {
44 promise1.future(),
45 promise2.future(),
46 promise3.future(),
47 promise4.future(),
48 };
49
50 // Set them out-of-order.
51 promise4.set(4);
52 promise2.set(2);
53 promise1.set(1);
54 promise3.set(3);
55
56 collect = process::collect(futures);
57
58 AWAIT_ASSERT_READY(collect);
59
60 vector<int> values = {1, 2, 3, 4};
61
62 // We expect them to be returned in the same order as the
63 // future list that was passed in.
64 EXPECT_EQ(values, collect.get());
65}
66
67
68TEST(CollectTest, Failure)

Callers

nothing calls this directly

Calls 15

collectFunction · 0.85
fooFunction · 0.85
isAbandonedMethod · 0.80
isReadyMethod · 0.80
isFailedMethod · 0.80
isDiscardedMethod · 0.80
hasDiscardMethod · 0.80
awaitFunction · 0.50
stringifyClass · 0.50
emptyMethod · 0.45
futureMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected