2023-12-24 00:11:00 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "GeneralUtils.h"
|
|
|
|
|
|
|
|
#include "eGameMasterLevel.h"
|
|
|
|
#include "eGameMessageType.h"
|
|
|
|
#include "eWorldMessageType.h"
|
|
|
|
|
|
|
|
#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))));
|
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);
|
|
|
|
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)
|
|
|
|
}
|