PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
test_cyclic.cpp File Reference

Unit tests for the PROFINET RTC1 cyclic IO controller. More...

#include <gtest/gtest.h>
#include <chrono>
#include <future>
#include <thread>
#include "mocks/cyclic_raw_ethernet_socket_stub.h"
#include "mocks/mockRawEthernetSocket.h"
#include "profinet/cyclic.h"
+ Include dependency graph for test_cyclic.cpp:

Go to the source code of this file.

Classes

class  profinet::cyclic::CyclicTest
 

Namespaces

namespace  profinet
 
namespace  profinet::cyclic
 

Functions

 profinet::cyclic::TEST_F (CyclicTest, CyclicStateToStringCoversAllStates)
 
 profinet::cyclic::TEST_F (CyclicTest, CyclicStatsResetRestoresInitialValues)
 
 profinet::cyclic::TEST_F (CyclicTest, CyclicControllerRejectsNegativeMaxConsecutiveTimeouts)
 
 profinet::cyclic::TEST_F (CyclicTest, CyclicControllerRejectsSub1msCycleTime)
 
 profinet::cyclic::TEST_F (CyclicTest, CyclicControllerConstructsWithSafeCycleTime)
 

Detailed Description

Unit tests for the PROFINET RTC1 cyclic IO controller.

Verifies lifecycle state handling, cyclic communication statistics, configuration validation, and basic end-to-end cyclic frame exchange provided by cyclic.h.

The tests cover:

  • Conversion of CyclicState values to human-readable names.
  • Resetting CyclicStats to their initial values.
  • Rejection of negative watchdog timeout limits.
  • Rejection of cycle times below the minimum supported 1 ms.
  • Construction of a controller with a valid cycle time.
  • Initial controller state and running status.
  • End-to-end cyclic frame transmission and reception over a loopback interface, including process-data exchange and communication statistics.

The end-to-end loopback test is disabled by default because it requires raw Ethernet socket privileges and is intended for environments where the test executable requires appropriate administrator/root privileges or packet-capture permissions for the selected network interface.

Definition in file test_cyclic.cpp.