| 1170 | +---------------------------------------------------------------------------------------------------------------------*/ |
| 1171 | |
| 1172 | bool QueueOperationsTestCase::run_() const |
| 1173 | { |
| 1174 | constexpr size_t nonRawQueueTypes {4}; |
| 1175 | constexpr size_t rawQueueTypes {4}; |
| 1176 | constexpr size_t queueTypes {nonRawQueueTypes + rawQueueTypes}; |
| 1177 | constexpr auto phase1ExpectedContextSwitchCount = queueTypes * |
| 1178 | (12 * waitForNextTickContextSwitchCount + 8 * phase1TryForUntilContextSwitchCount); |
| 1179 | constexpr auto phase2ExpectedContextSwitchCount = queueTypes * 36 * waitForNextTickContextSwitchCount; |
| 1180 | constexpr auto phase3ExpectedContextSwitchCount = queueTypes * (6 * waitForNextTickContextSwitchCount + |
| 1181 | 3 * phase34SoftwareTimerContextSwitchCount); |
| 1182 | constexpr auto phase4ExpectedContextSwitchCount = queueTypes * |
| 1183 | (10 * waitForNextTickContextSwitchCount + 9 * phase34SoftwareTimerContextSwitchCount); |
| 1184 | constexpr auto phase5ExpectedContextSwitchCount = rawQueueTypes * 8 * waitForNextTickContextSwitchCount; |
| 1185 | constexpr auto expectedContextSwitchCount = phase1ExpectedContextSwitchCount + phase2ExpectedContextSwitchCount + |
| 1186 | phase3ExpectedContextSwitchCount + phase4ExpectedContextSwitchCount + phase5ExpectedContextSwitchCount; |
| 1187 | |
| 1188 | const auto allocatedMemory = mallinfo().uordblks; |
| 1189 | const auto contextSwitchCount = statistics::getContextSwitchCount(); |
| 1190 | |
| 1191 | for (const auto& function : {phase1, phase2, phase3, phase4, phase5, phase6}) |
| 1192 | { |
| 1193 | const auto ret = function(); |
| 1194 | if (ret != true) |
| 1195 | return ret; |
| 1196 | |
| 1197 | if (mallinfo().uordblks != allocatedMemory) // dynamic memory must be deallocated after each test phase |
| 1198 | return false; |
| 1199 | } |
| 1200 | |
| 1201 | if (statistics::getContextSwitchCount() - contextSwitchCount != expectedContextSwitchCount) |
| 1202 | return false; |
| 1203 | |
| 1204 | return true; |
| 1205 | } |
| 1206 | |
| 1207 | } // namespace test |
| 1208 |
nothing calls this directly
no test coverage detected