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

Unit tests for the high-level PROFINET device interface. More...

#include <gtest/gtest.h>
#include "mocks/mockAlarmListener.h"
#include "mocks/mockRPCCon.h"
#include "profinet/device.h"
+ Include dependency graph for test_device.cpp:

Go to the source code of this file.

Classes

class  profinet::device::DeviceTest
 
class  profinet::device::MockDcpScanner
 Mock implementation of IDcpScanner used to test ProfinetScanner without performing real DCP network discovery. More...
 
class  profinet::device::MockMacAddressProvider
 Mock implementation of IMacAddressProvider for unit tests. More...
 
class  profinet::device::ProfinetScannerTest
 Test fixture for ProfinetScanner. More...
 
struct  profinet::device::ProfinetScannerTest::TestScanDevice
 Test description used to construct a synthetic DCP discovery response. More...
 

Namespaces

namespace  profinet
 
namespace  profinet::device
 

Functions

 profinet::device::TEST_F (DeviceTest, ParseMacAcceptsColonDashAndDotSeparators)
 
 profinet::device::TEST_F (DeviceTest, ParseMacRejectsNonMacStrings)
 
 profinet::device::TEST_F (DeviceTest, IsMacAddressMatchesParseMac)
 
 profinet::device::TEST_F (DeviceTest, DeviceInfoHelpersReturnEmptyOrZeroWhenIm0Unset)
 
 profinet::device::TEST_F (DeviceTest, DeviceInfoHelpersExtractAndTrimIm0Fields)
 
 profinet::device::TEST_F (DeviceTest, FromDcpInfoConstructsWithoutDiscovery)
 
 profinet::device::TEST_F (DeviceTest, DiscoverWithUnknownMacThrowsDcpDeviceNotFoundError)
 
 profinet::device::TEST (DeviceMoveTests, MoveConstructionDisconnectsSource)
 
 profinet::device::TEST (DeviceMoveTests, MoveAssignmentReleasesDestinationFirst)
 
 profinet::device::TEST (DeviceMoveTests, MovedFromDeviceCanBeDestroyedSafely)
 
 profinet::device::TEST_F (ProfinetScannerTest, ScanPreservesZeroTimeout)
 
 profinet::device::TEST_F (ProfinetScannerTest, ScanPreservesShortTimeout)
 
 profinet::device::TEST_F (ProfinetScannerTest, ScanPreservesLongTimeout)
 
 profinet::device::TEST_F (ProfinetScannerTest, ScanCreatesDeviceForEveryResponse)
 
 profinet::device::TEST_F (ProfinetScannerTest, ScanDictKeepsDuplicateStationNames)
 
 profinet::device::TEST_F (ProfinetScannerTest, ScanDictKeepsEmptyStationNames)
 

Detailed Description

Unit tests for the high-level PROFINET device interface.

Verifies device helper functions, device information access, and discovery-related behavior provided by device.h.

The tests cover:

  • MAC address parsing and validation using common separator formats.
  • DeviceInfo I&M0 helper methods and field trimming.
  • Construction of ProfinetDevice instances from DCP discovery data.
  • Initial disconnected device state and human-readable device information.
  • DCP discovery failure handling when a device cannot be found.

Definition in file test_device.cpp.