Classes | Namespaces | Functions | Variables
unittest_pilz_modbus_client.cpp File Reference
#include <gtest/gtest.h>
#include <chrono>
#include <memory>
#include <mutex>
#include <numeric>
#include <string>
#include <thread>
#include <vector>
#include <ros/ros.h>
#include <modbus/modbus.h>
#include <prbt_hardware_support/modbus_topic_definitions.h>
#include <prbt_hardware_support/ModbusMsgInStamped.h>
#include <prbt_hardware_support/pilz_modbus_client_mock.h>
#include <prbt_hardware_support/pilz_modbus_client.h>
#include <prbt_hardware_support/pilz_modbus_exceptions.h>
#include <prbt_hardware_support/pilz_modbus_client_exception.h>
#include <prbt_hardware_support/client_tests_common.h>
#include <pilz_testutils/async_test.h>
Include dependency graph for unittest_pilz_modbus_client.cpp:

Go to the source code of this file.

Classes

class  pilz_modbus_client_test::HoldingRegisterIncreaser
 Strictly increases the holding register each time the "readHoldingRegister" method is called. More...
 
class  pilz_modbus_client_test::PilzModbusClientExecutor
 Helper class to simplify the threading of the PilzModbusClient. More...
 
class  pilz_modbus_client_test::PilzModbusClientTests
 Test if PilzModbusClient correctly publishes ROS-Modbus messages. More...
 
class  pilz_modbus_client_test::RegisterBuffer
 

Namespaces

 pilz_modbus_client_test
 

Functions

void pilz_modbus_client_test::callbackDummy (const ModbusMsgInStampedConstPtr &)
 
int main (int argc, char *argv[])
 
 pilz_modbus_client_test::MATCHER (IsDisconnect, "")
 
 pilz_modbus_client_test::MATCHER_P (IsSuccessfullRead, vec, "")
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, testInitialization)
 Test that PilzModbusClient initializes its client properly. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, testInitializationWithRetry)
 Test that initialization is repeated if it does not work at first try. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, doubleInitialization)
 Test that double initialization fails on seconds try. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, failingInitialization)
 Test the initialization of the modbus read client if init fails. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, failingInitializationWithRetry)
 Test that repeated failed initialization yields in a failed init for the caller. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, properReadingAndDisconnect)
 Test that PilzModbusClient properly reads from the registers and reacts to disconnects. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, runningWithoutInit)
 Try to run the modbus read client without a foregoing call to init() More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, terminateRunningClient)
 Test that a running modbus read client can be stopped with the terminate method. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, testTopicNameChange)
 Tests that topic name can be changed. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, testSettingOfTimeOut)
 Tests that response timeout can be changed. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, testSettingReadFrequency)
 Tests that the frequency with which the registers are read, can be changed. More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, testWritingOfHoldingRegister)
 Tests that modbus client can properly write and read from holding register (with one call). More...
 
 pilz_modbus_client_test::TEST_F (PilzModbusClientTests, testSplitIntoBlocksFcn)
 Tests the split_into_blocks method. More...
 

Variables

static constexpr unsigned int pilz_modbus_client_test::DEFAULT_MODBUS_PORT_TEST { 502 }
 
static constexpr unsigned int pilz_modbus_client_test::REGISTER_FIRST_IDX_TEST { 512 }
 
static constexpr unsigned int pilz_modbus_client_test::REGISTER_SIZE_TEST { 2 }
 
static constexpr unsigned int pilz_modbus_client_test::RESPONSE_TIMEOUT { 10 }
 
static constexpr double pilz_modbus_client_test::WAIT_FOR_SERVICE_TIMEOUT_S { 3.0 }
 
static constexpr double pilz_modbus_client_test::WAIT_FOR_START_TIMEOUT_S { 3.0 }
 
static constexpr double pilz_modbus_client_test::WAIT_FOR_STOP_TIMEOUT_S { 3.0 }
 
static constexpr double pilz_modbus_client_test::WAIT_SLEEPTIME_S { 0.1 }
 

Function Documentation

◆ main()

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

Definition at line 561 of file unittest_pilz_modbus_client.cpp.



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