refactor test project and add ride ratings test

This commit is contained in:
IntelOrca 2015-06-04 12:46:17 +01:00
parent f6eec3725c
commit bb309f34c6
17 changed files with 279 additions and 38 deletions

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release with Tests|Win32">
<Configuration>Release with Tests</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -28,6 +32,13 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -37,6 +48,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\build\$(Configuration)\</OutDir>
@ -46,6 +60,10 @@
<OutDir>$(SolutionDir)..\build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)..\obj\$(ProjectName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<OutDir>$(SolutionDir)..\build\Release\</OutDir>
<IntDir>$(SolutionDir)..\obj\$(ProjectName)\Release\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@ -73,6 +91,23 @@
<Command>xcopy /Y "$(SolutionDir)\..\Data\Language\*.*" "$(TargetDir)\Data\Language\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>xcopy /Y "$(SolutionDir)\..\Data\Language\*.*" "$(TargetDir)\Data\Language\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="..\..\data\language\dutch.txt" />
<Text Include="..\..\data\language\english_uk.txt" />

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release with Tests|Win32">
<Configuration>Release with Tests</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -28,6 +32,13 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -37,6 +48,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\build\$(Configuration)\</OutDir>
@ -49,6 +63,12 @@
<IncludePath>..\..\lib\libcurl\include;..\..\lib\jansson;..\..\lib\cutest\CuTest.h;$(IncludePath)</IncludePath>
<LibraryPath>..\..\lib\libcurl\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<OutDir>$(SolutionDir)..\build\Release\</OutDir>
<IntDir>$(SolutionDir)..\obj\$(ProjectName)\Release\</IntDir>
<IncludePath>..\..\lib\libcurl\include;..\..\lib\jansson;..\..\lib\cutest\CuTest.h;$(IncludePath)</IncludePath>
<LibraryPath>..\..\lib\libcurl\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@ -87,10 +107,36 @@
<Command>Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;NS_ENABLE_THREADS;NS_ENABLE_SSL;DISABLE_MD5;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>libcurl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\lib\argparse\argparse.c">
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">TurnOffAllWarnings</WarningLevel>
</ClCompile>
<ClCompile Include="..\..\lib\cutest\CuTest.c" />
<ClCompile Include="..\..\lib\jansson\jansson\dump.c" />
@ -107,6 +153,7 @@
<ClCompile Include="..\..\lib\libspeex\resample.c">
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">TurnOffAllWarnings</WarningLevel>
</ClCompile>
<ClCompile Include="..\..\lib\lodepng\lodepng.c" />
</ItemGroup>

View File

@ -119,8 +119,6 @@
<ClInclude Include="..\..\lib\jansson\jansson\utf.h">
<Filter>jansson</Filter>
</ClInclude>
<ClCompile Include="..\..\lib\cutest\CuTest.h">
<Filter>cutest</Filter>
</ClCompile>
<ClInclude Include="..\..\lib\cutest\CuTest.h" />
</ItemGroup>
</Project>

View File

@ -15,19 +15,26 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release with Tests|Win32 = Release with Tests|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|Win32.ActiveCfg = Debug|Win32
{D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|Win32.Build.0 = Debug|Win32
{D24D94F6-2A74-480C-B512-629C306CE92F}.Release with Tests|Win32.ActiveCfg = Release with Tests|Win32
{D24D94F6-2A74-480C-B512-629C306CE92F}.Release with Tests|Win32.Build.0 = Release with Tests|Win32
{D24D94F6-2A74-480C-B512-629C306CE92F}.Release|Win32.ActiveCfg = Release|Win32
{D24D94F6-2A74-480C-B512-629C306CE92F}.Release|Win32.Build.0 = Release|Win32
{0468FC1E-5881-4DB9-9DDE-1892290B31D9}.Debug|Win32.ActiveCfg = Debug|Win32
{0468FC1E-5881-4DB9-9DDE-1892290B31D9}.Debug|Win32.Build.0 = Debug|Win32
{0468FC1E-5881-4DB9-9DDE-1892290B31D9}.Release with Tests|Win32.ActiveCfg = Release with Tests|Win32
{0468FC1E-5881-4DB9-9DDE-1892290B31D9}.Release with Tests|Win32.Build.0 = Release with Tests|Win32
{0468FC1E-5881-4DB9-9DDE-1892290B31D9}.Release|Win32.ActiveCfg = Release|Win32
{0468FC1E-5881-4DB9-9DDE-1892290B31D9}.Release|Win32.Build.0 = Release|Win32
{074DC930-05C6-4B7F-B5DD-DD237E6E44DB}.Debug|Win32.ActiveCfg = Debug|Win32
{074DC930-05C6-4B7F-B5DD-DD237E6E44DB}.Debug|Win32.Build.0 = Debug|Win32
{074DC930-05C6-4B7F-B5DD-DD237E6E44DB}.Release with Tests|Win32.ActiveCfg = Release with Tests|Win32
{074DC930-05C6-4B7F-B5DD-DD237E6E44DB}.Release with Tests|Win32.Build.0 = Release with Tests|Win32
{074DC930-05C6-4B7F-B5DD-DD237E6E44DB}.Release|Win32.ActiveCfg = Release|Win32
{074DC930-05C6-4B7F-B5DD-DD237E6E44DB}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection

View File

@ -10,6 +10,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release with Tests|Win32">
<Configuration>Release with Tests</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -40,6 +44,8 @@
<ClCompile Include="..\src\interface\themes.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\interface\console.c" />
<ClCompile Include="..\src\interface\graph.c" />
@ -83,8 +89,9 @@
<ClCompile Include="..\src\ride\vehicle.c" />
<ClCompile Include="..\src\scenario.c" />
<ClCompile Include="..\src\scenario_list.c" />
<ClCompile Include="..\src\test\management\finance_test.c" />
<ClCompile Include="..\src\test\tests.c" />
<ClCompile Include="..\test\management\finance_test.c" />
<ClCompile Include="..\test\ride\ride_ratings_test.c" />
<ClCompile Include="..\test\tests.c" />
<ClCompile Include="..\src\title.c" />
<ClCompile Include="..\src\tutorial.c" />
<ClCompile Include="..\src\util\sawyercoding.c" />
@ -150,6 +157,8 @@
<ClCompile Include="..\src\windows\themes.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\world\banner.c" />
<ClCompile Include="..\src\world\climate.c" />
@ -180,6 +189,8 @@
<ClInclude Include="..\src\interface\themes.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\src\interface\console.h" />
<ClInclude Include="..\src\interface\graph.h" />
@ -218,8 +229,9 @@
<ClInclude Include="..\src\ride\vehicle.h" />
<ClInclude Include="..\src\scenario.h" />
<ClInclude Include="..\src\sprites.h" />
<ClInclude Include="..\src\test\management\finance_test.h" />
<ClInclude Include="..\src\test\tests.h" />
<ClInclude Include="..\test\management\finance_test.h" />
<ClInclude Include="..\test\ride\ride_ratings_test.h" />
<ClInclude Include="..\test\tests.h" />
<ClInclude Include="..\src\title.h" />
<ClInclude Include="..\src\tutorial.h" />
<ClInclude Include="..\src\util\sawyercoding.h" />
@ -265,6 +277,13 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -274,6 +293,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)..\lodepng;$(SolutionDir)..\sdl\include;$(SolutionDir)..\libspeex;$(IncludePath)</IncludePath>
@ -289,6 +311,13 @@
<CustomBuildBeforeTargets>
</CustomBuildBeforeTargets>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<IncludePath>$(SolutionDir)..\lib;$(SolutionDir)..\lib\libspeex;$(SolutionDir)..\lib\sdl\include;$(SolutionDir)..\lib\libcurl\include;$(SolutionDir)..\lib\jansson;$(SolutionDir)..\lib\cutest;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\lib\sdl\lib\x86;$(SolutionDir)..\lib\libcurl\lib;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)..\build\Release\</OutDir>
<IntDir>$(SolutionDir)..\obj\$(ProjectName)\Release\</IntDir>
<CustomBuildBeforeTargets />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@ -330,6 +359,45 @@
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\openrct2.exe" sprite build "$(SolutionDir)\..\Data\g2.dat" "$(SolutionDir)\..\Resources\g2\"
xcopy /Y "$(SolutionDir)\..\Data\*.*" "$(TargetDir)\Data\"</Command>
<Message>Build g2.dat and copy the Data directory.</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>
</Command>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>
</Outputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<TreatSpecificWarningsAsErrors>4013</TreatSpecificWarningsAsErrors>
<OmitFramePointers>
</OmitFramePointers>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;ENABLE_TESTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)fake\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>winmm.lib;sdl2.lib;Dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\openrct2.exe" sprite build "$(SolutionDir)\..\Data\g2.dat" "$(SolutionDir)\..\Resources\g2\"
xcopy /Y "$(SolutionDir)\..\Data\*.*" "$(TargetDir)\Data\"</Command>
<Message>Build g2.dat and copy the Data directory.</Message>
</PostBuildEvent>

