1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +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/String.hpp>
#include <openrct2/OpenRCT2.h>
#include "TestData.h"
extern "C"
{
@@ -55,8 +56,7 @@ protected:
TEST_F(RideRatings, all)
{
std::string testdataPath = "testdata";
std::string path = Path::Combine(testdataPath, "parks", "sfmm.sc6");
std::string path = TestData::GetParkPath("sfmm.sc6");
gOpenRCT2Headless = true;
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 -->
<ItemGroup>
<ClInclude Include="AssertHelpers.hpp" />
<ClInclude Include="TestData.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="LanguagePackTest.cpp" />
@@ -56,6 +57,7 @@
<ClCompile Include="RideRatings.cpp" />
<ClCompile Include="sawyercoding_test.cpp" />
<ClCompile Include="$(GtestDir)\src\gtest-all.cc" />
<ClCompile Include="TestData.cpp" />
<ClCompile Include="tests.cpp" />
<ClCompile Include="StringTest.cpp" />
</ItemGroup>