Commit Graph

28 Commits

Author SHA1 Message Date
Breno Rodrigues Guimarães ab53ddf59f Avoid fast-forwarding peep into the ride
The code being removed in the patch tries to fast forward a peep into the ride when it is the second peep for a vehicle that is used in pairs. Problem is that funds checking does not happen, so it happens that a peep may pay against its will.
Lets say a rich peep enters in line and a poor peep enters in line right after.
If the price of the ride is such that the rich peep can pay and the poor peep can't, it will be dragged into the ride because funds checking only happened for the first.
The second part of the patch just adjusts we consider the vehicle a full car if the second position is filled.

Add test to verify that a peep is not dragged into a ride it can't pay

This test puts two peeps in a Ferris Wheel. The first peep is rich and the second peep is poor. When they are both in line, the ride price is raised so that the poor peep can't pay.
Make sure the poor peep turns back and leaves the ride.

During development, a mistake in the logic would have broken all rides other than ferris wheels in a way that multiple guests could enter the same car.
Also add a test to make sure that is never broken.
2020-04-25 18:27:33 -03:00
Matt 6177255991
Add S6 Import/Export test and remove old NetworkLoadSave test 2019-10-20 13:49:35 +02:00
Richard Fine 0e04dbeea1 Allow SwapBE to swap non-uint types
If we want to have more semantically meaningful types (like Direction), it's useful to be able to support those in the DataSerializer too. Swapping bytes for entire structures is probably never going to make sense, but for types that are pure wrappers around integer types, we want to be able to swap them as if they were the integer they wrap.
2019-09-01 18:40:11 +01:00
Matt 15838861cd Add load and save test. 2019-03-02 13:11:08 +01:00
Matt 49a6ae7894 Add CircularBuffer test. 2019-02-07 18:50:58 +01: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 017f190a52 Add basic regression tests via the replay system. 2018-12-29 19:23:27 +01:00
Ted John 865bfb7b1b Refactor implementations to different files 2018-06-01 21:27:33 +01:00
Ted John b149c1c4ca Add unit tests for SHA1 hashing 2018-06-01 21:27:33 +01:00
Ted John 44764874a3 Add test for ImageImporter 2018-05-13 01:11:56 +01:00
Ted John e7fb20c283 Add tests for rct2 <-> utf8 conversions 2018-04-18 13:16:20 +02:00
Hielke Morsink f661d48d90 Add tests for tile_element_wants_path_connection_towards 2018-04-17 20:43:49 +02:00
Ted John 58306e8055 Set tests output directory to bin
This is the easiest way to allow the tests to use the OpenRCT2 data for msbuild.
2018-04-10 18:00:02 +01:00
Michał Janiszewski 6aa4722c22 Add MultiLaunch test 2017-06-24 09:56:51 +02:00
Ted John f2524c07b3 Add rating test data 2017-06-04 00:47:34 +01:00
Ted John b28fde6ae7 Create test data helpers 2017-06-04 00:47:33 +01:00
Ted John c5306d72f7 Add ride ratings test 2017-06-04 00:47:33 +01:00
Ted John 0ec43e3611 Improve String::Split and add tests 2017-03-08 19:06:42 +00:00
Ted John 3b341de835 Fix String::Trim and add test 2017-02-24 21:48:06 +00:00
Michał Janiszewski e5d569ac6c Add INI tests to MSVC 2017-02-23 23:38:25 +01:00
Ted John b7b58817bb Rename openrct2-lib to libopenrct2 2017-01-10 17:29:03 +00:00
Ted John 73b21b5880 Convert openrct2 to static library 2017-01-10 17:29:02 +00:00
Ted John a2e3f10ca1 Update VS project files 2017-01-04 18:28:37 +00:00
Ted John c8dbc24ceb Enable all C++ features for MSVC 2016-12-16 01:19:41 +00:00
Ted John d26e1df21e Automatically download googletest 2016-12-02 13:36:03 +00:00
Ted John 4ccb50409b Add test configurations 2016-12-02 02:49:50 +00:00
Ted John 91e19c7d48 Move a lot of the common properties to a shared props file 2016-12-02 00:59:52 +00:00
Ted John a08af1a253 Get tests to build for Windows and VS 2016-12-02 00:34:14 +00:00