mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 02:04:04 +00:00
chore: miscellaneous code, formatting, and syntax cleanup (#1351)
* miscellaneous code, formatting, and syntax cleanup * update * update again * updated to account for feedback
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
set(DCOMMONTEST_SOURCES
|
||||
"AMFDeserializeTests.cpp"
|
||||
"Amf3Tests.cpp"
|
||||
"CastUnderlyingTypeTests.cpp"
|
||||
"HeaderSkipTest.cpp"
|
||||
"TestCDFeatureGatingTable.cpp"
|
||||
"TestLDFFormat.cpp"
|
||||
|
24
tests/dCommonTests/CastUnderlyingTypeTests.cpp
Normal file
24
tests/dCommonTests/CastUnderlyingTypeTests.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eGameMessageType.h"
|
||||
#include "eWorldMessageType.h"
|
||||
|
||||
#define ASSERT_TYPE_EQ(TYPE, ENUM)\
|
||||
ASSERT_TRUE(typeid(TYPE) == typeid(GeneralUtils::CastUnderlyingType(static_cast<ENUM>(0))));
|
||||
|
||||
#define ASSERT_TYPE_NE(TYPE, ENUM)\
|
||||
ASSERT_FALSE(typeid(TYPE) == typeid(GeneralUtils::CastUnderlyingType(static_cast<ENUM>(0))));
|
||||
|
||||
// Verify that the underlying enum types are being cast correctly
|
||||
TEST(CastUnderlyingTypeTests, VerifyCastUnderlyingType) {
|
||||
ASSERT_TYPE_EQ(uint8_t, eGameMasterLevel);
|
||||
ASSERT_TYPE_EQ(uint16_t, eGameMessageType);
|
||||
ASSERT_TYPE_EQ(uint32_t, eWorldMessageType)
|
||||
|
||||
ASSERT_TYPE_NE(void, eGameMasterLevel);
|
||||
ASSERT_TYPE_NE(void, eGameMessageType);
|
||||
ASSERT_TYPE_NE(void, eWorldMessageType)
|
||||
}
|
@@ -20,7 +20,7 @@
|
||||
// Test World Message Enum Reflection
|
||||
TEST(MagicEnumTest, eWorldMessageTypeTest) {
|
||||
Game::logger = new Logger("./MagicEnumTest_eWorldMessageTypeTest.log", true, true);
|
||||
|
||||
|
||||
ENUM_EQ(eWorldMessageType, 1, VALIDATION);
|
||||
ENUM_EQ(eWorldMessageType, 2, CHARACTER_LIST_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 3, CHARACTER_CREATE_REQUEST);
|
||||
@@ -74,9 +74,9 @@ TEST(MagicEnumTest, eWorldMessageTypeTest) {
|
||||
|
||||
// Test Game Message Enum Reflection
|
||||
TEST(MagicEnumTest, eGameMessageTypeTest) {
|
||||
|
||||
|
||||
Game::logger = new Logger("./MagicEnumTest_eGameMessageTypeTest.log", true, true);
|
||||
|
||||
|
||||
// Only doing the first and last 10 for the sake of my sanity
|
||||
ENUM_EQ(eGameMessageType, 0, GET_POSITION);
|
||||
ENUM_EQ(eGameMessageType, 1, GET_ROTATION);
|
||||
|
Reference in New Issue
Block a user