Skip to content

Commit bb4af6d

Browse files
authored
Make all packages use gmock, not gtest (#2162)
1 parent 7e8750a commit bb4af6d

File tree

49 files changed

+65
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+65
-99
lines changed

controller_interface/test/test_chainable_controller_interface.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
#include "test_chainable_controller_interface.hpp"
1616

17-
#include <gmock/gmock.h>
1817
#include <memory>
1918

19+
#include "gmock/gmock.h"
20+
2021
using ::testing::IsEmpty;
2122
using ::testing::SizeIs;
2223

controller_interface/test/test_chainable_controller_interface.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
#ifndef TEST_CHAINABLE_CONTROLLER_INTERFACE_HPP_
1616
#define TEST_CHAINABLE_CONTROLLER_INTERFACE_HPP_
1717

18-
#include <gmock/gmock.h>
19-
2018
#include <string>
2119
#include <vector>
2220

2321
#include "controller_interface/chainable_controller_interface.hpp"
22+
#include "gmock/gmock.h"
2423
#include "hardware_interface/handle.hpp"
2524

2625
constexpr char TEST_CONTROLLER_NAME[] = "testable_chainable_controller";

controller_interface/test/test_controller_interface.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
#include "test_controller_interface.hpp"
1616

17-
#include <gmock/gmock.h>
1817
#include <memory>
1918
#include <string>
2019
#include <vector>
2120

21+
#include "gmock/gmock.h"
2222
#include "lifecycle_msgs/msg/state.hpp"
2323
#include "rclcpp/executor_options.hpp"
2424
#include "rclcpp/executors/multi_threaded_executor.hpp"

controller_interface/test/test_controller_with_options.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
#include "test_controller_with_options.hpp"
1616

17-
#include <gtest/gtest.h>
1817
#include <string>
1918

19+
#include "gmock/gmock.h"
20+
2021
class FriendControllerWithOptions : public controller_with_options::ControllerWithOptions
2122
{
2223
FRIEND_TEST(ControllerWithOption, init_with_overrides);

controller_interface/test/test_force_torque_sensor.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@
1919
#ifndef TEST_FORCE_TORQUE_SENSOR_HPP_
2020
#define TEST_FORCE_TORQUE_SENSOR_HPP_
2121

22-
#include <gmock/gmock.h>
23-
2422
#include <memory>
2523
#include <string>
2624
#include <vector>
2725

26+
#include "gmock/gmock.h"
2827
#include "semantic_components/force_torque_sensor.hpp"
2928

3029
// implementing and friending so we can access member variables

controller_interface/test/test_gps_sensor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <gmock/gmock.h>
16-
#include <gtest/gtest.h>
1715
#include <algorithm>
1816
#include <array>
1917
#include <string>
2018
#include <vector>
19+
20+
#include "gmock/gmock.h"
2121
#include "hardware_interface/handle.hpp"
2222
#include "hardware_interface/loaned_state_interface.hpp"
2323
#include "semantic_components/gps_sensor.hpp"

controller_interface/test/test_imu_sensor.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@
1919
#ifndef TEST_IMU_SENSOR_HPP_
2020
#define TEST_IMU_SENSOR_HPP_
2121

22-
#include <gmock/gmock.h>
23-
2422
#include <memory>
2523
#include <string>
2624
#include <vector>
2725

26+
#include "gmock/gmock.h"
2827
#include "semantic_components/imu_sensor.hpp"
2928

3029
// implementing and friending so we can access member variables

controller_interface/test/test_led_rgb_device.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
#ifndef TEST_LED_RGB_DEVICE_HPP_
1616
#define TEST_LED_RGB_DEVICE_HPP_
1717

18-
#include <gmock/gmock.h>
19-
2018
#include <array>
2119
#include <limits>
2220
#include <memory>
2321
#include <string>
2422
#include <vector>
2523

24+
#include "gmock/gmock.h"
2625
#include "semantic_components/led_rgb_device.hpp"
2726

2827
class TestableLedDevice : public semantic_components::LedRgbDevice

controller_interface/test/test_pose_sensor.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
#ifndef TEST_POSE_SENSOR_HPP_
1616
#define TEST_POSE_SENSOR_HPP_
1717

18-
#include <gmock/gmock.h>
19-
2018
#include <array>
2119
#include <memory>
2220
#include <string>
2321
#include <vector>
2422

23+
#include "gmock/gmock.h"
2524
#include "semantic_components/pose_sensor.hpp"
2625

2726
class TestablePoseSensor : public semantic_components::PoseSensor

controller_interface/test/test_semantic_component_command_interface.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818
#ifndef TEST_SEMANTIC_COMPONENT_COMMAND_INTERFACE_HPP_
1919
#define TEST_SEMANTIC_COMPONENT_COMMAND_INTERFACE_HPP_
2020

21-
#include <gmock/gmock.h>
22-
2321
#include <memory>
2422
#include <string>
2523

2624
#include "geometry_msgs/msg/pose.hpp"
25+
#include "gmock/gmock.h"
2726
#include "semantic_components/semantic_component_command_interface.hpp"
2827

2928
// implementing and friending so we can access member variables

controller_interface/test/test_semantic_component_interface.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@
1919
#ifndef TEST_SEMANTIC_COMPONENT_INTERFACE_HPP_
2020
#define TEST_SEMANTIC_COMPONENT_INTERFACE_HPP_
2121

22-
#include <gmock/gmock.h>
23-
2422
#include <memory>
2523
#include <string>
2624

2725
#include "geometry_msgs/msg/wrench.hpp"
26+
#include "gmock/gmock.h"
2827
#include "semantic_components/semantic_component_interface.hpp"
2928

3029
// implementing and friending so we can access member variables

controller_manager/test/controller_manager_test_common.hpp

+2-8
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,20 @@
1515
#ifndef CONTROLLER_MANAGER_TEST_COMMON_HPP_
1616
#define CONTROLLER_MANAGER_TEST_COMMON_HPP_
1717

18-
#include <gmock/gmock.h>
19-
#include <gtest/gtest.h>
20-
2118
#include <chrono>
2219
#include <memory>
2320
#include <string>
2421
#include <thread>
2522
#include <vector>
2623

2724
#include "controller_interface/controller_interface.hpp"
28-
2925
#include "controller_manager/controller_manager.hpp"
3026
#include "controller_manager_msgs/srv/switch_controller.hpp"
31-
27+
#include "gmock/gmock.h"
3228
#include "rclcpp/executors.hpp"
3329
#include "rclcpp/utilities.hpp"
34-
35-
#include "std_msgs/msg/string.hpp"
36-
3730
#include "ros2_control_test_assets/descriptions.hpp"
31+
#include "std_msgs/msg/string.hpp"
3832

3933
namespace
4034
{

controller_manager/test/test_controller_manager.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
15-
#include <gmock/gmock.h>
1614
#include <memory>
1715
#include <string>
1816
#include <vector>
1917

2018
#include "controller_manager/controller_manager.hpp"
2119
#include "controller_manager_msgs/msg/controller_manager_activity.hpp"
2220
#include "controller_manager_test_common.hpp"
21+
#include "gmock/gmock.h"
2322
#include "lifecycle_msgs/msg/state.hpp"
2423
#include "rclcpp/executor.hpp"
2524
#include "test_chainable_controller/test_chainable_controller.hpp"

controller_manager/test/test_controller_manager_hardware_error_handling.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <gtest/gtest.h>
1615
#include <memory>
1716
#include <string>
1817
#include <utility>
1918
#include <vector>
2019

2120
#include "controller_manager/controller_manager.hpp"
2221
#include "controller_manager_test_common.hpp"
22+
#include "gmock/gmock.h"
2323
#include "hardware_interface/types/lifecycle_state_names.hpp"
2424
#include "lifecycle_msgs/msg/state.hpp"
2525
#include "ros2_control_test_assets/test_hardware_interface_constants.hpp"

controller_manager/test/test_controller_manager_srvs.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <gmock/gmock.h>
16-
#include <gtest/gtest.h>
1715
#include <memory>
1816
#include <random>
1917
#include <string>
2018
#include <vector>
2119

22-
#include "controller_manager_test_common.hpp"
23-
2420
#include "controller_interface/controller_interface.hpp"
2521
#include "controller_manager_msgs/srv/list_controller_types.hpp"
2622
#include "controller_manager_msgs/srv/list_controllers.hpp"
2723
#include "controller_manager_msgs/srv/list_hardware_interfaces.hpp"
2824
#include "controller_manager_msgs/srv/switch_controller.hpp"
25+
#include "controller_manager_test_common.hpp"
26+
#include "gmock/gmock.h"
2927
#include "lifecycle_msgs/msg/state.hpp"
3028
#include "test_chainable_controller/test_chainable_controller.hpp"
3129
#include "test_controller/test_controller.hpp"

controller_manager/test/test_controller_manager_urdf_passing.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <gtest/gtest.h>
1615
#include <memory>
1716
#include <string>
1817
#include <utility>
1918
#include <vector>
2019

2120
#include "controller_manager/controller_manager.hpp"
2221
#include "controller_manager_test_common.hpp"
22+
#include "gmock/gmock.h"
2323
#include "ros2_control_test_assets/descriptions.hpp"
2424
#include "test_controller/test_controller.hpp"
2525

controller_manager/test/test_controller_manager_with_namespace.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <gtest/gtest.h>
1615
#include <memory>
1716
#include <string>
1817
#include <vector>
1918

2019
#include "controller_manager/controller_manager.hpp"
2120
#include "controller_manager_test_common.hpp"
21+
#include "gmock/gmock.h"
2222
#include "test_controller/test_controller.hpp"
2323

2424
using ::testing::_;

controller_manager/test/test_controllers_chaining_with_controller_manager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <gtest/gtest.h>
1615
#include <memory>
1716
#include <string>
1817
#include <unordered_map>
@@ -21,6 +20,7 @@
2120

2221
#include "controller_manager/controller_manager.hpp"
2322
#include "controller_manager_test_common.hpp"
23+
#include "gmock/gmock.h"
2424
#include "lifecycle_msgs/msg/state.hpp"
2525
#include "test_chainable_controller/test_chainable_controller.hpp"
2626
#include "test_controller/test_controller.hpp"

controller_manager/test/test_hardware_management_srvs.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
15-
#include <gmock/gmock.h>
16-
#include <gtest/gtest.h>
1714
#include <memory>
1815
#include <string>
1916
#include <vector>
2017

21-
#include "controller_manager_test_common.hpp"
22-
2318
#include "controller_manager/controller_manager.hpp"
2419
#include "controller_manager_msgs/msg/hardware_component_state.hpp"
2520
#include "controller_manager_msgs/srv/set_hardware_component_state.hpp"
21+
#include "controller_manager_test_common.hpp"
22+
#include "gmock/gmock.h"
2623
#include "hardware_interface/types/lifecycle_state_names.hpp"
2724
#include "lifecycle_msgs/msg/state.hpp"
2825
#include "rclcpp/parameter.hpp"

controller_manager/test/test_hardware_spawner.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <gtest/gtest.h>
16-
1715
#include <cstdlib>
1816
#include <memory>
1917
#include <string>
2018
#include <vector>
2119

2220
#include "controller_manager/controller_manager.hpp"
2321
#include "controller_manager_test_common.hpp"
22+
#include "gmock/gmock.h"
2423
#include "lifecycle_msgs/msg/state.hpp"
2524
#include "test_chainable_controller/test_chainable_controller.hpp"
2625
#include "test_controller/test_controller.hpp"

controller_manager/test/test_load_controller.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
15-
#include <gmock/gmock.h>
16-
#include <gtest/gtest.h>
1714
#include <memory>
1815
#include <string>
1916
#include <tuple>
2017
#include <vector>
2118

2219
#include "controller_manager/controller_manager.hpp"
2320
#include "controller_manager_test_common.hpp"
21+
#include "gmock/gmock.h"
2422
#include "lifecycle_msgs/msg/state.hpp"
2523
#include "test_controller/test_controller.hpp"
2624
#include "test_controller_failed_init/test_controller_failed_init.hpp"

controller_manager/test/test_release_interfaces.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
15-
#include <gmock/gmock.h>
16-
#include <gtest/gtest.h>
1714
#include <string>
1815
#include <vector>
1916

2017
#include "controller_manager/controller_manager.hpp"
2118
#include "controller_manager_test_common.hpp"
19+
#include "gmock/gmock.h"
2220
#include "lifecycle_msgs/msg/state.hpp"
2321
#include "test_controller/test_controller.hpp"
2422
#include "test_controller_with_interfaces/test_controller_with_interfaces.hpp"

controller_manager/test/test_spawner_unspawner.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <gtest/gtest.h>
16-
1715
#include <cstdlib>
1816
#include <memory>
1917
#include <string>
2018
#include <vector>
2119

2220
#include "controller_manager/controller_manager.hpp"
2321
#include "controller_manager_test_common.hpp"
22+
#include "gmock/gmock.h"
2423
#include "lifecycle_msgs/msg/state.hpp"
2524
#include "test_chainable_controller/test_chainable_controller.hpp"
2625
#include "test_controller/test_controller.hpp"

hardware_interface/test/mock_components/test_generic_system.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
//
1515
// Author: Denis Stogl
1616

17-
#include <gmock/gmock.h>
18-
1917
#include <cmath>
2018
#include <string>
2119
#include <unordered_map>
2220
#include <vector>
2321

22+
#include "gmock/gmock.h"
2423
#include "hardware_interface/loaned_command_interface.hpp"
2524
#include "hardware_interface/loaned_state_interface.hpp"
2625
#include "hardware_interface/resource_manager.hpp"
@@ -2210,6 +2209,6 @@ TEST_F(TestGenericSystem, prepare_command_mode_switch_works_with_all_example_tag
22102209
int main(int argc, char ** argv)
22112210
{
22122211
rclcpp::init(argc, argv);
2213-
testing::InitGoogleTest(&argc, argv);
2212+
testing::InitGoogleMock(&argc, argv);
22142213
return RUN_ALL_TESTS();
22152214
}

0 commit comments

Comments
 (0)