distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp} Namespace Reference

Typedefs

using SequencePoints = std::pair< unsigned int, unsigned int >
 pair of sequence points More...
 
using TestThreadFunction = void(SequenceAsserter &, SequencePoints, const QueueWrapper &)
 type of test thread function More...
 
using Prepare = void(const QueueWrapper &)
 function executed to prepare queue for test More...
 
using Trigger = bool(const QueueWrapper &, size_t, const ThreadParameters &)
 function executed on queue to trigger unblocking of test thread More...
 
using FinalCheck = bool(const QueueWrapper &)
 function with final check of queue's contents after all test threads are terminated More...
 
using Stage = std::tuple< const TestThreadFunction &, const Prepare *const, const Trigger *const, const FinalCheck *const >
 tuple with functions for one stage, Prepare and FinalCheck may be nullptr More...
 

Functions

bool popFinalCheck (const QueueWrapper &queueWrapper)
 Final check for "pop" stage. More...
 
void popPrepare (const QueueWrapper &queueWrapper)
 Prepares queue for "pop" stage - just fills it completely with increasing values. More...
 
void popThread (SequenceAsserter &sequenceAsserter, const SequencePoints sequencePoints, const QueueWrapper &queueWrapper)
 QueueWrapper::pop() test thread. More...
 
bool popTrigger (const QueueWrapper &queueWrapper, const size_t i, const ThreadParameters &)
 Trigger action with QueueWrapper::pop(). More...
 
void pushThread (SequenceAsserter &sequenceAsserter, const SequencePoints sequencePoints, const QueueWrapper &queueWrapper)
 QueueWrapper::push() test thread. More...
 
bool pushTrigger (const QueueWrapper &queueWrapper, size_t, const ThreadParameters &threadParameters)
 Trigger action with QueueWrapper::push(). More...
 
DynamicThread makeTestThread (const TestThreadFunction &testThreadFunction, const unsigned int firstSequencePoint, const ThreadParameters &threadParameters, SequenceAsserter &sequenceAsserter, const QueueWrapper &queueWrapper)
 Builder of test threads. More...
 

Variables

constexpr bool falseTrue [] {false, true}
 array with "false" and "true" bool values More...
 
constexpr size_t testThreadStackSize {512}
 size of stack for test thread, bytes More...
 
const std::array< Stage, 2 > stages
 test stages More...
 

Typedef Documentation

◆ FinalCheck

using distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::FinalCheck = typedef bool(const QueueWrapper&)

function with final check of queue's contents after all test threads are terminated

◆ Prepare

using distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::Prepare = typedef void(const QueueWrapper&)

function executed to prepare queue for test

◆ SequencePoints

using distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::SequencePoints = typedef std::pair<unsigned int, unsigned int>

pair of sequence points

◆ Stage

using distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::Stage = typedef std::tuple<const TestThreadFunction&, const Prepare* const, const Trigger* const, const FinalCheck* const>

tuple with functions for one stage, Prepare and FinalCheck may be nullptr

◆ TestThreadFunction

using distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::TestThreadFunction = typedef void(SequenceAsserter&, SequencePoints, const QueueWrapper&)

type of test thread function

◆ Trigger

using distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::Trigger = typedef bool(const QueueWrapper&, size_t, const ThreadParameters&)

function executed on queue to trigger unblocking of test thread

Function Documentation

◆ makeTestThread()

DynamicThread distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::makeTestThread ( const TestThreadFunction testThreadFunction,
const unsigned int  firstSequencePoint,
const ThreadParameters threadParameters,
SequenceAsserter sequenceAsserter,
const QueueWrapper queueWrapper 
)

Builder of test threads.

Parameters
[in]testThreadFunctionis a reference to function that will be used in test thread
[in]firstSequencePointis the first sequence point for this instance - equal to the order in which this thread will be started
[in]threadParametersis a reference to ThreadParameters object
[in]sequenceAsserteris a reference to SequenceAsserter shared object
[in]queueWrapperis a reference to shared QueueWrapper object
Returns
constructed DynamicThread object
Here is the call graph for this function:
Here is the caller graph for this function:

◆ popFinalCheck()

bool distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::popFinalCheck ( const QueueWrapper queueWrapper)

Final check for "pop" stage.

The queue should contain "first" sequence points of test threads in decreasing order (priority is the same as value).

Parameters
[in]queueWrapperis a reference to shared QueueWrapper object
Returns
true if final check succeeded, false otherwise
Here is the call graph for this function:

