MCPcopy Create free account
hub / github.com/MIT-SPARK/Kimera-VIO / TEST

Function TEST

tests/testThreadsafeQueue.cpp:50–69  ·  view source on GitHub ↗

/

Source from the content-addressed store, hash-verified

48
49/* ************************************************************************* */
50TEST(testThreadsafeQueue, popBlocking_by_reference) {
51 ThreadsafeQueue<std::string> q("test_queue");
52 std::thread p([&] {
53 q.push("Hello World!");
54 q.push("Hello World 2!");
55 });
56 std::string s;
57 q.popBlocking(s);
58 EXPECT_EQ(s, "Hello World!");
59 q.popBlocking(s);
60 EXPECT_EQ(s, "Hello World 2!");
61 q.shutdown();
62 EXPECT_FALSE(q.popBlocking(s));
63 EXPECT_EQ(s, "Hello World 2!");
64
65 // Leave some time for p to finish its work.
66 std::this_thread::sleep_for(std::chrono::milliseconds(100));
67 EXPECT_TRUE(p.joinable());
68 p.join();
69}
70
71/* ************************************************************************* */
72TEST(testThreadsafeQueue, popBlocking_by_shared_ptr) {

Callers

nothing calls this directly

Calls 5

pushMethod · 0.45
popBlockingMethod · 0.45
shutdownMethod · 0.45
resumeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected