1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Create test data helpers

This commit is contained in:
Ted John
2017-01-11 17:15:24 +00:00
parent cf7f1b7335
commit b28fde6ae7
4 changed files with 29 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
#include <openrct2/core/Path.hpp> #include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp> #include <openrct2/core/String.hpp>
#include <openrct2/OpenRCT2.h> #include <openrct2/OpenRCT2.h>
#include "TestData.h"
extern "C" extern "C"
{ {
@@ -55,8 +56,7 @@ protected:
TEST_F(RideRatings, all) TEST_F(RideRatings, all)
{ {
std::string testdataPath = "testdata"; std::string path = TestData::GetParkPath("sfmm.sc6");
std::string path = Path::Combine(testdataPath, "parks", "sfmm.sc6");
gOpenRCT2Headless = true; gOpenRCT2Headless = true;
core_init(); core_init();

16
test/tests/TestData.cpp Normal file
View File

@@ -0,0 +1,16 @@
#include <openrct2/core/Path.hpp>
#include "TestData.h"
namespace TestData
{
std::string GetBasePath()
{
return "testdata";
}
std::string GetParkPath(std::string name)
{
std::string path = Path::Combine(GetBasePath(), "parks", name);
return path;
}
};

9
test/tests/TestData.h Normal file
View File

@@ -0,0 +1,9 @@
#include <string>
#pragma once
namespace TestData
{
std::string GetBasePath();
std::string GetParkPath(std::string name);
};

View File

@@ -48,6 +48,7 @@
<!-- Files --> <!-- Files -->
<ItemGroup> <ItemGroup>
<ClInclude Include="AssertHelpers.hpp" /> <ClInclude Include="AssertHelpers.hpp" />
<ClInclude Include="TestData.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="LanguagePackTest.cpp" /> <ClCompile Include="LanguagePackTest.cpp" />
@@ -56,6 +57,7 @@
<ClCompile Include="RideRatings.cpp" /> <ClCompile Include="RideRatings.cpp" />
<ClCompile Include="sawyercoding_test.cpp" /> <ClCompile Include="sawyercoding_test.cpp" />
<ClCompile Include="$(GtestDir)\src\gtest-all.cc" /> <ClCompile Include="$(GtestDir)\src\gtest-all.cc" />
<ClCompile Include="TestData.cpp" />
<ClCompile Include="tests.cpp" /> <ClCompile Include="tests.cpp" />
<ClCompile Include="StringTest.cpp" /> <ClCompile Include="StringTest.cpp" />
</ItemGroup> </ItemGroup>