mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-23 05:53:34 +00:00
6e3b5acede
* Less verbose name for enum underlying type casts * Remove redundant call
25 lines
769 B
C++
25 lines
769 B
C++
#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::ToUnderlying(static_cast<ENUM>(0))));
|
|
|
|
#define ASSERT_TYPE_NE(TYPE, ENUM)\
|
|
ASSERT_FALSE(typeid(TYPE) == typeid(GeneralUtils::ToUnderlying(static_cast<ENUM>(0))));
|
|
|
|
// Verify that the underlying enum types are being cast correctly
|
|
TEST(ToUnderlyingTests, VerifyToUnderlying) {
|
|
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)
|
|
}
|