View File

@ -50,6 +50,9 @@
<Filter Include="Test\Management">
<UniqueIdentifier>{73238872-312d-437f-8497-7cb66466d835}</UniqueIdentifier>
</Filter>
<Filter Include="Test\Ride">
<UniqueIdentifier>{c6b9c169-ff2a-41df-9b1c-47d15763c3e2}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="..\openrct2.exe">
@ -462,12 +465,15 @@
<ClCompile Include="..\src\windows\themes.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\test\tests.c">
<ClCompile Include="..\test\tests.c">
<Filter>Test</Filter>
</ClCompile>
<ClCompile Include="..\src\test\management\finance_test.c">
<ClCompile Include="..\test\management\finance_test.c">
<Filter>Test\Management</Filter>
</ClCompile>
<ClCompile Include="..\test\ride\ride_ratings_test.c">
<Filter>Test\Ride</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\management\award.h">
@ -683,11 +689,14 @@
<ClInclude Include="..\src\interface\themes.h">
<Filter>Source\Interface</Filter>
</ClInclude>
<ClInclude Include="..\src\test\tests.h">
<ClInclude Include="..\test\tests.h">
<Filter>Test</Filter>
</ClInclude>
<ClInclude Include="..\src\test\management\finance_test.h">
<ClInclude Include="..\test\management\finance_test.h">
<Filter>Test\Management</Filter>
</ClInclude>
<ClInclude Include="..\test\ride\ride_ratings_test.h">
<Filter>Test\Ride</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -7,6 +7,12 @@
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>test</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>

