2015-02-18 17:00:55 +01:00
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <glm/gtx/string_cast.hpp>
|
|
|
|
#include <objects/InstanceObject.hpp>
|
|
|
|
#include "test_globals.hpp"
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE(LifetimeTests)
|
|
|
|
|
2016-06-16 22:11:55 +02:00
|
|
|
#if RW_TEST_WITH_DATA
|
2015-02-18 17:00:55 +01:00
|
|
|
BOOST_AUTO_TEST_CASE(test_cleanup)
|
|
|
|
{
|
|
|
|
GameObject* f = Global::get().e->createInstance(1337, glm::vec3(0.f, 0.f, 1000.f));
|
2015-04-29 22:03:53 +02:00
|
|
|
auto id = f->getGameObjectID();
|
2016-04-15 02:06:10 +02:00
|
|
|
auto& objects = Global::get().e->instancePool.objects;
|
2015-04-29 22:03:53 +02:00
|
|
|
|
2015-02-18 17:00:55 +01:00
|
|
|
f->setLifetime(GameObject::TrafficLifetime);
|
|
|
|
|
|
|
|
{
|
2016-04-15 02:06:10 +02:00
|
|
|
auto search = objects.find(id);
|
|
|
|
BOOST_CHECK( search != objects.end() );
|
2015-02-18 17:00:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Global::get().e->cleanupTraffic(glm::vec3(0.f, 0.f, 0.f));
|
|
|
|
|
|
|
|
{
|
2016-04-15 02:06:10 +02:00
|
|
|
auto search = objects.find(id);
|
|
|
|
BOOST_CHECK( search != objects.end() );
|
2015-02-18 17:00:55 +01:00
|
|
|
}
|
|
|
|
}
|
2016-06-16 22:11:55 +02:00
|
|
|
#endif
|
2015-02-18 17:00:55 +01:00
|
|
|
|
2016-04-15 02:06:10 +02:00
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|