MCPcopy Create free account
hub / github.com/DISTORTEC/distortos / testTryPopWhenEmpty

Function testTryPopWhenEmpty

test/Queue/QueueOperationsTestCase.cpp:72–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 */
71
72bool testTryPopWhenEmpty(const QueueWrapper& queueWrapper)
73{
74 // queue is empty, so tryPop(T&) should fail immediately
75 OperationCountingType::resetCounters();
76 waitForNextTick();
77 const auto start = TickClock::now();
78 uint8_t priority {};
79 OperationCountingType testValue {}; // 1 construction
80 const auto ret = queueWrapper.tryPop(priority, testValue);
81 return ret == EAGAIN && TickClock::now() == start && queueWrapper.checkCounters(1, 0, 0, 0, 0, 0, 0) == true;
82}
83
84/**
85 * \brief Tests QueueWrapper::tryPop() when queue is not empty - it must succeed immediately

Callers 3

phase1Function · 0.85
phase2Function · 0.85
phase3Function · 0.85

Calls 3

waitForNextTickFunction · 0.85
tryPopMethod · 0.45
checkCountersMethod · 0.45

Tested by

no test coverage detected