Skip to content

Commit

Permalink
Make it compile, don't use gtest
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <louise@openrobotics.org>
  • Loading branch information
chapulina committed Apr 6, 2021
1 parent 7c60712 commit ac86f6f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
10 changes: 9 additions & 1 deletion examples/simple_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ find_package(ignition-plugin${IGN_PLUGIN_VER} 1.1 REQUIRED COMPONENTS all)
set(IGN_PHYSICS_VER 2)
find_package(ignition-physics${IGN_PHYSICS_VER} REQUIRED)

add_library(SimplePlugin SHARED plugin.cc)
add_library(SimplePlugin SHARED plugin.cc EntityManagementFeatures.cc)
target_link_libraries(SimplePlugin
PRIVATE
ignition-physics${IGN_PHYSICS_VER}::ignition-physics${IGN_PHYSICS_VER})

add_executable(PluginTest EntityManagementFeatures_TEST.cc)
target_link_libraries(PluginTest
ignition-plugin${IGN_PLUGIN_VER}::loader
ignition-physics${IGN_PHYSICS_VER}::ignition-physics${IGN_PHYSICS_VER})

target_compile_definitions(PluginTest PRIVATE
"simple_plugin_LIB=\"$<TARGET_FILE:SimplePlugin>\"")
10 changes: 6 additions & 4 deletions examples/simple_plugin/EntityManagementFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

using namespace ignition;
using namespace physics;
using namespace simplelugin;
using namespace simpleplugin;

/////////////////////////////////////////////////
Identity EntityManagementFeatures::ConstructEmptyWorld(
const Identity &, const std::string &_name)
{
auto world = std::make_shared<tpelib::World>();
world->SetName(_name);
return this->AddWorld(world);
// Needs feature
// auto world = std::make_shared<Entity>();
// world->SetName(_name);
// return this->AddWorld(world);
return this->GenerateInvalidId();
}
18 changes: 10 additions & 8 deletions examples/simple_plugin/EntityManagementFeatures_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*
*/

#include <gtest/gtest.h>
#include <iostream>

#include <ignition/plugin/Loader.hh>
#include <ignition/physics/RequestEngine.hh>
#include "EntityManagementFeatures.hh"
Expand All @@ -24,7 +25,7 @@ struct TestFeatureList : ignition::physics::FeatureList<
ignition::physics::simpleplugin::EntityManagementFeatureList
> { };

TEST(EntityManagement_TEST, ConstructEmptyWorld)
int main(int argc, char *argv[])
{
ignition::plugin::Loader loader;
loader.LoadLib(simple_plugin_LIB);
Expand All @@ -35,11 +36,12 @@ TEST(EntityManagement_TEST, ConstructEmptyWorld)
auto engine =
ignition::physics::RequestEngine3d<TestFeatureList>::From(simple_plugin);
auto world = engine->ConstructEmptyWorld("empty world");
ASSERT_NE(nullptr, world);
}

int main(int argc, char *argv[])
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
if (nullptr != world)
std::cout << "Created empty world" << std::endl;
else
std::cout << "Failed to create empty world" << std::endl;

// Needs feature
// std::cout << world->GetName() << std::endl;
}

0 comments on commit ac86f6f

Please sign in to comment.