1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00
This commit is contained in:
Richard Fine
2019-01-01 14:54:04 +00:00
parent 315ea057fe
commit cec457fbf1

View File

@@ -1,6 +1,7 @@
#include "TestData.h"
#include "openrct2/core/StringReader.hpp"
#include "openrct2/peep/Peep.h"
#include "openrct2/ride/Station.h"
#include "openrct2/scenario/Scenario.h"
#include <gtest/gtest.h>
@@ -11,7 +12,6 @@
#include <openrct2/platform/platform.h>
#include <openrct2/world/Footpath.h>
#include <openrct2/world/Map.h>
#include "openrct2/ride/Station.h"
using namespace OpenRCT2;
@@ -51,7 +51,6 @@ public:
}
protected:
static Ride* FindRideByName(const char* name, int32_t* outRideIndex)
{
Ride* ride;
@@ -207,13 +206,12 @@ TEST_P(SimplePathfindingTest, CanFindPathFromStartToGoal)
auto entrancePos = ride_get_entrance_location(ride, 0);
TileCoordsXYZ goal = TileCoordsXYZ(
entrancePos.x - TileDirectionDelta[entrancePos.direction].x,
entrancePos.y - TileDirectionDelta[entrancePos.direction].y,
entrancePos.z);
entrancePos.y - TileDirectionDelta[entrancePos.direction].y, entrancePos.z);
const auto succeeded = FindPath(&pos, goal, scenario.steps, rideIndex) ? ::testing::AssertionSuccess()
: ::testing::AssertionFailure()
<< "Failed to find path from " << scenario.start << " to " << goal << " in " << scenario.steps
<< " steps; reached " << pos << " before giving up.";
: ::testing::AssertionFailure()
<< "Failed to find path from " << scenario.start << " to " << goal << " in " << scenario.steps << " steps; reached "
<< pos << " before giving up.";
EXPECT_TRUE(succeeded);
}
@@ -221,10 +219,8 @@ TEST_P(SimplePathfindingTest, CanFindPathFromStartToGoal)
INSTANTIATE_TEST_CASE_P(
ForScenario, SimplePathfindingTest,
::testing::Values(
SimplePathfindingScenario("StraightFlat", { 19, 15, 14 }, 24),
SimplePathfindingScenario("SBend", { 15, 12, 14 }, 88),
SimplePathfindingScenario("UBend", { 17, 9, 14 }, 86),
SimplePathfindingScenario("CBend", { 14, 5, 14 }, 164),
SimplePathfindingScenario("StraightFlat", { 19, 15, 14 }, 24), SimplePathfindingScenario("SBend", { 15, 12, 14 }, 88),
SimplePathfindingScenario("UBend", { 17, 9, 14 }, 86), SimplePathfindingScenario("CBend", { 14, 5, 14 }, 164),
SimplePathfindingScenario("TwoEqualRoutes", { 9, 13, 14 }, 87),
SimplePathfindingScenario("TwoUnequalRoutes", { 3, 13, 14 }, 87),
SimplePathfindingScenario("StraightUpBridge", { 12, 15, 14 }, 24),
@@ -249,8 +245,7 @@ TEST_P(ImpossiblePathfindingTest, CannotFindPathFromStartToGoal)
auto entrancePos = ride_get_entrance_location(ride, 0);
TileCoordsXYZ goal = TileCoordsXYZ(
entrancePos.x + TileDirectionDelta[entrancePos.direction].x,
entrancePos.y + TileDirectionDelta[entrancePos.direction].y,
entrancePos.z);
entrancePos.y + TileDirectionDelta[entrancePos.direction].y, entrancePos.z);
EXPECT_FALSE(FindPath(&pos, goal, 10000, rideIndex));
}