From c7d6c780b97e97285696dd8c42891afda67951de Mon Sep 17 00:00:00 2001 From: _Redstone_c_ Date: Sat, 19 Mar 2022 13:35:27 +0800 Subject: [PATCH] refactor(testing): put all test functions under the Testing namespace --- Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp | 5 +++++ Redcraft.Utility/Source/Private/Testing/MemoryTesting.cpp | 4 ++++ .../Source/Private/Testing/MiscellaneousTesting.cpp | 5 +++++ Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp | 5 +++++ .../Source/Private/Testing/TypeTraitsTesting.cpp | 5 +++++ .../Source/Public/Miscellaneous/AssertionMacros.h | 2 +- Redcraft.Utility/Source/Public/Testing/ConceptsTesting.h | 4 ++++ Redcraft.Utility/Source/Public/Testing/MemoryTesting.h | 4 ++++ .../Source/Public/Testing/MiscellaneousTesting.h | 4 ++++ Redcraft.Utility/Source/Public/Testing/TemplatesTesting.h | 4 ++++ Redcraft.Utility/Source/Public/Testing/TypeTraitsTesting.h | 4 ++++ 11 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp index 6134180..5d5d25d 100644 --- a/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp @@ -1,4 +1,5 @@ #include "Testing/ConceptsTesting.h" + #include "Miscellaneous/AssertionMacros.h" #include "Templates/Templates.h" #include "Concepts/Concepts.h" @@ -7,6 +8,8 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) 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 NAMESPACE_UNNAMED_BEGIN @@ -195,6 +198,8 @@ void TestConcepts() } +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Private/Testing/MemoryTesting.cpp b/Redcraft.Utility/Source/Private/Testing/MemoryTesting.cpp index 410f0bc..09d95a0 100644 --- a/Redcraft.Utility/Source/Private/Testing/MemoryTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/MemoryTesting.cpp @@ -8,6 +8,8 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) +NAMESPACE_BEGIN(Testing) + void TestMemory() { TestAlignment(); @@ -137,6 +139,8 @@ void TestMemoryMalloc() } +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Private/Testing/MiscellaneousTesting.cpp b/Redcraft.Utility/Source/Private/Testing/MiscellaneousTesting.cpp index 3d9d85b..f4bae8f 100644 --- a/Redcraft.Utility/Source/Private/Testing/MiscellaneousTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/MiscellaneousTesting.cpp @@ -1,4 +1,5 @@ #include "Testing/MiscellaneousTesting.h" + #include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/TypeInfo.h" #include "Miscellaneous/Compare.h" @@ -7,6 +8,8 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) +NAMESPACE_BEGIN(Testing) + void TestMiscellaneous() { TestAssertionMacros(); @@ -234,6 +237,8 @@ void TestTypeInfo() always_check((TempE <=> TempF) != 0); } +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp index 0c142a0..119442d 100644 --- a/Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp @@ -1,4 +1,5 @@ #include "Testing/TemplatesTesting.h" + #include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/Compare.h" #include "Templates/Templates.h" @@ -11,6 +12,8 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) +NAMESPACE_BEGIN(Testing) + void TestTemplates() { TestInvoke(); @@ -348,6 +351,8 @@ void TestMiscTemplates() always_check(AddressOf(TestMiscTemplates) == &TestMiscTemplates); } +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp index 23933af..4e01ba2 100644 --- a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp @@ -1,4 +1,5 @@ #include "Testing/TypeTraitsTesting.h" + #include "Miscellaneous/AssertionMacros.h" #include "TypeTraits/TypeTraits.h" #include "Templates/Templates.h" @@ -7,6 +8,8 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) 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 NAMESPACE_UNNAMED_BEGIN @@ -530,6 +533,8 @@ void TestTypeTraits() } +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Miscellaneous/AssertionMacros.h b/Redcraft.Utility/Source/Public/Miscellaneous/AssertionMacros.h index d9d8f03..07a054a 100644 --- a/Redcraft.Utility/Source/Public/Miscellaneous/AssertionMacros.h +++ b/Redcraft.Utility/Source/Public/Miscellaneous/AssertionMacros.h @@ -34,7 +34,7 @@ NAMESPACE_PRIVATE_END #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_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.") #if BUILD_DEBUG diff --git a/Redcraft.Utility/Source/Public/Testing/ConceptsTesting.h b/Redcraft.Utility/Source/Public/Testing/ConceptsTesting.h index f91ddde..4f865f5 100644 --- a/Redcraft.Utility/Source/Public/Testing/ConceptsTesting.h +++ b/Redcraft.Utility/Source/Public/Testing/ConceptsTesting.h @@ -6,8 +6,12 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) +NAMESPACE_BEGIN(Testing) + REDCRAFTUTILITY_API void TestConcepts(); +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Testing/MemoryTesting.h b/Redcraft.Utility/Source/Public/Testing/MemoryTesting.h index 655d004..ba103db 100644 --- a/Redcraft.Utility/Source/Public/Testing/MemoryTesting.h +++ b/Redcraft.Utility/Source/Public/Testing/MemoryTesting.h @@ -6,11 +6,15 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) +NAMESPACE_BEGIN(Testing) + REDCRAFTUTILITY_API void TestMemory(); REDCRAFTUTILITY_API void TestAlignment(); REDCRAFTUTILITY_API void TestMemoryBuffer(); REDCRAFTUTILITY_API void TestMemoryMalloc(); +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Testing/MiscellaneousTesting.h b/Redcraft.Utility/Source/Public/Testing/MiscellaneousTesting.h index 833d286..f4ea2da 100644 --- a/Redcraft.Utility/Source/Public/Testing/MiscellaneousTesting.h +++ b/Redcraft.Utility/Source/Public/Testing/MiscellaneousTesting.h @@ -6,11 +6,15 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) +NAMESPACE_BEGIN(Testing) + REDCRAFTUTILITY_API void TestMiscellaneous(); REDCRAFTUTILITY_API void TestAssertionMacros(); REDCRAFTUTILITY_API void TestCompare(); REDCRAFTUTILITY_API void TestTypeInfo(); +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Testing/TemplatesTesting.h b/Redcraft.Utility/Source/Public/Testing/TemplatesTesting.h index bcdd1ec..c073d1f 100644 --- a/Redcraft.Utility/Source/Public/Testing/TemplatesTesting.h +++ b/Redcraft.Utility/Source/Public/Testing/TemplatesTesting.h @@ -6,6 +6,8 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) +NAMESPACE_BEGIN(Testing) + REDCRAFTUTILITY_API void TestTemplates(); REDCRAFTUTILITY_API void TestInvoke(); REDCRAFTUTILITY_API void TestReferenceWrapper(); @@ -13,6 +15,8 @@ REDCRAFTUTILITY_API void TestOptional(); REDCRAFTUTILITY_API void TestVariant(); REDCRAFTUTILITY_API void TestMiscTemplates(); +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Testing/TypeTraitsTesting.h b/Redcraft.Utility/Source/Public/Testing/TypeTraitsTesting.h index 703ed46..e8957ab 100644 --- a/Redcraft.Utility/Source/Public/Testing/TypeTraitsTesting.h +++ b/Redcraft.Utility/Source/Public/Testing/TypeTraitsTesting.h @@ -6,8 +6,12 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) +NAMESPACE_BEGIN(Testing) + REDCRAFTUTILITY_API void TestTypeTraits(); +NAMESPACE_END(Testing) + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END