feat(miscellaneous): add FTypeInfo and the corresponding testing

This commit is contained in:
2022-03-16 11:25:48 +08:00
parent 1b8b449ed4
commit b10963d310
3 changed files with 82 additions and 0 deletions

View File

@ -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