unittest_modbus_msg_wrapper.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Pilz GmbH & Co. KG
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include <gtest/gtest.h>
19 
20 #include <memory>
21 #include <vector>
22 
27 
28 using namespace prbt_hardware_support;
29 
31 {
33 
38 TEST(ModbusMsgWrapperTest, testModbusMsgWrapperDtor)
39 {
40  uint32_t offset{ 0 };
41  const uint16_t modbus_api_version{ 1 };
42  RegCont holding_register{ modbus_api_version };
43  ModbusMsgInStampedPtr msg{ ModbusMsgInBuilder::createDefaultModbusMsgIn(offset, holding_register) };
44 
45  ModbusMsgInStampedConstPtr msg_const_ptr{ msg };
46  std::shared_ptr<ModbusMsgWrapper> ex(new ModbusMsgWrapper(msg_const_ptr, TEST_API_SPEC));
47 }
48 
49 } // namespace modbus_msg_wrapper
50 
51 int main(int argc, char* argv[])
52 {
53  testing::InitGoogleTest(&argc, argv);
54  return RUN_ALL_TESTS();
55 }
msg
int main(int argc, char *argv[])
std::vector< uint16_t > RegCont
Convenience data type defining the data type for a collection of registers.
static const ModbusApiSpec TEST_API_SPEC
static ModbusMsgInStampedPtr createDefaultModbusMsgIn(const std_msgs::MultiArrayLayout::_data_offset_type &offset, const RegCont &holding_register)
Creates a standard ModbusMsgIn which contains default values for all essential elements of the messag...
TEST(IntegrationtestExecuteBrakeTest, testBrakeTestService)
Wrapper class to add semantic to a raw ModbusMsgInStamped.
Specifies the meaning of the holding registers.


prbt_hardware_support
Author(s):
autogenerated on Mon Feb 28 2022 23:14:34