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

Function phase5

test/Queue/QueueOperationsTestCase.cpp:1043–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1041 */
1042
1043bool phase5()
1044{
1045 for (const auto dynamic : falseTrue)
1046 for (const auto fifo : falseTrue)
1047 {
1048 // size 0, so queue is both full and empty at the same time
1049 const auto rawQueueWrapper = makeRawQueueWrapper<0>(dynamic, fifo);
1050 const uint8_t constPriority {};
1051 const OperationCountingType constTestValue {};
1052 uint8_t nonConstPriority {};
1053 OperationCountingType nonConstTestValue {};
1054
1055 {
1056 // invalid size is given, so push(..., const void*, size_t) should fail immediately
1057 waitForNextTick();
1058 const auto start = TickClock::now();
1059 const auto ret = rawQueueWrapper->push(constPriority, &constTestValue, sizeof(constTestValue) - 1);
1060 if (ret != EMSGSIZE || TickClock::now() != start)
1061 return false;
1062 }
1063
1064 {
1065 // invalid size is given, so tryPush(..., const void*, size_t) should fail immediately
1066 waitForNextTick();
1067 const auto start = TickClock::now();
1068 const auto ret = rawQueueWrapper->tryPush(constPriority, &constTestValue, sizeof(constTestValue) - 1);
1069 if (ret != EMSGSIZE || TickClock::now() != start)
1070 return false;
1071 }
1072
1073 {
1074 // invalid size is given, so tryPushFor(..., const void*, size_t) should fail immediately
1075 waitForNextTick();
1076 const auto start = TickClock::now();
1077 const auto ret = rawQueueWrapper->tryPushFor(singleDuration, constPriority, &constTestValue,
1078 sizeof(constTestValue) - 1);
1079 if (ret != EMSGSIZE || TickClock::now() != start)
1080 return false;
1081 }
1082
1083 {
1084 // invalid size is given, so tryPushUntil(..., const void*, size_t) should fail immediately
1085 waitForNextTick();
1086 const auto start = TickClock::now();
1087 const auto ret = rawQueueWrapper->tryPushUntil(TickClock::now() + singleDuration, constPriority,
1088 &constTestValue, sizeof(constTestValue) - 1);
1089 if (ret != EMSGSIZE || TickClock::now() != start)
1090 return false;
1091 }
1092
1093 {
1094 // invalid size is given, so pop(..., void*, size_t) should fail immediately
1095 waitForNextTick();
1096 const auto start = TickClock::now();
1097 const auto ret = rawQueueWrapper->pop(nonConstPriority, &nonConstTestValue,
1098 sizeof(nonConstTestValue) - 1);
1099 if (ret != EMSGSIZE || TickClock::now() != start)
1100 return false;

Callers

nothing calls this directly

Calls 9

waitForNextTickFunction · 0.85
pushMethod · 0.45
tryPushMethod · 0.45
tryPushForMethod · 0.45
tryPushUntilMethod · 0.45
popMethod · 0.45
tryPopMethod · 0.45
tryPopForMethod · 0.45
tryPopUntilMethod · 0.45

Tested by

no test coverage detected