feat(miscellaneous): add FTypeInfo and the corresponding testing
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "Testing/MiscellaneousTesting.h"
|
||||
#include "Miscellaneous/AssertionMacros.h"
|
||||
#include "Miscellaneous/TypeInfo.h"
|
||||
#include "Miscellaneous/Compare.h"
|
||||
|
||||
NAMESPACE_REDCRAFT_BEGIN
|
||||
@ -10,6 +11,7 @@ void TestMiscellaneous()
|
||||
{
|
||||
TestAssertionMacros();
|
||||
TestCompare();
|
||||
TestTypeInfo();
|
||||
}
|
||||
|
||||
NAMESPACE_PRIVATE_BEGIN
|
||||
@ -204,6 +206,34 @@ void TestCompare()
|
||||
|
||||
}
|
||||
|
||||
NAMESPACE_PRIVATE_BEGIN
|
||||
|
||||
template <typename...>
|
||||
struct TTestTemplateType { };
|
||||
|
||||
NAMESPACE_PRIVATE_END
|
||||
|
||||
void TestTypeInfo()
|
||||
{
|
||||
FTypeInfo TempA;
|
||||
FTypeInfo TempB(Invalid);
|
||||
|
||||
always_check(TempA == TempB);
|
||||
always_check(TempA == Typeid(void));
|
||||
|
||||
FTypeInfo TempC(Typeid(NAMESPACE_PRIVATE::TTestTemplateType<int8, int16>));
|
||||
FTypeInfo TempD = Typeid(NAMESPACE_PRIVATE::TTestTemplateType<int8, int32>);
|
||||
|
||||
FTypeInfo TempE, TempF;
|
||||
TempE = TempC;
|
||||
TempF = MoveTemp(TempD);
|
||||
|
||||
always_check(TempE != TempF);
|
||||
always_check((TempE < TempF) == (TempF > TempE));
|
||||
always_check((TempE > TempF) == (TempF < TempE));
|
||||
always_check((TempE <=> TempF) != 0);
|
||||
}
|
||||
|
||||
NAMESPACE_MODULE_END(Utility)
|
||||
NAMESPACE_MODULE_END(Redcraft)
|
||||
NAMESPACE_REDCRAFT_END
|
||||
|
Reference in New Issue
Block a user