◆ popPrepare()

void distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::popPrepare ( const QueueWrapper queueWrapper)

Prepares queue for "pop" stage - just fills it completely with increasing values.

Parameters
[in]queueWrapperis a reference to shared QueueWrapper object
Here is the call graph for this function:

◆ popThread()

void distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::popThread ( SequenceAsserter sequenceAsserter,
const SequencePoints  sequencePoints,
const QueueWrapper queueWrapper 
)

QueueWrapper::pop() test thread.

Marks the first sequence point in SequenceAsserter, waits for the last sequence point from message queue and marks it in SequenceAsserter.

Parameters
[in]sequenceAsserteris a reference to SequenceAsserter shared object
[in]sequencePointsis a pair of sequence points for this instance (second one is ignored)
[in]queueWrapperis a reference to shared QueueWrapper object
Here is the call graph for this function:

◆ popTrigger()

bool distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::popTrigger ( const QueueWrapper queueWrapper,
const size_t  i,
const ThreadParameters  
)

Trigger action with QueueWrapper::pop().

Parameters
[in]queueWrapperis a reference to shared QueueWrapper object
[in]iis the iteration counter
[in]threadParametersis a reference to ThreadParameters object
Returns
true if trigger check succeeded, false otherwise
Here is the call graph for this function:

◆ pushThread()

void distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::pushThread ( SequenceAsserter sequenceAsserter,
const SequencePoints  sequencePoints,
const QueueWrapper queueWrapper 
)

QueueWrapper::push() test thread.

Marks the first sequence point in SequenceAsserter, waits for free space in message queue to send this first sequence point (with priority equal to the value) and marks last sequence point in SequenceAsserter.

Parameters
[in]sequenceAsserteris a reference to SequenceAsserter shared object
[in]sequencePointsis a pair of sequence points for this instance
[in]queueWrapperis a reference to shared QueueWrapper object
Here is the call graph for this function:

◆ pushTrigger()

bool distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::pushTrigger ( const QueueWrapper queueWrapper,
size_t  ,
const ThreadParameters threadParameters 
)

Trigger action with QueueWrapper::push().

Parameters
[in]queueWrapperis a reference to shared QueueWrapper object
[in]iis the iteration counter
[in]threadParametersis a reference to ThreadParameters object
Returns
true if trigger check succeeded, false otherwise
Here is the call graph for this function:

Variable Documentation

◆ falseTrue

constexpr bool distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::falseTrue[] {false, true}

array with "false" and "true" bool values

◆ stages

const std::array<Stage, 2> distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::stages
Initial value:
{{
Stage{popThread, nullptr, pushTrigger, nullptr},
}}
void pushThread(SequenceAsserter &sequenceAsserter, const SequencePoints sequencePoints, const QueueWrapper &queueWrapper)
QueueWrapper::push() test thread.
Definition: MessageQueuePriorityTestCase.cpp:159
void popThread(SequenceAsserter &sequenceAsserter, const SequencePoints sequencePoints, const QueueWrapper &queueWrapper)
QueueWrapper::pop() test thread.
Definition: MessageQueuePriorityTestCase.cpp:119
std::tuple< const TestThreadFunction &, const Prepare *const, const Trigger *const, const FinalCheck *const > Stage
tuple with functions for one stage, Prepare and FinalCheck may be nullptr
Definition: MessageQueuePriorityTestCase.cpp:65
bool popTrigger(const QueueWrapper &queueWrapper, const size_t i, const ThreadParameters &)
Trigger action with QueueWrapper::pop().
Definition: MessageQueuePriorityTestCase.cpp:139
void popPrepare(const QueueWrapper &queueWrapper)
Prepares queue for "pop" stage - just fills it completely with increasing values. ...
Definition: MessageQueuePriorityTestCase.cpp:102
bool popFinalCheck(const QueueWrapper &queueWrapper)
Final check for "pop" stage.
Definition: MessageQueuePriorityTestCase.cpp:81
bool pushTrigger(const QueueWrapper &queueWrapper, size_t, const ThreadParameters &threadParameters)
Trigger action with QueueWrapper::push().
Definition: MessageQueuePriorityTestCase.cpp:178

test stages

◆ testThreadStackSize

constexpr size_t distortos::test::anonymous_namespace{MessageQueuePriorityTestCase.cpp}::testThreadStackSize {512}

size of stack for test thread, bytes