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

Unit and loopback tests for the IPv4 UDP socket implementation. More...

#include <gtest/gtest.h>
#include <chrono>
#include <cstdint>
#include <string>
#include <vector>
#include "profinet/udpSocket.h"
#include "profinet/util.h"
+ Include dependency graph for test_udpSocket.cpp:

Go to the source code of this file.

Namespaces

namespace  profinet
 

Functions

 profinet::TEST (UdpSocketTests, RecvFromReturnsPayloadAndSourceEndpoint)
 
 profinet::TEST (UdpSocketTests, SendToSendsToSuppliedEndpoint)
 
 profinet::TEST (UdpSocketTests, RecvFromReturnsEmptyDatagramOnTimeout)
 
 profinet::TEST (UdpSocketTests, MoveConstructionTransfersSocketOwnership)
 
 profinet::TEST (UdpSocketTests, MoveAssignmentTransfersSocketOwnership)
 

Detailed Description

Unit and loopback tests for the IPv4 UDP socket implementation.

Tests the bound UDP listener functionality added for the PROFINET alarm listener. The tests use the IPv4 loopback interface and therefore do not require a physical network interface.

The tests cover:

  • Binding a UDP socket to an automatically assigned local port.
  • Receiving datagrams with their source endpoint.
  • Sending datagrams to a supplied destination endpoint.
  • Round-trip UDP communication.
  • Receive timeout behavior.
Note
These tests intentionally exercise the production UdpSocket class rather than mocking operating-system socket calls.

Definition in file test_udpSocket.cpp.