PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::cyclic::CyclicControllerConformanceTest Class Reference

Test fixture for cyclic controller protocol conformance. More...

+ Inheritance diagram for profinet::cyclic::CyclicControllerConformanceTest:
+ Collaboration diagram for profinet::cyclic::CyclicControllerConformanceTest:

Protected Member Functions

void SetUp () override
 
void InvokeTransition (profinet::cyclic::CyclicState state)
 
void InvokeTxCycle ()
 
void InvokeProcessInputFrame (const Bytes &data)
 

Static Protected Member Functions

static profinet::rt::IOCRConfig MakeInputIocr ()
 Construct the input IOCR used by the regression tests.
 
static profinet::rt::IOCRConfig MakeOutputIocr ()
 Construct the output IOCR used by the regression tests.
 
static std::unique_ptr< profinet::cyclic::CyclicController > MakeController ()
 Construct the cyclic controller under test.
 
static profinet::Bytes BuildInputFrame (bool vlan=false, std::uint8_t transferStatus=0, profinet::Bytes payload={})
 Build a device-to-controller cyclic RT Ethernet frame.
 

Protected Attributes

std::unique_ptr< CyclicController > controller
 The controller under test used to verify the private functionality.
 

Detailed Description

Test fixture for cyclic controller protocol conformance.

Provides a deterministic input and output IOCR configuration and helper functions for constructing cyclic RT Ethernet frames.

Definition at line 43 of file test_cyclicControllerConformance.cpp.

Member Function Documentation

◆ BuildInputFrame()

static profinet::Bytes profinet::cyclic::CyclicControllerConformanceTest::BuildInputFrame ( bool  vlan = false,
std::uint8_t  transferStatus = 0,
profinet::Bytes  payload = {} 
)
inlinestaticprotected

Build a device-to-controller cyclic RT Ethernet frame.

Creates an input IOCR frame using FrameID 0xC001. A VLAN tag can be inserted to verify that the RT parser does not assume a fixed EtherType offset.

Parameters
vlanWhether an 802.1Q priority tag is included.
transferStatusTransferStatus byte to place in the RT header.
payloadRT payload. A default payload is generated when empty.
Returns
Complete Ethernet frame.

Definition at line 148 of file test_cyclicControllerConformance.cpp.

◆ InvokeProcessInputFrame()

void profinet::cyclic::CyclicControllerConformanceTest::InvokeProcessInputFrame ( const Bytes &  data)
inlineprotected

Definition at line 61 of file test_cyclicControllerConformance.cpp.

References controller.

◆ InvokeTransition()

void profinet::cyclic::CyclicControllerConformanceTest::InvokeTransition ( profinet::cyclic::CyclicState  state)
inlineprotected

Definition at line 51 of file test_cyclicControllerConformance.cpp.

References controller.

◆ InvokeTxCycle()

void profinet::cyclic::CyclicControllerConformanceTest::InvokeTxCycle ( )
inlineprotected

Definition at line 56 of file test_cyclicControllerConformance.cpp.

References controller.

◆ MakeController()

static std::unique_ptr< profinet::cyclic::CyclicController > profinet::cyclic::CyclicControllerConformanceTest::MakeController ( )
inlinestaticprotected

Construct the cyclic controller under test.

Returns
Configured cyclic controller.

Definition at line 124 of file test_cyclicControllerConformance.cpp.

References ioContext, MakeInputIocr(), and MakeOutputIocr().

Referenced by SetUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeInputIocr()

static profinet::rt::IOCRConfig profinet::cyclic::CyclicControllerConformanceTest::MakeInputIocr ( )
inlinestaticprotected

Construct the input IOCR used by the regression tests.

Returns
Configured input IOCR.

Definition at line 72 of file test_cyclicControllerConformance.cpp.

References profinet::rt::IOCRConfig::dataLength, profinet::rt::IOCRConfig::frameId, profinet::rt::IOCR_TYPE_INPUT, profinet::rt::IOCRConfig::objects, profinet::rt::IOCRConfig::reductionRatio, profinet::rt::IOCRConfig::referenceIOCR, profinet::rt::IOCRConfig::sendClockFactor, profinet::rt::IODataObject::slot, profinet::rt::IOCRConfig::typeIOCR, and profinet::rt::IOCRConfig::watchdogFactor.

Referenced by MakeController().

+ Here is the caller graph for this function:

◆ MakeOutputIocr()

static profinet::rt::IOCRConfig profinet::cyclic::CyclicControllerConformanceTest::MakeOutputIocr ( )
inlinestaticprotected

Construct the output IOCR used by the regression tests.

Returns
Configured output IOCR.

Definition at line 97 of file test_cyclicControllerConformance.cpp.

References profinet::rt::IOCRConfig::dataLength, profinet::rt::IOCRConfig::frameId, profinet::rt::IOCR_TYPE_OUTPUT, profinet::rt::IOCRConfig::objects, profinet::rt::IOCRConfig::reductionRatio, profinet::rt::IOCRConfig::sendClockFactor, profinet::rt::IODataObject::slot, profinet::rt::IOCRConfig::typeIOCR, and profinet::rt::IOCRConfig::watchdogFactor.

Referenced by MakeController().

+ Here is the caller graph for this function:

◆ SetUp()

void profinet::cyclic::CyclicControllerConformanceTest::SetUp ( )
inlineoverrideprotected

Definition at line 46 of file test_cyclicControllerConformance.cpp.

References controller, and MakeController().

+ Here is the call graph for this function:

Member Data Documentation

◆ controller

std::unique_ptr<CyclicController> profinet::cyclic::CyclicControllerConformanceTest::controller
protected

The controller under test used to verify the private functionality.

Definition at line 67 of file test_cyclicControllerConformance.cpp.

Referenced by InvokeProcessInputFrame(), InvokeTransition(), InvokeTxCycle(), and SetUp().


The documentation for this class was generated from the following file: