Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ride ratings test #5047

Merged
merged 19 commits into from
Jun 5, 2017
Merged

Conversation

IntelOrca
Copy link
Contributor

So we know if we have changed the calculation logic unintentionally.

class RideRatings : public testing::Test
{
protected:
static const char * ExpectedRideRatings[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

char

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you are suggesting I make it utf8? There is nothing other than ascii in this file.


void CalculateRatingsForAllRides()
{
for (int rideId = 0; rideId < MAX_RIDES; rideId++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int

@marijnvdwerf
Copy link
Contributor

I'm not sure what' the ultimate idea with regard to the (s|u)int(8|16|32) types. There's #4936, but pretty much all new code seems to use normal ints etc.

@IntelOrca
Copy link
Contributor Author

IntelOrca commented Jan 11, 2017

I should be using sint32, int in for loops is just a habbit.

@Gymnasiast
Copy link
Member

What is the status of this?

@IntelOrca
Copy link
Contributor Author

It needs an SV6 that has a reasonable amount of content in it, e.g. water, scenery the whole works with an instance of every single ride type in the park. Perhaps we can ask for one to be created on the forums?

@IntelOrca IntelOrca force-pushed the test/ride-ratings branch 4 times, most recently from dfb4ca6 to fdce84a Compare June 3, 2017 17:05
#define UNUSED(x) ((void)(x))

// Macro for turning symbol names into strings
#define SZ(x) #x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with nameof?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing, just didn't know we had it.

@@ -23,6 +23,7 @@ namespace Path
{
utf8 * Append(utf8 * buffer, size_t bufferSize, const utf8 * src);
std::string Combine(const std::string &a, const std::string &b);
std::string Combine(const std::string &a, const std::string &b, const std::string &c);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need two Combines? Isn't it synonymous with Combine(a, Combine(b, c))?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you want to write Combine(a, Combine(b, c)) over Combine(a, b, c)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the same reason you would only have int add(int a, int b) and no int add(int a, int b, int c), int add(int a, int b, int c, int d) and so on…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree - the code clarity is better with an overload that takes three parameters. I would use vargs if possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use variadic templates then? I'd rather see that than explicit implementation for n arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how they work. Can you provide an example or online example?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@@ -27,4 +28,5 @@ namespace File
bool Move(const std::string &srcPath, const std::string &dstPath);
void * ReadAllBytes(const std::string &path, size_t * length);
void WriteAllBytes(const std::string &path, const void * buffer, size_t length);
std::vector<std::string> ReadAllLines(const std::string &path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it File.h and not File.hpp? I recall you provided a reason at some point, but I don't remember it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hpp contains implementation code.

}

using namespace OpenRCT2;
using namespace OpenRCT2::Audio;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audio?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was originally needed, I can remove it now.

if (NOT "z$ENV{CI}" STREQUAL "z")
message("Detected CI environment. Disabling ride rating test.")
else ()
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_LIST_DIR}/testdata/parks" "${CMAKE_CURRENT_BINARY_DIR}/parks")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be done at the top? Other tests may need testdata in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails because you are symlinking parks rather than testdata.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but it still fails because I forgot I run all these tests in docker which has no CI env variable set…

@IntelOrca IntelOrca merged commit 58c2faa into OpenRCT2:develop Jun 5, 2017
janisozaur added a commit that referenced this pull request Jul 12, 2017
- Feature: [#1399 (partial), #5177] Add window that displays any missing/corrupt objects when loading a park
- Feature: [#5056] Add cheat to own all land.
- Feature: [#5133] Add option to display guest expenditure (as seen in RCTC).
- Feature: [#5196] Add cheat to disable ride ageing.
- Feature: [#5504] Group vehicles into ride groups
- Feature: [#5576] Add a persistent 'display real names of guests' setting.
- Feature: [#5611] Add support for Android
- Feature: [#5706] Add support for OpenBSD
- Feature: OpenRCT2 now starts up on the display it was last shown on.
- Feature: Park entrance fee can now be set to amounts up to £200.
- Improved: Construction rights can now be placed on park entrances.
- Improved: Mouse can now be dragged to select scenery when saving track designs
- Fix: [#259] Money making glitch involving swamps (original bug)
- Fix: [#441] Construction rights over entrance path erased (original bug)
- Fix: [#578] Ride ghosts show up in ride list during construction (original bug)
- Fix: [#597] 'Finish 5 roller coasters' goal not properly checked (original bug)
- Fix: [#667] Incorrect banner limit calculation (original bug)
- Fix: [#739] Crocodile Ride (Log Flume) never allows more than five boats (original bug)
- Fix: [#837] Can't move windows on title screen to where the toolbar would be (original bug)
- Fix: [#1705] Time Twister's Medieval entrance has incorrect scrolling (original bug)
- Fix: [#3178, #5456] Paths with non-ASCII characters not handled properly on macOS.
- Fix: [#3346] Crash when extra long train breaks down at the back
- Fix: [#3479] Building in pause mode creates too many floating numbers, crashing the game
- Fix: [#3565] Multiplayer server crash
- Fix: [#3681] Steel Twister rollercoaster always shows all track designs
- Fix: [#3846, #5749] Crash when testing coaster with a diagonal lift in block brake mode
- Fix: [#4054] Sorting rides by track type: Misleading research messages
- Fix: [#4055] Sort rides by track type: Sorting rule is not really clear (inconsistent?)
- Fix: [#4512] Invisible map edge tiles corrupted
- Fix: [#5009] Ride rating calculations can overflow
- Fix: [#5253] RCT1 park value conversion factor too high
- Fix: [#5400] New Ride window does not focus properly on newly invented ride.
- Fix: [#5489] Sprite index crash for car view on car ride.
- Fix: [#5730] Unable to uncheck 'No money' in the Scenario Editor.
- Fix: [#5750] Game freezes when ride queue linked list is corrupted.
- Fix: [#5819] Vertical multi-dimension coaster tunnels drawn incorrectly
- Fix: Non-invented vehicles can be used via track designs in select-by-track-type mode.
- Fix: Track components added by OpenRCT2 are now usable in older scenarios.
- Technical: [#5047] Add ride ratings tests
- Technical: [#5458] Begin offering headless build with reduced compile- and run-time dependencies
- Technical: [#5755] Title sequence wait periods use milliseconds
- Technical: Fix many desync sources
@IntelOrca IntelOrca deleted the test/ride-ratings branch March 16, 2018 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants