From 01a6ddb2b7109ddec9bc1f213158b93558254009 Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Sun, 5 Aug 2018 21:14:18 +0100 Subject: [PATCH] Extract Object Data test setup into fixture The setup between the two tests is the same. --- tests/test_ObjectData.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/test_ObjectData.cpp b/tests/test_ObjectData.cpp index 70742e6e..af7684de 100644 --- a/tests/test_ObjectData.cpp +++ b/tests/test_ObjectData.cpp @@ -3,17 +3,19 @@ #include #include "test_Globals.hpp" -BOOST_AUTO_TEST_SUITE(ObjectDataTests) +struct WithLoaderIDE { + LoaderIDE loader; +}; + +BOOST_FIXTURE_TEST_SUITE(ObjectDataTests, WithLoaderIDE) #if RW_TEST_WITH_DATA BOOST_AUTO_TEST_CASE(parses_basic_instance) { - LoaderIDE l; + loader.load(Global::get().getGamePath() + "/data/maps/generic.ide", {}); - l.load(Global::get().getGamePath() + "/data/maps/generic.ide", {}); + BOOST_ASSERT(loader.objects.find(1100) != loader.objects.end()); - BOOST_ASSERT(l.objects.find(1100) != l.objects.end()); - - auto obj = l.objects[1100].get(); + auto obj = loader.objects[1100].get(); auto def = dynamic_cast(obj); @@ -27,13 +29,11 @@ BOOST_AUTO_TEST_CASE(parses_basic_instance) { } BOOST_AUTO_TEST_CASE(parses_vehicle) { - LoaderIDE l; + loader.load(Global::get().getGamePath() + "/data/default.ide", {}); - l.load(Global::get().getGamePath() + "/data/default.ide", {}); + BOOST_ASSERT(loader.objects.find(90) != loader.objects.end()); - BOOST_ASSERT(l.objects.find(90) != l.objects.end()); - - auto obj = l.objects[90].get(); + auto obj = loader.objects[90].get(); auto def = dynamic_cast(obj);