Files
2026-07-01 16:39:34 +02:00

158 lines
5.2 KiB
C++

/**
* @file UDPStreamerClientTest.h
* @brief Header file for class UDPStreamerClientTest
* @date 01/07/2026
* @author Martino Ferrari
*
* @copyright Copyright 2015 F4E | European Joint Undertaking for ITER and
* the Development of Fusion Energy ('Fusion for Energy').
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved
* by the European Commission - subsequent versions of the EUPL (the "Licence")
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
*
* @warning Unless required by applicable law or agreed to in writing,
* software distributed under the Licence is distributed on an "AS IS"
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the Licence permissions and limitations under the Licence.
*
* @details This header file contains the declaration of the class UDPStreamerClientTest
* with all of its public, protected and private members. It may also include
* definitions for inline methods which need to be visible to the compiler.
*/
#ifndef UDPSTREAMERCLIENTTEST_H_
#define UDPSTREAMERCLIENTTEST_H_
/*---------------------------------------------------------------------------*/
/* Standard header includes */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Project header includes */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Class declaration */
/*---------------------------------------------------------------------------*/
/**
* @brief Tests the UDPStreamerClient DataSource public methods.
*/
class UDPStreamerClientTest {
public:
/**
* @brief Tests Initialise with a fully valid unicast configuration.
*/
bool TestInitialise_Valid();
/**
* @brief Tests that a missing ServerAddress uses the default (127.0.0.1).
*/
bool TestInitialise_DefaultServerAddress();
/**
* @brief Tests that a missing Port uses the default (44500).
*/
bool TestInitialise_DefaultPort();
/**
* @brief Tests Initialise with MulticastGroup and an explicit DataPort.
*/
bool TestInitialise_MulticastMode_Valid();
/**
* @brief Tests that DataPort defaults to Port+1 when MulticastGroup is
* set but DataPort is absent.
*/
bool TestInitialise_MulticastMode_DefaultDataPort();
/**
* @brief Tests SetConfiguredDatabase / AllocateMemory with several
* signals of different types and array sizes.
*/
bool TestSetConfiguredDatabase_MultipleSignals();
/**
* @brief Tests PrepareNextState starts the background receiver thread.
*/
bool TestPrepareNextState_StartsReceiver();
/**
* @brief Tests that Synchronise() with no data received is a safe no-op.
*/
bool TestSynchronise_NoData();
/**
* @brief Tests the full OnUDPSConfig -> OnUDPSData -> Synchronise path
* for a single unquantised scalar signal.
*/
bool TestOnUDPSConfig_BasicAccept();
/**
* @brief Tests that a CONFIG with a different signal count is rejected.
*/
bool TestOnUDPSConfig_SignalCountMismatch();
/**
* @brief Tests that a CONFIG with a mismatched signal name is rejected.
*/
bool TestOnUDPSConfig_NameMismatch();
/**
* @brief Tests that a CONFIG with a mismatched element count is rejected.
*/
bool TestOnUDPSConfig_ElementCountMismatch();
/**
* @brief Tests that an undersized CONFIG payload is safely rejected.
*/
bool TestOnUDPSConfig_TooSmallPayload();
/**
* @brief Tests UINT16 dequantisation into a Float32Bit destination signal.
*/
bool TestOnUDPSData_QuantizedUint16();
/**
* @brief Tests INT8 dequantisation formula into a Float64Bit destination signal.
*/
bool TestOnUDPSData_QuantizedInt8();
/**
* @brief Tests that multiple signals decode into the correct buffer offsets.
*/
bool TestOnUDPSData_MultipleSignalsOrder();
/**
* @brief Tests Accumulate publishing mode: scalar signals publish only the
* most recent sample, array signals publish once regardless of numSamples.
*/
bool TestOnUDPSData_AccumulateMode();
/**
* @brief Tests that an undersized DATA payload (missing timestamp) is a safe no-op.
*/
bool TestOnUDPSData_TooSmallPayload();
/**
* @brief Tests that OnUDPSData before a valid CONFIG is a safe no-op.
*/
bool TestOnUDPSData_BeforeConfig();
/**
* @brief Tests that OnUDPSDisconnected() invalidates the CONFIG so
* subsequent DATA payloads are ignored until a new CONFIG arrives.
*/
bool TestOnUDPSDisconnected_InvalidatesConfig();
/**
* @brief Tests the full CONNECT -> CONFIG -> DATA flow over real loopback
* UDP sockets, mirroring the server side of the wire protocol.
*/
bool TestExecute_ConnectConfigDataEndToEnd();
};
#endif /* UDPSTREAMERCLIENTTEST_H_ */