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

Test fixture for Layer 2 RTA alarm handling. More...

+ Inheritance diagram for profinet::AlarmListenerRtaTest:
+ Collaboration diagram for profinet::AlarmListenerRtaTest:

Protected Member Functions

void SetUp () override
 Construct the test listener with a mocked raw Ethernet socket.
 
void Feed (Bytes frame)
 Inject one Ethernet frame into the listener.
 

Static Protected Member Functions

static SentRtaFrame ParseSentFrame (std::span< const std::uint8_t > frame)
 Return all transmitted RTA frames.
 

Protected Attributes

std::unique_ptr< testing::StrictMock< MockRawEthernetSocket > > socket
 Mock Ethernet transport pointer owned by the listener.
 
StrictMock< MockRawEthernetSocket > * mockSocket = nullptr
 Mock Ethernet transport owned by the listener.
 
std::unique_ptr< AlarmListener > listener
 Listener under test.
 
std::unique_ptr< asio::io_context > ioContext
 Shared ASIO context.
 

Detailed Description

Test fixture for Layer 2 RTA alarm handling.

Provides a mocked Ethernet transport and deterministic AlarmEndpoint configuration. Frames are injected directly into the listener's Layer 2 receive path without starting a background thread.

Definition at line 262 of file test_alarmListenerRta.cpp.

Member Function Documentation

◆ Feed()

void profinet::AlarmListenerRtaTest::Feed ( Bytes  frame)
inlineprotected

Inject one Ethernet frame into the listener.

Parameters
frameComplete Ethernet frame returned by the mock socket.

Definition at line 286 of file test_alarmListenerRta.cpp.

References frame, profinet::AlarmListenerTestAccess::HandleLayer2Frame(), listener, and mockSocket.

+ Here is the call graph for this function:

◆ ParseSentFrame()

static SentRtaFrame profinet::AlarmListenerRtaTest::ParseSentFrame ( std::span< const std::uint8_t >  frame)
inlinestaticprotected

Return all transmitted RTA frames.

This helper is intentionally based on GoogleMock's expectations through individual tests. It is provided as a common seam for future tests once a frame-capture mock is added.

Definition at line 299 of file test_alarmListenerRta.cpp.

References frame.

◆ SetUp()

void profinet::AlarmListenerRtaTest::SetUp ( )
inlineoverrideprotected

Construct the test listener with a mocked raw Ethernet socket.

Definition at line 266 of file test_alarmListenerRta.cpp.

References profinet::AlarmEndpoint::controllerRef, profinet::AlarmEndpoint::deviceMac, profinet::AlarmEndpoint::deviceRef, profinet::AlarmEndpoint::interface, ioContext, listener, mockSocket, profinet::AlarmListenerTestAccess::SetSock(), socket, and profinet::AlarmEndpoint::transport.

+ Here is the call graph for this function:

Member Data Documentation

◆ ioContext

std::unique_ptr<asio::io_context> profinet::AlarmListenerRtaTest::ioContext
protected

Shared ASIO context.

Definition at line 313 of file test_alarmListenerRta.cpp.

Referenced by SetUp().

◆ listener

std::unique_ptr<AlarmListener> profinet::AlarmListenerRtaTest::listener
protected

Listener under test.

Definition at line 310 of file test_alarmListenerRta.cpp.

Referenced by Feed(), and SetUp().

◆ mockSocket

StrictMock<MockRawEthernetSocket>* profinet::AlarmListenerRtaTest::mockSocket = nullptr
protected

Mock Ethernet transport owned by the listener.

Definition at line 307 of file test_alarmListenerRta.cpp.

Referenced by Feed(), and SetUp().

◆ socket

std::unique_ptr<testing::StrictMock<MockRawEthernetSocket> > profinet::AlarmListenerRtaTest::socket
protected

Mock Ethernet transport pointer owned by the listener.

Definition at line 304 of file test_alarmListenerRta.cpp.

Referenced by SetUp().


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