2023-12-24 00:11:00 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "GeneralUtils.h"
|
|
|
|
|
|
|
|
#include "eGameMasterLevel.h"
|
2024-11-18 00:39:44 +00:00
|
|
|
#include "MessageType/Game.h"
|
|
|
|
#include "MessageType/World.h"
|
2023-12-24 00:11:00 +00:00
|
|
|
|
|
|
|
#define ASSERT_TYPE_EQ(TYPE, ENUM)\
|
2024-03-07 05:45:04 +00:00
|
|
|
ASSERT_TRUE(typeid(TYPE) == typeid(GeneralUtils::ToUnderlying(static_cast<ENUM>(0))));
|
2023-12-24 00:11:00 +00:00
|
|
|
|
|
|
|
#define ASSERT_TYPE_NE(TYPE, ENUM)\
|
2024-03-07 05:45:04 +00:00
|
|
|
ASSERT_FALSE(typeid(TYPE) == typeid(GeneralUtils::ToUnderlying(static_cast<ENUM>(0))));
|
2024-11-18 00:39:44 +00:00
|
|
|
|
2023-12-24 00:11:00 +00:00
|
|
|
// Verify that the underlying enum types are being cast correctly
|
2024-03-07 05:45:04 +00:00
|
|
|
TEST(ToUnderlyingTests, VerifyToUnderlying) {
|
2023-12-24 00:11:00 +00:00
|
|
|
ASSERT_TYPE_EQ(uint8_t, eGameMasterLevel);
|
2024-11-18 00:39:44 +00:00
|
|
|
ASSERT_TYPE_EQ(uint16_t, MessageType::Game);
|
|
|
|
ASSERT_TYPE_EQ(uint32_t, MessageType::World)
|
2023-12-24 00:11:00 +00:00
|
|
|
|
|
|
|
ASSERT_TYPE_NE(void, eGameMasterLevel);
|
2024-11-18 00:39:44 +00:00
|
|
|
ASSERT_TYPE_NE(void, MessageType::Game);
|
|
|
|
ASSERT_TYPE_NE(void, MessageType::World)
|
2023-12-24 00:11:00 +00:00
|
|
|
}
|