View File

@ -27,6 +27,15 @@
#include "platform/platform.h"
#include "util/util.h"
#ifdef ENABLE_TESTS
#include "../test/tests.h"
#else
static int cmdline_for_test_error(const char **argv, int argc)
{
printf("OpenRCT2 has not been built with the test suite.\n");
}
#endif
typedef struct tm tm_t;
typedef struct argparse_option argparse_option_t;
typedef struct argparse argparse_t;
@ -123,13 +132,6 @@ static int cmdline_for_edit(const char **argv, int argc)
return 0;
}
static int cmdline_for_test(const char **argv, int argc)
{
gOpenRCT2StartupAction = STARTUP_ACTION_TEST;
gOpenRCT2Headless = true;
return 0;
}
static int cmdline_for_none(const char **argv, int argc)
{
assert(argc >= 1);
@ -149,7 +151,12 @@ struct { const char *firstArg; cmdline_action action; } cmdline_table[] = {
{ "edit", cmdline_for_edit },
{ "sprite", cmdline_for_sprite },
{ "screenshot", cmdline_for_screenshot },
{ "test", cmdline_for_test }
#ifdef ENABLE_TESTS
{ "test", cmdline_for_test },
#else
{ "test", cmdline_for_test_error },
#endif
};
static int cmdline_call_action(const char **argv, int argc)

View File

@ -30,7 +30,6 @@
#include "platform/platform.h"
#include "util/sawyercoding.h"
#include "world/mapgen.h"
#include "test/tests.h"
int gOpenRCT2StartupAction = STARTUP_ACTION_TITLE;
char gOpenRCT2StartupActionPath[512] = { 0 };
@ -186,11 +185,6 @@ void openrct2_launch()
editor_load_landscape(gOpenRCT2StartupActionPath);
}
break;
case STARTUP_ACTION_TEST:
gExitCode = run_all_tests();
openrct2_dispose();
exit(gExitCode);
return;
}
openrct2_loop();
}

View File

@ -27,8 +27,7 @@ enum {
STARTUP_ACTION_INTRO,
STARTUP_ACTION_TITLE,
STARTUP_ACTION_OPEN,
STARTUP_ACTION_EDIT,
STARTUP_ACTION_TEST
STARTUP_ACTION_EDIT
};
extern int gOpenRCT2StartupAction;

