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

Unit tests for common PROFINET utility, address, and timeout helpers. More...

#include <gtest/gtest.h>
#include "profinet/exceptions.h"
#include "profinet/util.h"
+ Include dependency graph for test_util.cpp:

Go to the source code of this file.

Namespaces

namespace  profinet
 

Functions

 profinet::TEST (UtilTest, Mac2SS2MacRoundtrip)
 
 profinet::TEST (UtilTest, S2MacRejectsMalformedInput)
 
 profinet::TEST (UtilTest, Ip2SS2IpRoundtrip)
 
 profinet::TEST (UtilTest, Ip2SRejectsMalformedInput)
 
 profinet::TEST (UtilTest, ToHexEncodesBytes)
 
 profinet::TEST (UtilTest, DecodeBytesStripsTrailingNuls)
 
 profinet::TEST (UtilTest, MaxTimeoutReportsElapsed)
 
 profinet::TEST (UtilTest, ByteSwapU16)
 
 profinet::TEST (UtilTest, ByteSwapU32)
 
 profinet::TEST (UtilTest, ByteSwapU64)
 
 profinet::TEST (UtilTest, ByteSwapU8)
 
 profinet::TEST (UtilTest, ByteAtU8)
 
 profinet::TEST (UtilTest, ByteAtU16)
 
 profinet::TEST (UtilTest, ByteAtU32)
 
 profinet::TEST (UtilTest, ByteAtU64)
 

Detailed Description

Unit tests for common PROFINET utility, address, and timeout helpers.

Verifies byte conversion, MAC and IPv4 address conversion, hexadecimal encoding, byte-string decoding, and timeout handling provided by util.h.

The tests cover:

  • MAC address string conversion and round-trip formatting.
  • Rejection of malformed MAC address strings.
  • IPv4 address string conversion and round-trip formatting.
  • Rejection of malformed IPv4 address strings.
  • Hexadecimal encoding of byte buffers.
  • Removal of trailing NUL bytes when decoding byte buffers.
  • Detection of an already elapsed MaxTimeout.

Definition in file test_util.cpp.