Skip to content

Commit

Permalink
Make TestLibLoader header-only
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Dec 8, 2022
1 parent 42aec9e commit 57ec5eb
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 98 deletions.
1 change: 0 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ add_subdirectory(gtest_vendor)
add_subdirectory(benchmark)
add_subdirectory(common_test)
add_subdirectory(plugins)
add_subdirectory(helpers)
add_subdirectory(integration)
add_subdirectory(performance)
add_subdirectory(regression)
Expand Down
1 change: 0 additions & 1 deletion test/common_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ foreach(test ${tests})
${PROJECT_LIBRARY_TARGET_NAME}-mesh
gtest
gtest_main
${PROJECT_NAME}_test_lib_loader
)

target_compile_definitions(${test_executable} PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*
*/

#include "TestLibLoader.hh"
#ifndef GZ_PHYSICS_TESTLIBLOADER_HH_
#define GZ_PHYSICS_TESTLIBLOADER_HH_

#include <iostream>
#include <string>
Expand All @@ -24,13 +24,16 @@
#include <gz/common/Filesystem.hh>
#include <gz/common/Util.hh>

std::string gz::physics::TestLibLoader::libToTest = std::string("");

namespace gz
{
namespace physics
{
bool TestLibLoader::init(int argc, char *argv[])
class TestLibLoader
{
/// brief Initialize command line arguments
/// \param[in] argc Number of arguments
/// \param[in] argv Vector with the arguments
public: static bool init(int argc, char *argv[])
{
if (argc != 2)
{
Expand All @@ -42,12 +45,17 @@ namespace physics
return true;
}

std::string TestLibLoader::GetLibToTest()
/// \brief Get the name of the library to test
/// \return Name of the library to test
public: static std::string GetLibToTest()
{
return libToTest;
}

std::string TestLibLoader::PhysicsEngineName(std::string _name)
/// \brief Get Physics Engine name based on the plugin name
/// \param[in] _name Plugin name
/// \return Name of the Physics Engine
std::string PhysicsEngineName(std::string _name)
{
std::vector<std::string> tokens = gz::common::split(_name, "::");
if (tokens.size() == 4)
Expand All @@ -66,5 +74,12 @@ namespace physics
}
return "";
}

private: static std::string libToTest;
};
}
}

std::string gz::physics::TestLibLoader::libToTest = std::string("");

#endif
2 changes: 1 addition & 1 deletion test/common_test/addexternalforcetorque.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <gz/math/Vector3.hh>
#include <gz/math/eigen3/Conversions.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"
#include "../Utils.hh"

#include <gz/physics/FindFeatures.hh>
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/basic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <gz/common/Console.hh>
#include <gz/plugin/Loader.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"

#include <gz/physics/FindFeatures.hh>
#include <gz/physics/GetEntities.hh>
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/collisions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <gz/common/Console.hh>
#include <gz/plugin/Loader.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"

#include <gz/physics/FindFeatures.hh>
#include <gz/physics/RequestEngine.hh>
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/construct_empty_world.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <gz/common/Console.hh>
#include <gz/plugin/Loader.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"

#include <gz/physics/ConstructEmpty.hh>
#include <gz/physics/FindFeatures.hh>
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/free_joint_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <tuple>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"

#include <gz/common/Console.hh>
#include <gz/common/Util.hh>
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/joint_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <gz/math/Helpers.hh>
#include <gz/math/eigen3/Conversions.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"
#include "../Utils.hh"

#include "gz/physics/FrameSemantics.hh"
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/kinematic_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <gz/common/Console.hh>
#include <gz/plugin/Loader.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"
#include "../Utils.hh"

#include <gz/physics/ConstructEmpty.hh>
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/link_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <gz/math/Vector3.hh>
#include <gz/math/eigen3/Conversions.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"
#include "../Utils.hh"

#include <gz/physics/FindFeatures.hh>
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/shape_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <gz/common/Console.hh>
#include <gz/plugin/Loader.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"
#include "../Utils.hh"

// Features
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/simulation_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <gz/math/eigen3/Conversions.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"
#include "../Utils.hh"

#include <gz/physics/sdf/ConstructJoint.hh>
Expand Down
2 changes: 1 addition & 1 deletion test/common_test/world_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <gz/common/Console.hh>
#include <gz/plugin/Loader.hh>

#include "../helpers/TestLibLoader.hh"
#include "TestLibLoader.hh"
#include "../Utils.hh"

#include <gz/physics/FindFeatures.hh>
Expand Down
9 changes: 0 additions & 9 deletions test/helpers/CMakeLists.txt

This file was deleted.

69 changes: 0 additions & 69 deletions test/helpers/TestLibLoader.hh

This file was deleted.

0 comments on commit 57ec5eb

Please sign in to comment.