diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 98a0a0b38d009fc22d8df5292bd2ccbb15816436..e4ef7aba3693b284bcb0a76525e54a9c224da67f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -34,6 +34,10 @@ wolf_add_gtest(gtest_force_torque_delta_tools gtest_force_torque_delta_tools.cpp # processor_point_feet_nomove test wolf_add_gtest(gtest_processor_point_feet_nomove gtest_processor_point_feet_nomove.cpp) +# Load bodydynamics tests +wolf_add_gtest(gtest_load_bodydynamics gtest_load_bodydynamics.cpp) +wolf_add_gtest(gtest_no_load_bodydynamics gtest_no_load_bodydynamics.cpp) + # schema test wolf_add_gtest(gtest_schema gtest_schema.cpp) diff --git a/test/gtest_load_bodydynamics.cpp b/test/gtest_load_bodydynamics.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7dcee2c7617a35fc102de12c43d77400e6653acb --- /dev/null +++ b/test/gtest_load_bodydynamics.cpp @@ -0,0 +1,44 @@ +// WOLF - Copyright (C) 2020,2021,2022,2023,2024 +// Institut de Robòtica i Informà tica Industrial, CSIC-UPC. +// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and +// Joan Vallvé Navarro (jvallve@iri.upc.edu) +// All rights reserved. +// +// This file is part of WOLF: http://www.iri.upc.edu/wolf +// WOLF is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include <gtest/gtest.h> +#include "bodydynamics/utils/load_bodydynamics.h" +#include <core/sensor/factory_sensor.h> + +using namespace wolf; + +// NOTE: This test and 'gtest_no_load_bodydynamics' complements each other +// In this test we load 'bodydynamics' and 'core' should be automatically loaded. +// To check if a plugin was loaded, we check the registering of a sensor to the factories: +// "SensorOdom2d" for 'core' +// "ProcessorForceTorquePreint" for 'bodydynamics' +WOLF_LOAD_BODYDYNAMICS; + +TEST(load_bodydynamics, DummyTestExample) +{ + EXPECT_TRUE(FactorySensorNode::isCreatorRegistered("SensorOdom2d")); + EXPECT_TRUE(FactoryProcessorNode::isCreatorRegistered("ProcessorForceTorquePreint")); +} + +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/gtest_no_load_bodydynamics.cpp b/test/gtest_no_load_bodydynamics.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5e80739f6cf199a2059e5cb834cb99d30f6ffd64 --- /dev/null +++ b/test/gtest_no_load_bodydynamics.cpp @@ -0,0 +1,44 @@ +// WOLF - Copyright (C) 2020,2021,2022,2023,2024 +// Institut de Robòtica i Informà tica Industrial, CSIC-UPC. +// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and +// Joan Vallvé Navarro (jvallve@iri.upc.edu) +// All rights reserved. +// +// This file is part of WOLF: http://www.iri.upc.edu/wolf +// WOLF is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include <gtest/gtest.h> +#include <core/utils/load_core.h> +#include <core/sensor/factory_sensor.h> + +using namespace wolf; + +// NOTE: This test and 'gtest_load_bodydynamics' complements each other +// In this test we load 'core' but not 'bodydynamics' +// To check if a plugin was loaded, we check the registering of a sensor to the FactorySensorNode: +// "SensorOdom2d" for 'core' +// "ProcessorForceTorquePreint" for 'bodydynamics' +WOLF_LOAD_CORE; + +TEST(no_load_bodydynamics, DummyTestExample) +{ + EXPECT_TRUE(FactorySensorNode::isCreatorRegistered("SensorOdom2d")); + EXPECT_FALSE(FactoryProcessorNode::isCreatorRegistered("ProcessorForceTorquePreint")); +} + +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}