OpenRCT2/test/tests/MultiLaunch.cpp

66 lines
1.8 KiB
C++
Raw Permalink Normal View History

/*****************************************************************************
* Copyright (c) 2014-2018 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
2018-06-22 22:29:03 +02:00
#include "TestData.h"
2017-06-21 18:39:10 +02:00
#include <gtest/gtest.h>
#include <openrct2/Context.h>
2018-06-22 22:29:03 +02:00
#include <openrct2/Game.h>
2017-08-27 22:40:56 +02:00
#include <openrct2/GameState.h>
2017-06-21 18:39:10 +02:00
#include <openrct2/OpenRCT2.h>
#include <openrct2/ParkImporter.h>
2018-06-22 22:29:03 +02:00
#include <openrct2/audio/AudioContext.h>
#include <openrct2/core/File.h>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/platform/platform.h>
2018-06-22 22:29:03 +02:00
#include <openrct2/ride/Ride.h>
#include <string>
2017-06-21 18:39:10 +02:00
using namespace OpenRCT2;
constexpr int32_t updatesToTest = 10;
2017-08-27 22:40:56 +02:00
2017-06-21 18:39:10 +02:00
TEST(MultiLaunchTest, all)
{
std::string path = TestData::GetParkPath("bpb.sv6");
gOpenRCT2Headless = true;
2018-04-10 13:33:37 +02:00
gOpenRCT2NoGraphics = true;
2017-06-21 18:39:10 +02:00
core_init();
for (int i = 0; i < 3; i++)
2017-06-21 18:39:10 +02:00
{
auto context = CreateContext();
bool initialised = context->Initialise();
ASSERT_TRUE(initialised);
2018-05-21 20:06:21 +02:00
load_from_sv6(path.c_str());
game_load_init();
2017-06-21 18:39:10 +02:00
// Check ride count to check load was successful
2019-08-03 19:11:30 +02:00
ASSERT_EQ(ride_get_count(), 134);
2017-08-27 22:40:56 +02:00
auto gs = context->GetGameState();
ASSERT_NE(gs, nullptr);
auto& date = gs->GetDate();
ASSERT_EQ(date.GetMonthTicks(), 0);
2017-06-21 18:39:10 +02:00
2017-08-27 22:40:56 +02:00
for (int j = 0; j < updatesToTest; j++)
{
2017-08-27 22:40:56 +02:00
gs->UpdateLogic();
}
ASSERT_EQ(date.GetMonthTicks(), 7862 + updatesToTest);
2017-08-27 22:40:56 +02:00
// Check ride count again
2019-08-03 19:11:30 +02:00
ASSERT_EQ(ride_get_count(), 134);
2017-06-21 18:39:10 +02:00
}
SUCCEED();
}