mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 01:50:46 +02:00
removed legacy test and related utilites
This commit is contained in:
committed by
Felix Mauch
parent
d88e6f12f4
commit
fa31081e3a
@@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2017, 2018 Simon Rasmussen (refactor)
|
|
||||||
*
|
|
||||||
* Copyright 2015, 2016 Thomas Timm Andersen (original version)
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <bitset>
|
|
||||||
#include <climits>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <functional>
|
|
||||||
#include <random>
|
|
||||||
#include "ur_rtde_driver/bin_parser.h"
|
|
||||||
|
|
||||||
namespace ur_driver
|
|
||||||
{
|
|
||||||
class RandomDataTest
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
using random_bytes_engine = std::independent_bits_engine<std::default_random_engine, CHAR_BIT, uint8_t>;
|
|
||||||
uint8_t* buf_;
|
|
||||||
BinParser bp_;
|
|
||||||
size_t n_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
RandomDataTest(size_t n) : buf_(new uint8_t[n]), bp_(buf_, n), n_(n)
|
|
||||||
{
|
|
||||||
random_bytes_engine rbe;
|
|
||||||
std::generate(buf_, buf_ + n, std::ref(rbe));
|
|
||||||
}
|
|
||||||
|
|
||||||
~RandomDataTest()
|
|
||||||
{
|
|
||||||
delete buf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
BinParser getParser(bool skip = false)
|
|
||||||
{
|
|
||||||
return BinParser(buf_, n_ - (skip ? sizeof(int32_t) : 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T getNext()
|
|
||||||
{
|
|
||||||
T actual;
|
|
||||||
bp_.parse(actual);
|
|
||||||
return actual;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, size_t N>
|
|
||||||
std::bitset<N> getNext()
|
|
||||||
{
|
|
||||||
T actual;
|
|
||||||
bp_.parse(actual);
|
|
||||||
return std::bitset<N>(actual);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void set(T data, size_t pos)
|
|
||||||
{
|
|
||||||
std::memcpy(&data, buf_ + pos, sizeof(T));
|
|
||||||
}
|
|
||||||
|
|
||||||
void skip(size_t n)
|
|
||||||
{
|
|
||||||
bp_.consume(n);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // namespace ur_driver
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2017, 2018 Simon Rasmussen (refactor)
|
|
||||||
*
|
|
||||||
* Copyright 2015, 2016 Thomas Timm Andersen (original version)
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#define ASSERT_DOUBLE_ARRAY_EQ(fn, name) \
|
|
||||||
for (auto const& v : name) \
|
|
||||||
{ \
|
|
||||||
ASSERT_EQ(fn, v) << #name " failed parsing"; \
|
|
||||||
}
|
|
||||||
@@ -42,5 +42,4 @@
|
|||||||
<exec_depend>ur_description</exec_depend>
|
<exec_depend>ur_description</exec_depend>
|
||||||
<exec_depend>velocity_controllers</exec_depend>
|
<exec_depend>velocity_controllers</exec_depend>
|
||||||
|
|
||||||
<test_depend>rosunit</test_depend>
|
|
||||||
</package>
|
</package>
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2017, 2018 Simon Rasmussen (refactor)
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
testing::InitGoogleTest(&argc, argv);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2017, 2018 Simon Rasmussen (refactor)
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ur_rtde_driver/comm/ur/master_board.h"
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
#include "ur_rtde_driver/comm/bin_parser.h"
|
|
||||||
#include "ur_rtde_driver/log.h"
|
|
||||||
#include "ur_rtde_driver/comm/test/random_data.h"
|
|
||||||
#include "ur_rtde_driver/comm/test/utils.h"
|
|
||||||
#include "ur_rtde_driver/comm/types.h"
|
|
||||||
|
|
||||||
using namespace ur_driver;
|
|
||||||
|
|
||||||
TEST(MasterBoardData_V1_X, testRandomDataParsing)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(71);
|
|
||||||
rdt.set<uint8_t>(1, 58); // sets euromap67_interface_installed to true
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
MasterBoardData_V1_X state;
|
|
||||||
|
|
||||||
ASSERT_TRUE(state.parseWith(bp)) << "parse() returned false";
|
|
||||||
|
|
||||||
ASSERT_EQ((rdt.getNext<uint16_t, 10>()), state.digital_input_bits);
|
|
||||||
ASSERT_EQ((rdt.getNext<uint16_t, 10>()), state.digital_output_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_input_range0);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_input_range1);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_input0);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_input1);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_output_domain0);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_output_domain1);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_output0);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_output1);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.master_board_temperature);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.robot_voltage_48V);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.robot_current);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.master_IO_current);
|
|
||||||
ASSERT_EQ(rdt.getNext<uint8_t>(), state.master_safety_state);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.master_on_off_state);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.euromap67_interface_installed);
|
|
||||||
ASSERT_EQ(rdt.getNext<int32_t>(), state.euromap_input_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<int32_t>(), state.euromap_output_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<int16_t>(), state.euromap_voltage);
|
|
||||||
ASSERT_EQ(rdt.getNext<int16_t>(), state.euromap_current);
|
|
||||||
|
|
||||||
ASSERT_TRUE(bp.empty()) << "Did not consume all data";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(MasterBoardData_V3_0__1, testRandomDataParsing)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(83);
|
|
||||||
rdt.set<uint8_t>(1, 62); // sets euromap67_interface_installed to true
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
MasterBoardData_V3_0__1 state;
|
|
||||||
ASSERT_TRUE(state.parseWith(bp)) << "parse() returned false";
|
|
||||||
|
|
||||||
ASSERT_EQ((rdt.getNext<uint32_t, 18>()), state.digital_input_bits);
|
|
||||||
ASSERT_EQ((rdt.getNext<uint32_t, 18>()), state.digital_output_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_input_range0);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_input_range1);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_input0);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_input1);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_output_domain0);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_output_domain1);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_output0);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_output1);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.master_board_temperature);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.robot_voltage_48V);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.robot_current);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.master_IO_current);
|
|
||||||
ASSERT_EQ(rdt.getNext<uint8_t>(), state.safety_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.in_reduced_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.euromap67_interface_installed);
|
|
||||||
ASSERT_EQ(rdt.getNext<int32_t>(), state.euromap_input_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<int32_t>(), state.euromap_output_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.euromap_voltage);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.euromap_current);
|
|
||||||
|
|
||||||
rdt.skip(sizeof(uint32_t));
|
|
||||||
|
|
||||||
ASSERT_TRUE(bp.empty()) << "Did not consume all data";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(MasterBoardData_V3_2, testRandomDataParsing)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(85);
|
|
||||||
rdt.set<uint8_t>(1, 62); // sets euromap67_interface_installed to true
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
MasterBoardData_V3_2 state;
|
|
||||||
ASSERT_TRUE(state.parseWith(bp)) << "parse() returned false";
|
|
||||||
|
|
||||||
ASSERT_EQ((rdt.getNext<uint32_t, 18>()), state.digital_input_bits);
|
|
||||||
ASSERT_EQ((rdt.getNext<uint32_t, 18>()), state.digital_output_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_input_range0);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_input_range1);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_input0);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_input1);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_output_domain0);
|
|
||||||
ASSERT_EQ(rdt.getNext<int8_t>(), state.analog_output_domain1);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_output0);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.analog_output1);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.master_board_temperature);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.robot_voltage_48V);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.robot_current);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.master_IO_current);
|
|
||||||
ASSERT_EQ(rdt.getNext<uint8_t>(), state.safety_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.in_reduced_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.euromap67_interface_installed);
|
|
||||||
ASSERT_EQ(rdt.getNext<int32_t>(), state.euromap_input_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<int32_t>(), state.euromap_output_bits);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.euromap_voltage);
|
|
||||||
ASSERT_EQ(rdt.getNext<float>(), state.euromap_current);
|
|
||||||
rdt.skip(sizeof(uint32_t));
|
|
||||||
ASSERT_EQ(rdt.getNext<uint8_t>(), state.operational_mode_selector_input);
|
|
||||||
ASSERT_EQ(rdt.getNext<uint8_t>(), state.three_position_enabling_device_input);
|
|
||||||
|
|
||||||
ASSERT_TRUE(bp.empty()) << "Did not consume all data";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(MasterBoardData_V1_X, testTooSmallBuffer)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(10);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
MasterBoardData_V1_X state;
|
|
||||||
EXPECT_FALSE(state.parseWith(bp)) << "parse() should fail when buffer not big enough";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(MasterBoardData_V3_0__1, testTooSmallBuffer)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(10);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
MasterBoardData_V3_0__1 state;
|
|
||||||
EXPECT_FALSE(state.parseWith(bp)) << "parse() should fail when buffer not big enough";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(MasterBoardData_V3_2, testTooSmallBuffer)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(10);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
MasterBoardData_V3_2 state;
|
|
||||||
EXPECT_FALSE(state.parseWith(bp)) << "parse() should fail when buffer not big enough";
|
|
||||||
}
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2017, 2018 Simon Rasmussen (refactor)
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ur_rtde_driver/comm/ur/robot_mode.h"
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
#include "ur_rtde_driver/comm/bin_parser.h"
|
|
||||||
#include "ur_rtde_driver/log.h"
|
|
||||||
#include "ur_rtde_driver/comm/test/random_data.h"
|
|
||||||
#include "ur_rtde_driver/comm/test/utils.h"
|
|
||||||
#include "ur_rtde_driver/comm/types.h"
|
|
||||||
|
|
||||||
using namespace ur_driver;
|
|
||||||
TEST(RobotModeData_V1_X, testRandomDataParsing)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(24);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
RobotModeData_V1_X state;
|
|
||||||
ASSERT_TRUE(state.parseWith(bp)) << "parse() returned false";
|
|
||||||
|
|
||||||
ASSERT_EQ(rdt.getNext<uint64_t>(), state.timestamp);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.physical_robot_connected);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.real_robot_enabled);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.robot_power_on);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.emergency_stopped);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.protective_stopped);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.program_running);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.program_paused);
|
|
||||||
ASSERT_EQ(rdt.getNext<robot_mode_V1_X>(), state.robot_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.speed_fraction);
|
|
||||||
|
|
||||||
ASSERT_TRUE(bp.empty()) << "Did not consume all data";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(RobotModeData_V3_0__1, testRandomDataParsing)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(33);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
RobotModeData_V3_0__1 state;
|
|
||||||
ASSERT_TRUE(state.parseWith(bp)) << "parse() returned false";
|
|
||||||
|
|
||||||
ASSERT_EQ(rdt.getNext<uint64_t>(), state.timestamp);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.physical_robot_connected);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.real_robot_enabled);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.robot_power_on);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.emergency_stopped);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.protective_stopped);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.program_running);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.program_paused);
|
|
||||||
ASSERT_EQ(rdt.getNext<robot_mode_V3_X>(), state.robot_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<robot_control_mode_V3_X>(), state.control_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.target_speed_fraction);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.speed_scaling);
|
|
||||||
|
|
||||||
ASSERT_TRUE(bp.empty()) << "Did not consume all data";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(RobotModeData_V3_2, testRandomDataParsing)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(41);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
RobotModeData_V3_2 state;
|
|
||||||
ASSERT_TRUE(state.parseWith(bp)) << "parse() returned false";
|
|
||||||
|
|
||||||
ASSERT_EQ(rdt.getNext<uint64_t>(), state.timestamp);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.physical_robot_connected);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.real_robot_enabled);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.robot_power_on);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.emergency_stopped);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.protective_stopped);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.program_running);
|
|
||||||
ASSERT_EQ(rdt.getNext<bool>(), state.program_paused);
|
|
||||||
ASSERT_EQ(rdt.getNext<robot_mode_V3_X>(), state.robot_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<robot_control_mode_V3_X>(), state.control_mode);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.target_speed_fraction);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.speed_scaling);
|
|
||||||
ASSERT_EQ(rdt.getNext<double>(), state.target_speed_fraction_limit);
|
|
||||||
|
|
||||||
ASSERT_TRUE(bp.empty()) << "Did not consume all data";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(RobotModeData_V1_X, testTooSmallBuffer)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(10);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
RobotModeData_V1_X state;
|
|
||||||
EXPECT_FALSE(state.parseWith(bp)) << "parse() should fail when buffer not big enough";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(RobotModeData_V3_0__1, testTooSmallBuffer)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(10);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
RobotModeData_V3_0__1 state;
|
|
||||||
EXPECT_FALSE(state.parseWith(bp)) << "parse() should fail when buffer not big enough";
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(RobotModeData_V3_2, testTooSmallBuffer)
|
|
||||||
{
|
|
||||||
RandomDataTest rdt(10);
|
|
||||||
BinParser bp = rdt.getParser();
|
|
||||||
RobotModeData_V3_2 state;
|
|
||||||
EXPECT_FALSE(state.parseWith(bp)) << "parse() should fail when buffer not big enough";
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user