Classes | Namespaces | Functions | Variables
unittest_libmodbus_client.cpp File Reference
#include <gtest/gtest.h>
#include <thread>
#include <chrono>
#include <vector>
#include <numeric>
#include <modbus/modbus.h>
#include <prbt_hardware_support/libmodbus_client.h>
#include <prbt_hardware_support/pilz_modbus_server_mock.h>
#include <prbt_hardware_support/pilz_modbus_exceptions.h>
#include <prbt_hardware_support/client_tests_common.h>
Include dependency graph for unittest_libmodbus_client.cpp:

Go to the source code of this file.

Classes

class  pilz_modbus_client_test::LibModbusClientTest
 

Namespaces

 pilz_modbus_client_test
 

Functions

int main (int argc, char *argv[])
 
static std::vector< unsigned int > pilz_modbus_client_test::PORTS_FOR_TEST (END_PORT - START_PORT)
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testModbusClientDtor)
 Test increases function coverage by ensuring that all Dtor variants are called. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testNewInit)
 Test construction via new. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testInitialization)
 Test successfull init. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testFailingInitIfNoServer)
 Test unsuccessfull init if no server is present. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testReadRegisters)
 Tests that holding registers set on the server are correctly read by the client. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testWritingRegisters)
 Tests that holding registers are correctly written by client. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testNegativeNumberOfRegistersToRead)
 Tests that exception is thrown if the user tries to call the write function with a negative number of write of registers to read. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testOutOfRangeRegisterSize)
 Tests that exception is thrown if the user tries to call the write function with a register containing too mainy elements. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testDisconnectBeforeReadWriteOp)
 Tests that exception is thrown if modbus connections fails before call to write & read function. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testDisconnectDuringReadWriteOp)
 Tests that exception is thrown if modbus connections fails during write & read operation. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testReadRegistersNoInit)
 Tests that after a failed init (e.g. no available modbus server) reading throws a exception. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, testReadRegistersTerminatedServer)
 Tests that after a failed init (e.g. after disconnect from server) reading throws a exception. More...
 
 pilz_modbus_client_test::TEST_F (LibModbusClientTest, setResponseTimeout)
 Tests that setting reponse timeout on the client will return the same timeout on getResponseTimeoutInMs. More...
 

Variables

static unsigned int pilz_modbus_client_test::ACTIVE_PORT_IDX { 0 }
 
constexpr unsigned int pilz_modbus_client_test::DEFAULT_READ_IDX { 77 }
 
constexpr unsigned int pilz_modbus_client_test::DEFAULT_REGISTER_SIZE { 514 }
 
constexpr unsigned int pilz_modbus_client_test::DEFAULT_WRITE_IDX { 512 }
 
constexpr unsigned int pilz_modbus_client_test::END_PORT { 20600 }
 
constexpr unsigned int pilz_modbus_client_test::START_PORT { 20500 }
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 326 of file unittest_libmodbus_client.cpp.



prbt_hardware_support
Author(s):
autogenerated on Wed Nov 25 2020 03:10:38