1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 06:52:34 +02:00

Add LoaderIPL tests for inst section

This commit is contained in:
Daniel Evans 2018-08-07 01:18:01 +01:00
parent 2a50194f5b
commit 7938f8678f

View File

@ -1,5 +1,6 @@
#include <boost/test/unit_test.hpp>
#include <loaders/LoaderIPL.hpp>
#include <data/InstanceData.hpp>
#include "test_Globals.hpp"
namespace {
@ -8,6 +9,12 @@ zone
ZONE_A, 1, -100.0, -200.00, -100.0, 100.0, 1000.0, 100.0, 1
ZONE_B, 0, 200.0, 10.0, -100.0, 100.0, 1000.0, 100.0, 2
end
inst
101, ModelA, 10.0, 12.0, 5.0, 1, 1, 1, 0, 0, -0.70, 0.70
112, ModelB, 10.0, 12.0, 5.0, 1, 1, 1, 0, 0, -0.70, 0.70
112, ModelB, 11.0, 12.0, 5.0, 1, 1, 1, 0, 0, 0, 1
end
)";
}
@ -21,7 +28,6 @@ BOOST_FIXTURE_TEST_SUITE(LoaderIPLTests, WithLoaderIPL)
BOOST_AUTO_TEST_CASE(zone_count_is_correct) {
BOOST_REQUIRE(loader.load(test_data_stream));
BOOST_TEST(loader.zones.size() == 2);
}
@ -35,4 +41,21 @@ BOOST_AUTO_TEST_CASE(zone_data_is_correct) {
BOOST_TEST(zone1.island == 2);
}
BOOST_AUTO_TEST_CASE(instance_count_is_correct) {
BOOST_REQUIRE(loader.load(test_data_stream));
BOOST_TEST(loader.m_instances.size() == 3);
}
BOOST_AUTO_TEST_CASE(instance_data_is_correct) {
BOOST_REQUIRE(loader.load(test_data_stream));
auto& instance = loader.m_instances[1];
BOOST_TEST(instance->id == 112);
BOOST_TEST(instance->model == "ModelB");
BOOST_TEST(instance->pos.x == 10.0f);
BOOST_TEST(instance->pos.y == 12.0f);
BOOST_TEST(instance->pos.z == 5.0f);
BOOST_TEST(instance->rot.x == 0.0f);
}
BOOST_AUTO_TEST_SUITE_END()