2
test.bat Normal file
View File

@ -0,0 +1,2 @@
msbuild .\projects\openrct2.sln "/p:Configuration=Release with Tests" /p:Platform=Win32
.\build\Release\openrct2.exe test

View File

@ -18,11 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "../../addresses.h"
#include "../../openrct2.h"
#include "../../scenario.h"
#include "../../src/addresses.h"
#include "../../src/management/finance.h"
#include "../../src/openrct2.h"
#include "../../src/scenario.h"
#include "../../management/finance.h"
#include "finance_test.h"
void test_finance_setup(CuTest* tc) {

View File

@ -0,0 +1,38 @@
#include "../../src/ride/ride_ratings.h"
#include "../../src/localisation/localisation.h"
#include "ride_ratings_test.h"
void test_ride_ratings_setup(CuTest* tc) {
test_load_scenario(tc, "Six Flags Magic Mountain.SC6");
}
void test_ride_ratings(CuTest* tc) {
int i;
rct_ride *ride;
rating_tuple *rideRatings = malloc(256 * sizeof(rating_tuple));
char rideName[256];
char buffer[256];
// Store original ride ratings
FOR_ALL_RIDES(i, ride)
rideRatings[i] = ride->ratings;
// Update all the ride ratings
// TODO use a better function that can just be called once for each ride
for (int i = 0; i < MAX_RIDES * 10; i++)
ride_ratings_update_all();
FOR_ALL_RIDES(i, ride) {
format_string(rideName, ride->name, &ride->name_arguments);
sprintf(buffer, "[%s.excitement]", rideName);
CuAssertIntEquals_Msg(tc, buffer, rideRatings[i].excitement, ride->excitement);
sprintf(buffer, "[%s.intensity]", rideName);
CuAssertIntEquals_Msg(tc, buffer, rideRatings[i].intensity, ride->intensity);
sprintf(buffer, "[%s.nausea]", rideName);
CuAssertIntEquals_Msg(tc, buffer, rideRatings[i].nausea, ride->nausea);
}
free(rideRatings);
}

View File

@ -0,0 +1,9 @@
#ifndef _RIDE_RATINGS_TEST_H_
#define _RIDE_RATINGS_TEST_H_
#include "../tests.h"
void test_ride_ratings_setup(CuTest* tc);
void test_ride_ratings(CuTest* tc);
#endif

View File

@ -18,7 +18,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "../src/openrct2.h"
#include "management/finance_test.h"
#include "ride/ride_ratings_test.h"
int cmdline_for_test(const char **argv, int argc)
{
// NOTE Currently all tests are running in a OpenRCT2 setup frame. Tests for the initialisation and disposing should be
// separate and independent.
int numFailedTests;
gOpenRCT2Headless = true;
if (openrct2_initialise()) {
numFailedTests = run_all_tests();
openrct2_dispose();
}
return numFailedTests > 0 ? -1 : 1;
}
CuSuite* new_suite(void)
{
@ -29,6 +47,10 @@ CuSuite* new_suite(void)
SUITE_ADD_TEST(suite, test_finance_loan_increase);
SUITE_ADD_TEST(suite, test_finance_loan_pay_back);
// Test Ride
SUITE_ADD_TEST(suite, test_ride_ratings_setup);
SUITE_ADD_TEST(suite, test_ride_ratings);
// Future Tests:
// Test X
// SUITE_ADD_TEST(suite, test_X_setup);
@ -50,5 +72,5 @@ int run_all_tests(void)
CuSuiteDetails(suite, output);
printf("Test results:\n%s\n", output->buffer);
return suite->failCount > 0;
return suite->failCount;
}

View File

@ -22,16 +22,16 @@
#define _TESTS_H_
#include <stdio.h>
#include <CuTest.h>
#include "../src/common.h"
#include "../scenario.h"
int cmdline_for_test(const char **argv, int argc);
int run_all_tests();
/*
* Test utilities
*/
// Test utilities
#include "../src/scenario.h"
static void test_load_scenario(CuTest* tc, const char* file_name) {
const rct_scenario_basic* scenario = get_scenario_by_filename(file_name);
if (scenario == NULL) {