| 635 | */ |
| 636 | |
| 637 | bool phase3() |
| 638 | { |
| 639 | for (const auto dynamic : falseTrue) |
| 640 | for (const auto raw : falseTrue) |
| 641 | for (const auto fifo : falseTrue) |
| 642 | { |
| 643 | const auto queueWrapper = makeQueueWrapper<1>(dynamic, raw, fifo); |
| 644 | uint8_t sharedMagicPriority {}; |
| 645 | OperationCountingType sharedMagicValue {}; |
| 646 | auto softwareTimer = makeStaticSoftwareTimer( |
| 647 | [&queueWrapper, &sharedMagicPriority, &sharedMagicValue]() |
| 648 | { |
| 649 | queueWrapper->tryPush(sharedMagicPriority, sharedMagicValue); |
| 650 | }); |
| 651 | |
| 652 | { |
| 653 | OperationCountingType::resetCounters(); |
| 654 | waitForNextTick(); |
| 655 | |
| 656 | const auto contextSwitchCount = statistics::getContextSwitchCount(); |
| 657 | const auto wakeUpTimePoint = TickClock::now() + longDuration; |
| 658 | sharedMagicPriority = 0x93; |
| 659 | // 1 construction, 1 move assignment, 1 destruction |
| 660 | sharedMagicValue = OperationCountingType{0x2f5be1a4}; |
| 661 | softwareTimer.start(wakeUpTimePoint); // in timer: 1 copy construction |
| 662 | |
| 663 | // queue is currently empty, but pop() should succeed at expected time |
| 664 | uint8_t priority {}; |
| 665 | OperationCountingType testValue {}; // 1 construction |
| 666 | const auto ret = queueWrapper->pop(priority, testValue); // 1 swap, 1 destruction |
| 667 | const auto wokenUpTimePoint = TickClock::now(); |
| 668 | if (ret != 0 || wakeUpTimePoint != wokenUpTimePoint || |
| 669 | queueWrapper->check(sharedMagicPriority, sharedMagicValue, priority, testValue) == false || |
| 670 | queueWrapper->checkCounters(2, 1, 0, 2, 0, 1, 1) != true || |
| 671 | statistics::getContextSwitchCount() - contextSwitchCount != |
| 672 | phase34SoftwareTimerContextSwitchCount) |
| 673 | return false; |
| 674 | } |
| 675 | |
| 676 | { |
| 677 | const auto ret = testTryPopWhenEmpty(*queueWrapper); |
| 678 | if (ret != true) |
| 679 | return ret; |
| 680 | } |
| 681 | |
| 682 | { |
| 683 | OperationCountingType::resetCounters(); |
| 684 | waitForNextTick(); |
| 685 | |
| 686 | const auto contextSwitchCount = statistics::getContextSwitchCount(); |
| 687 | const auto wakeUpTimePoint = TickClock::now() + longDuration; |
| 688 | sharedMagicPriority = 0x01; |
| 689 | // 1 construction, 1 move assignment, 1 destruction |
| 690 | sharedMagicValue = OperationCountingType{0xc1fe105a}; |
| 691 | softwareTimer.start(wakeUpTimePoint); // in timer: 1 copy construction |
| 692 | |
| 693 | // queue is currently empty, but tryPopFor() should succeed at expected time |
| 694 | uint8_t priority {}; |
nothing calls this directly
no test coverage detected