refactor(testing): put all test functions under the Testing namespace

This commit is contained in:
_Redstone_c_ 2022-03-19 13:35:27 +08:00
parent c69ed3b9e1
commit c7d6c780b9
11 changed files with 45 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#include "Testing/ConceptsTesting.h" #include "Testing/ConceptsTesting.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
#include "Templates/Templates.h" #include "Templates/Templates.h"
#include "Concepts/Concepts.h" #include "Concepts/Concepts.h"
@ -7,6 +8,8 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
// Warning: The test here is not a complete test, it is only used to determine whether the environment supports the concepts // Warning: The test here is not a complete test, it is only used to determine whether the environment supports the concepts
NAMESPACE_UNNAMED_BEGIN NAMESPACE_UNNAMED_BEGIN
@ -195,6 +198,8 @@ void TestConcepts()
} }
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -8,6 +8,8 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestMemory() void TestMemory()
{ {
TestAlignment(); TestAlignment();
@ -137,6 +139,8 @@ void TestMemoryMalloc()
} }
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -1,4 +1,5 @@
#include "Testing/MiscellaneousTesting.h" #include "Testing/MiscellaneousTesting.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
#include "Miscellaneous/TypeInfo.h" #include "Miscellaneous/TypeInfo.h"
#include "Miscellaneous/Compare.h" #include "Miscellaneous/Compare.h"
@ -7,6 +8,8 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestMiscellaneous() void TestMiscellaneous()
{ {
TestAssertionMacros(); TestAssertionMacros();
@ -234,6 +237,8 @@ void TestTypeInfo()
always_check((TempE <=> TempF) != 0); always_check((TempE <=> TempF) != 0);
} }
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -1,4 +1,5 @@
#include "Testing/TemplatesTesting.h" #include "Testing/TemplatesTesting.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
#include "Miscellaneous/Compare.h" #include "Miscellaneous/Compare.h"
#include "Templates/Templates.h" #include "Templates/Templates.h"
@ -11,6 +12,8 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestTemplates() void TestTemplates()
{ {
TestInvoke(); TestInvoke();
@ -348,6 +351,8 @@ void TestMiscTemplates()
always_check(AddressOf(TestMiscTemplates) == &TestMiscTemplates); always_check(AddressOf(TestMiscTemplates) == &TestMiscTemplates);
} }
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -1,4 +1,5 @@
#include "Testing/TypeTraitsTesting.h" #include "Testing/TypeTraitsTesting.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
#include "TypeTraits/TypeTraits.h" #include "TypeTraits/TypeTraits.h"
#include "Templates/Templates.h" #include "Templates/Templates.h"
@ -7,6 +8,8 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
// Warning: The test here is not a complete test, it is only used to determine whether the environment supports the traits // Warning: The test here is not a complete test, it is only used to determine whether the environment supports the traits
NAMESPACE_UNNAMED_BEGIN NAMESPACE_UNNAMED_BEGIN
@ -530,6 +533,8 @@ void TestTypeTraits()
} }
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -34,7 +34,7 @@ NAMESPACE_PRIVATE_END
#define always_checkf(InExpr, InFormat, ...) RS_CHECK_F_IMPL(InExpr, InFormat, ##__VA_ARGS__) #define always_checkf(InExpr, InFormat, ...) RS_CHECK_F_IMPL(InExpr, InFormat, ##__VA_ARGS__)
#define always_check_no_entry() always_checkf(false, "Enclosing block should never be called.") #define always_check_no_entry() always_checkf(false, "Enclosing block should never be called.")
#define always_check_no_reentry() { static bool PREPROCESSOR_JOIN(bBeenHere, __LINE__) = false; always_checkf(!PREPROCESSOR_JOIN(bBeenHere, __LINE__), "Enclosing block was called more than once."); PREPROCESSOR_JOIN(bBeenHere, __LINE__) = true; } #define always_check_no_reentry() { static bool PREPROCESSOR_JOIN(bBeenHere, __LINE__) = false; always_checkf(!PREPROCESSOR_JOIN(bBeenHere, __LINE__), "Enclosing block was called more than once."); PREPROCESSOR_JOIN(bBeenHere, __LINE__) = true; }
#define always_check_no_recursion() static uint8 PREPROCESSOR_JOIN(RecursionCounter, __LINE__) = 0; always_checkf(PREPROCESSOR_JOIN(RecursionCounter, __LINE__) == 0, "Enclosing block was entered recursively."); const NAMESPACE_PRIVATE::FRecursionScopeMarker PREPROCESSOR_JOIN(ScopeMarker, __LINE__)(PREPROCESSOR_JOIN(RecursionCounter, __LINE__)) #define always_check_no_recursion() static uint8 PREPROCESSOR_JOIN(RecursionCounter, __LINE__) = 0; always_checkf(PREPROCESSOR_JOIN(RecursionCounter, __LINE__) == 0, "Enclosing block was entered recursively."); const NAMESPACE_REDCRAFT::NAMESPACE_PRIVATE::FRecursionScopeMarker PREPROCESSOR_JOIN(ScopeMarker, __LINE__)(PREPROCESSOR_JOIN(RecursionCounter, __LINE__))
#define always_unimplemented() always_checkf(false, "Unimplemented function called.") #define always_unimplemented() always_checkf(false, "Unimplemented function called.")
#if BUILD_DEBUG #if BUILD_DEBUG

View File

@ -6,8 +6,12 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestConcepts(); REDCRAFTUTILITY_API void TestConcepts();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -6,11 +6,15 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestMemory(); REDCRAFTUTILITY_API void TestMemory();
REDCRAFTUTILITY_API void TestAlignment(); REDCRAFTUTILITY_API void TestAlignment();
REDCRAFTUTILITY_API void TestMemoryBuffer(); REDCRAFTUTILITY_API void TestMemoryBuffer();
REDCRAFTUTILITY_API void TestMemoryMalloc(); REDCRAFTUTILITY_API void TestMemoryMalloc();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -6,11 +6,15 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestMiscellaneous(); REDCRAFTUTILITY_API void TestMiscellaneous();
REDCRAFTUTILITY_API void TestAssertionMacros(); REDCRAFTUTILITY_API void TestAssertionMacros();
REDCRAFTUTILITY_API void TestCompare(); REDCRAFTUTILITY_API void TestCompare();
REDCRAFTUTILITY_API void TestTypeInfo(); REDCRAFTUTILITY_API void TestTypeInfo();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -6,6 +6,8 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestTemplates(); REDCRAFTUTILITY_API void TestTemplates();
REDCRAFTUTILITY_API void TestInvoke(); REDCRAFTUTILITY_API void TestInvoke();
REDCRAFTUTILITY_API void TestReferenceWrapper(); REDCRAFTUTILITY_API void TestReferenceWrapper();
@ -13,6 +15,8 @@ REDCRAFTUTILITY_API void TestOptional();
REDCRAFTUTILITY_API void TestVariant(); REDCRAFTUTILITY_API void TestVariant();
REDCRAFTUTILITY_API void TestMiscTemplates(); REDCRAFTUTILITY_API void TestMiscTemplates();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -6,8 +6,12 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestTypeTraits(); REDCRAFTUTILITY_API void TestTypeTraits();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END