1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-03 04:05:49 +01:00

Rename ASSERT_BEHAVIOUR and its members

This commit is contained in:
Gymnasiast
2025-03-26 11:56:06 +01:00
parent b8dafb9d62
commit 3289aa4df3
4 changed files with 16 additions and 16 deletions

View File

@@ -30,11 +30,11 @@ namespace OpenRCT2::Guard
static constexpr const utf8* kAssertionMessage = "An assertion failed, please report this to the OpenRCT2 developers.";
// The default behaviour when an assertion is raised.
static ASSERT_BEHAVIOUR _assertBehaviour =
static AssertBehaviour _assertBehaviour =
#ifdef _WIN32
ASSERT_BEHAVIOUR::MESSAGE_BOX
AssertBehaviour::messageBox
#else
ASSERT_BEHAVIOUR::CASSERT
AssertBehaviour::cAssert
#endif
;
@@ -45,12 +45,12 @@ namespace OpenRCT2::Guard
static void ForceCrash();
#endif
ASSERT_BEHAVIOUR GetAssertBehaviour()
AssertBehaviour GetAssertBehaviour()
{
return _assertBehaviour;
}
void SetAssertBehaviour(ASSERT_BEHAVIOUR behaviour)
void SetAssertBehaviour(AssertBehaviour behaviour)
{
_assertBehaviour = behaviour;
}
@@ -99,14 +99,14 @@ namespace OpenRCT2::Guard
switch (_assertBehaviour)
{
case ASSERT_BEHAVIOUR::ABORT:
case AssertBehaviour::abort:
abort();
default:
case ASSERT_BEHAVIOUR::CASSERT:
case AssertBehaviour::cAssert:
assert(false);
break;
#ifdef _WIN32
case ASSERT_BEHAVIOUR::MESSAGE_BOX:
case AssertBehaviour::messageBox:
{
// Show message box if we are not building for testing
auto buffer = CreateDialogAssertMessage(formattedMessage);

View File

@@ -16,11 +16,11 @@
#include <stdbool.h>
#include <string>
enum class ASSERT_BEHAVIOUR
enum class AssertBehaviour
{
ABORT,
CASSERT,
MESSAGE_BOX,
abort,
cAssert,
messageBox,
};
/**
@@ -28,8 +28,8 @@ enum class ASSERT_BEHAVIOUR
*/
namespace OpenRCT2::Guard
{
ASSERT_BEHAVIOUR GetAssertBehaviour();
void SetAssertBehaviour(ASSERT_BEHAVIOUR behaviour);
AssertBehaviour GetAssertBehaviour();
void SetAssertBehaviour(AssertBehaviour behaviour);
void Assert(bool expression, const std::source_location& location = std::source_location::current());
void Assert(bool expression, const char* message, ...);

View File

@@ -36,7 +36,7 @@ TEST(FetchAndApplyScenarioPatch, expected_json_format)
std::error_code ec;
OpenRCT2::RCT12::SetDryRun(true);
OpenRCT2::Guard::SetAssertBehaviour(ASSERT_BEHAVIOUR::ABORT);
OpenRCT2::Guard::SetAssertBehaviour(AssertBehaviour::abort);
static const u8string dummySHA;
for (const fs::directory_entry& entry : fs::directory_iterator(scenarioPatches, ec))
{

View File

@@ -17,7 +17,7 @@
int main(int argc, char** argv)
{
// Abort on an assertions so the tests do not hang
OpenRCT2::Guard::SetAssertBehaviour(ASSERT_BEHAVIOUR::ABORT);
OpenRCT2::Guard::SetAssertBehaviour(AssertBehaviour::abort);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();