Commit Graph

189 Commits

Author SHA1 Message Date
Tom Lankhorst ed353faccf Implement replace_if condition lambda
Fix include typo and CS
2019-05-11 13:54:16 +01:00
Tom Lankhorst 744f2225ed Write platform tests 2019-05-11 13:54:16 +01:00
Gymnasiast 17ddd451db Fix tests, fix formatting 2019-05-07 20:04:07 +02:00
NexGenration e6c88a05db Make peep generate a static member function 2019-05-07 19:34:50 +02:00
Duncan 9c4430736d
Use get track element (#8884)
* Use get_track_element and change its return type

* Make things work

* Use helper functions where possible
2019-03-16 11:21:36 +00:00
Matt 15838861cd Add load and save test. 2019-03-02 13:11:08 +01:00
Ted John cdec457abd Refactor peep struct 2019-02-28 20:28:58 +01:00
Matt c631177877 [ci skip] Add bpb.sv6 to the replays with 7000 ticks. 2019-02-16 09:09:51 +01:00
ζeh Matt 20989ae4d8
Merge pull request #8675 from tomlankhorst/compress-replays
.sv6r version 2: introducing compression
2019-02-10 11:01:26 +01:00
Michał Janiszewski 2f16ad164d
Merge pull request #8671 from tomlankhorst/cmake-link-with-platform
Link targets with platform specific libs
2019-02-07 23:40:46 +01:00
Matt 598ea08529 Update copyright. 2019-02-07 18:50:58 +01:00
Matt 49a6ae7894 Add CircularBuffer test. 2019-02-07 18:50:58 +01:00
Tom Lankhorst 756b52186e
Normalised and upgraded all replays 2019-02-06 10:24:10 +01:00
Tom Lankhorst 94758bccf6
Link with platform libraries 2019-02-05 20:17:14 +01:00
Michał Janiszewski 6bdbe248fd
Merge pull request #8641 from tomlankhorst/use-lto
Detect availability of LTO, apply when available
2019-02-04 00:06:37 +01:00
Tom Lankhorst ce6e08c633
Introduce SET_CHECK_CXX_FLAGS 2019-02-03 23:32:51 +01:00
Tom Lankhorst 6a42a95495
Refactor random engine
Introduce RotateEngine and Rct2Engine, FixedSeedSequence and Rct2Seed.
Adhere respectively to requirements `RandomNumberEngine` and `SeedSequence`.
Can be used with C++11 adaptors and distributions in <random>.
2019-02-01 14:32:04 +01:00
Ted John 8701286772
Use new ride_id_t typedef (#8561) 2019-01-12 10:11:55 +00:00
Matt b01c93ba4c Normalise replays. 2019-01-07 09:04:51 +01:00
Michał Janiszewski 37535f4642 Release ImageImporter'd buffer after the test is done 2019-01-02 20:14:28 +01:00
Richard Fine cec457fbf1 Reformat 2019-01-02 14:12:51 +00:00
Richard Fine 315ea057fe Verify that peeps stay on paths
As per PR recommendation, confirm that a peep is still on the footpath for every step of the pathfinding tests.
2019-01-02 14:12:51 +00:00
Richard Fine bb4e79ddda Rework tests to use ride entrances as path targets
It turns out that trying to just give a peep a pathfinding goal and then let them loose doesn't work, because every time they reach a junction, the pathfinder has them walk 'aimlessly' instead of pursuing their target. That's why we were seeing some very large step counts in previous tests - they were (eventually) walking onto the target square, but only after lots of wandering around in circles.

This commit reworks the test data to contain an actual ride for each test scenario, where the peep will path to the tile in front of the ride entrance. A nice side benefit of this is that the ride names must match the test names, so you can now tell from looking at the rides in the test data which one is used for which test instance.

The 'yellow marker' tiles for goal positions are also removed here, as we're deriving goal positions from the ride entrances instead.
2019-01-02 14:12:51 +00:00
Richard Fine c8c1abd10a Reformat 2019-01-02 14:12:51 +00:00
Richard Fine a20c8d61be Call core_init instead of bitcount_init 2019-01-02 14:12:51 +00:00
Richard Fine 280a0c61e4 Rename maxSteps to expectedSteps
To make it a little clearer what the parameter is for, rename FindPath::maxSteps to FindPath::expectedSteps, and extend the comment to describe what happens in negative test scenarios.
2019-01-02 14:12:51 +00:00
Richard Fine 357ee293f3 Remove default value for SimplePathfindingScenario steps
Remove the default value as it's more consistent to just always have the test case specify it explicitly.
2019-01-02 14:12:51 +00:00
Richard Fine 49e46f8940 Replace GetSurfaceStyleAtLocation with map_get_surface_element_at
There exists a helper function map_get_surface_element_at which already searches a tile's element list for the surface element, so we can just use that.
2019-01-02 14:12:51 +00:00
Michał Janiszewski f4685f7b94 Add Pathfinding test to CMake 2019-01-02 14:12:51 +00:00
Richard Fine 8fb81a2d89 Initial data-driven tests for pathfinder behaviour
Introduce some basic scenario-style tests for the pathfinding AI. There
are two tests:

* Test that a peep can get from a given start position to a given end
  position, and that it takes them an expected number of ticks to do so.
  Also test that they did not walk on any 'forbidden' tiles in the process,
  e.g. tiles that are completely the wrong direction from the goal etc.

* Test that a peep can *not* get from a given start position to a given
  end position after a given number of ticks.

Each test is parametric, and instantiated for multiple different
start/end positions within the provided test park. If we find a new
situation that needs a test, it should just be a matter of building
that situation in the saved game and then adding a line to the code to
set it up.

Indicating 'forbidden' tiles is done using terrain surface type IDs:
tiles that the pathfinder should never send the peep into should be
painted with the red neon surface type (index 8). This means we have
no way to forbid some path elements on a tile while allowing others,
but we don't need that right now.

Similarly, to help ensure that the test data and code are kept in
sync, the tests also require that peep start tiles are painted with
the green neon surface type (index 11) and that goal tiles are
painted with the yellow neon surface type (index 9).
2019-01-02 14:12:08 +00:00
Matt 045e72e863 Add more replays to test. 2019-01-02 08:30:33 +01:00
Matt 8615690891 Fix timestamp not being stored. 2019-01-02 05:36:31 +01:00
Matt f868c23077 Update replay. 2018-12-30 00:07:39 +01:00
Matt 0ba42d6899 Fix TileElementWantsFootpathConnection test not releasing context. 2018-12-29 22:58:33 +01:00
Matt 5497036f01 Add missing static keyword. 2018-12-29 19:23:28 +01:00
Matt 871a24c410 Rename replay file. 2018-12-29 19:23:28 +01:00
Matt 0a62938e42 Pretty print the test parameter. 2018-12-29 19:23:28 +01:00
Matt 711d93cb30 Update replay test. 2018-12-29 19:23:27 +01:00
Matt 5cfc06573e Ignore replay test when network is disabled. 2018-12-29 19:23:27 +01:00
Matt ccc3227113 Cleanup. 2018-12-29 19:23:27 +01:00
Matt 669fbd62dd Add missing source file. 2018-12-29 19:23:27 +01:00
Matt 017f190a52 Add basic regression tests via the replay system. 2018-12-29 19:23:27 +01:00
Michał Janiszewski 05ede45b8e
Fix ICU include dirs for tests (#8499) 2018-12-19 23:31:24 +01:00
Hielke Morsink 354d973a48 Use std::size instead of Util::CountOf 2018-11-23 21:59:08 +01:00
Michael Steenbeek f8add7f62e
Rename rct_tile_element to TileElement 2018-11-01 13:53:50 +01:00
Ted John 211bd84cc3
Merge pull request #7806 from Gymnasiast/feature/rtl-rendering
Fix RTL text rendering for Linux / macOS
2018-10-16 22:26:45 +01:00
Gymnasiast 37f59e17dc Replace C-style isSloped() function 2018-10-04 12:13:17 +02:00
Gymnasiast eae09ea16d Attempt at fixing language pack test 2018-10-01 19:34:09 +02:00
Michael Steenbeek ce13d1b961 Fix tests 2018-09-27 22:15:04 +02:00
Ted John 7faa4e06e0 Update gtest to latest snapshot (#7950)
This fixes issues when building with MSVC 15.8.
2018-08-30 10:10:36 +02:00