Compare commits

...

2 Commits

19 changed files with 117 additions and 241 deletions

View File

@ -1,4 +1,4 @@
#include "Testing/ContainersTesting.h" #include "Testing/Testing.h"
#include "Containers/Containers.h" #include "Containers/Containers.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
@ -11,15 +11,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing) NAMESPACE_BEGIN(Testing)
void TestContainers() NAMESPACE_PRIVATE_BEGIN
{
TestArray();
TestStaticArray();
TestArrayView();
TestBitset();
TestStaticBitset();
TestList();
}
NAMESPACE_UNNAMED_BEGIN NAMESPACE_UNNAMED_BEGIN
@ -603,6 +595,18 @@ void TestList()
} }
} }
NAMESPACE_PRIVATE_END
void TestContainers()
{
NAMESPACE_PRIVATE::TestArray();
NAMESPACE_PRIVATE::TestStaticArray();
NAMESPACE_PRIVATE::TestArrayView();
NAMESPACE_PRIVATE::TestBitset();
NAMESPACE_PRIVATE::TestStaticBitset();
NAMESPACE_PRIVATE::TestList();
}
NAMESPACE_END(Testing) NAMESPACE_END(Testing)
// ReSharper restore CppInconsistentNaming // ReSharper restore CppInconsistentNaming

View File

@ -1,4 +1,4 @@
#include "Testing/IteratorTesting.h" #include "Testing/Testing.h"
#include "Iterator/Iterator.h" #include "Iterator/Iterator.h"
#include "Containers/List.h" #include "Containers/List.h"
@ -10,13 +10,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing) NAMESPACE_BEGIN(Testing)
void TestIterator() NAMESPACE_PRIVATE_BEGIN
{
TestMoveIterator();
TestReverseIterator();
TestCountedIterator();
TestInsertIterator();
}
void TestMoveIterator() void TestMoveIterator()
{ {
@ -219,6 +213,16 @@ void TestInsertIterator()
} }
} }
NAMESPACE_PRIVATE_END
void TestIterator()
{
NAMESPACE_PRIVATE::TestMoveIterator();
NAMESPACE_PRIVATE::TestReverseIterator();
NAMESPACE_PRIVATE::TestCountedIterator();
NAMESPACE_PRIVATE::TestInsertIterator();
}
NAMESPACE_END(Testing) NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/MemoryTesting.h" #include "Testing/Testing.h"
#include "Memory/Memory.h" #include "Memory/Memory.h"
#include "Memory/Alignment.h" #include "Memory/Alignment.h"
@ -15,18 +15,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing) NAMESPACE_BEGIN(Testing)
void TestMemory() NAMESPACE_PRIVATE_BEGIN
{
TestAddress();
TestAlignment();
TestMemoryBuffer();
TestMemoryMalloc();
TestMemoryOperator();
TestPointerTraits();
TestUniquePointer();
TestSharedPointer();
TestInOutPointer();
}
NAMESPACE_UNNAMED_BEGIN NAMESPACE_UNNAMED_BEGIN
@ -1072,6 +1061,21 @@ void TestInOutPointer()
} }
} }
NAMESPACE_PRIVATE_END
void TestMemory()
{
NAMESPACE_PRIVATE::TestAddress();
NAMESPACE_PRIVATE::TestAlignment();
NAMESPACE_PRIVATE::TestMemoryBuffer();
NAMESPACE_PRIVATE::TestMemoryMalloc();
NAMESPACE_PRIVATE::TestMemoryOperator();
NAMESPACE_PRIVATE::TestPointerTraits();
NAMESPACE_PRIVATE::TestUniquePointer();
NAMESPACE_PRIVATE::TestSharedPointer();
NAMESPACE_PRIVATE::TestInOutPointer();
}
NAMESPACE_END(Testing) NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/MiscellaneousTesting.h" #include "Testing/Testing.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
#include "Miscellaneous/Compare.h" #include "Miscellaneous/Compare.h"
@ -10,12 +10,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing) NAMESPACE_BEGIN(Testing)
void TestMiscellaneous() NAMESPACE_PRIVATE_BEGIN
{
TestAssertionMacros();
TestCompare();
TestVarArgs();
}
NAMESPACE_UNNAMED_BEGIN NAMESPACE_UNNAMED_BEGIN
@ -285,6 +280,15 @@ void TestVarArgs()
); );
} }
NAMESPACE_PRIVATE_END
void TestMiscellaneous()
{
NAMESPACE_PRIVATE::TestAssertionMacros();
NAMESPACE_PRIVATE::TestCompare();
NAMESPACE_PRIVATE::TestVarArgs();
}
NAMESPACE_END(Testing) NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/NumericTesting.h" #include "Testing/Testing.h"
#include "Numeric/Numeric.h" #include "Numeric/Numeric.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
@ -9,12 +9,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing) NAMESPACE_BEGIN(Testing)
void TestNumeric() NAMESPACE_PRIVATE_BEGIN
{
TestLiteral();
TestBit();
TestMath();
}
void TestLiteral() void TestLiteral()
{ {
@ -606,6 +601,15 @@ void TestMath()
always_check(static_cast<uint8>(Math::LerpStable(0, 255, 1.0)) == 255); always_check(static_cast<uint8>(Math::LerpStable(0, 255, 1.0)) == 255);
} }
NAMESPACE_PRIVATE_END
void TestNumeric()
{
NAMESPACE_PRIVATE::TestLiteral();
NAMESPACE_PRIVATE::TestBit();
NAMESPACE_PRIVATE::TestMath();
}
NAMESPACE_END(Testing) NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/StringTesting.h" #include "Testing/Testing.h"
#include "String/Char.h" #include "String/Char.h"
#include "Memory/Memory.h" #include "Memory/Memory.h"
@ -13,13 +13,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing) NAMESPACE_BEGIN(Testing)
void TestString() NAMESPACE_PRIVATE_BEGIN
{
TestChar();
TestStringView();
TestTemplateString();
TestStringConversion();
}
void TestChar() void TestChar()
{ {
@ -32,6 +26,7 @@ void TestChar()
always_check(CCharType<u32char>); always_check(CCharType<u32char>);
always_check(CCharType<unicodechar>); always_check(CCharType<unicodechar>);
} }
auto Test = []<typename T>(TInPlaceType<T>) auto Test = []<typename T>(TInPlaceType<T>)
{ {
always_check(TChar<T>::IsASCII(LITERAL(T, '0'))); always_check(TChar<T>::IsASCII(LITERAL(T, '0')));
@ -625,6 +620,16 @@ void TestStringConversion()
Test(InPlaceType<unicodechar>); Test(InPlaceType<unicodechar>);
} }
NAMESPACE_PRIVATE_END
void TestString()
{
NAMESPACE_PRIVATE::TestChar();
NAMESPACE_PRIVATE::TestStringView();
NAMESPACE_PRIVATE::TestTemplateString();
NAMESPACE_PRIVATE::TestStringConversion();
}
NAMESPACE_END(Testing) NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/TemplatesTesting.h" #include "Testing/Testing.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
#include "Miscellaneous/Compare.h" #include "Miscellaneous/Compare.h"
@ -14,20 +14,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing) NAMESPACE_BEGIN(Testing)
void TestTemplates() NAMESPACE_PRIVATE_BEGIN
{
TestInvoke();
TestReferenceWrapper();
TestOptional();
TestVariant();
TestAny();
TestTuple();
TestFunction();
TestAtomic();
TestScopeHelper();
TestPropagateConst();
TestMiscTemplates();
}
NAMESPACE_UNNAMED_BEGIN NAMESPACE_UNNAMED_BEGIN
@ -1621,6 +1608,23 @@ void TestMiscTemplates()
} }
NAMESPACE_PRIVATE_END
void TestTemplates()
{
NAMESPACE_PRIVATE::TestInvoke();
NAMESPACE_PRIVATE::TestReferenceWrapper();
NAMESPACE_PRIVATE::TestOptional();
NAMESPACE_PRIVATE::TestVariant();
NAMESPACE_PRIVATE::TestAny();
NAMESPACE_PRIVATE::TestTuple();
NAMESPACE_PRIVATE::TestFunction();
NAMESPACE_PRIVATE::TestAtomic();
NAMESPACE_PRIVATE::TestScopeHelper();
NAMESPACE_PRIVATE::TestPropagateConst();
NAMESPACE_PRIVATE::TestMiscTemplates();
}
NAMESPACE_END(Testing) NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/TypeTraitsTesting.h" #include "Testing/Testing.h"
#include "Miscellaneous/AssertionMacros.h" #include "Miscellaneous/AssertionMacros.h"
#include "TypeTraits/TypeTraits.h" #include "TypeTraits/TypeTraits.h"

View File

@ -36,7 +36,7 @@ NAMESPACE_PRIVATE_END
#define VARARGS_ACCESS_COPY(ContextName, ContextSource) NAMESPACE_STD::va_list ContextName; va_copy(ContextName, ContextSource) #define VARARGS_ACCESS_COPY(ContextName, ContextSource) NAMESPACE_STD::va_list ContextName; va_copy(ContextName, ContextSource)
/** Accesses the next variadic function argument. */ /** Accesses the next variadic function argument. */
#define VARARGS_ACCESS(ContextName, Type) (NAMESPACE_PRIVATE::VarArgsAssert<Type>, va_arg(ContextName, Type)) #define VARARGS_ACCESS(ContextName, Type) (NAMESPACE_REDCRAFT::NAMESPACE_PRIVATE::VarArgsAssert<Type>, va_arg(ContextName, Type))
/** Ends traversal of the variadic function arguments. */ /** Ends traversal of the variadic function arguments. */
#define VARARGS_ACCESS_END(ContextName) va_end(ContextName) #define VARARGS_ACCESS_END(ContextName) va_end(ContextName)

View File

@ -57,7 +57,7 @@ struct TLiteral<u32char>
NAMESPACE_PRIVATE_END NAMESPACE_PRIVATE_END
/** Templated literal struct to allow selection of string literals based on the character type provided, and not on compiler switches. */ /** Templated literal struct to allow selection of string literals based on the character type provided, and not on compiler switches. */
#define LITERAL(CharType, StringLiteral) NAMESPACE_PRIVATE::TLiteral<CharType>::Select(TEXT(StringLiteral), WTEXT(StringLiteral), U8TEXT(StringLiteral), U16TEXT(StringLiteral), U32TEXT(StringLiteral)) #define LITERAL(CharType, StringLiteral) NAMESPACE_REDCRAFT::NAMESPACE_PRIVATE::TLiteral<CharType>::Select(TEXT(StringLiteral), WTEXT(StringLiteral), U8TEXT(StringLiteral), U16TEXT(StringLiteral), U32TEXT(StringLiteral))
static_assert(CUnsigned<u8char>, "TChar assumes u8char is an unsigned integer"); static_assert(CUnsigned<u8char>, "TChar assumes u8char is an unsigned integer");
static_assert(CUnsigned<u16char>, "TChar assumes u16char is an unsigned integer"); static_assert(CUnsigned<u16char>, "TChar assumes u16char is an unsigned integer");

View File

@ -17,7 +17,7 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
// @TODO: Refactor the conversion tool by more elegant way. // TODO: Refactor the conversion tool by more elegant way.
// The conversion tool uses a string to describe the object format. // The conversion tool uses a string to describe the object format.
// //

View File

@ -1,23 +0,0 @@
#pragma once
#include "CoreTypes.h"
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestContainers();
REDCRAFTUTILITY_API void TestArray();
REDCRAFTUTILITY_API void TestStaticArray();
REDCRAFTUTILITY_API void TestArrayView();
REDCRAFTUTILITY_API void TestBitset();
REDCRAFTUTILITY_API void TestStaticBitset();
REDCRAFTUTILITY_API void TestList();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -1,21 +0,0 @@
#pragma once
#include "CoreTypes.h"
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestIterator();
REDCRAFTUTILITY_API void TestMoveIterator();
REDCRAFTUTILITY_API void TestReverseIterator();
REDCRAFTUTILITY_API void TestCountedIterator();
REDCRAFTUTILITY_API void TestInsertIterator();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -1,27 +0,0 @@
#pragma once
#include "CoreTypes.h"
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestMemory();
REDCRAFTUTILITY_API void TestAddress();
REDCRAFTUTILITY_API void TestAlignment();
REDCRAFTUTILITY_API void TestMemoryBuffer();
REDCRAFTUTILITY_API void TestMemoryMalloc();
REDCRAFTUTILITY_API void TestMemoryOperator();
REDCRAFTUTILITY_API void TestPointerTraits();
REDCRAFTUTILITY_API void TestUniquePointer();
REDCRAFTUTILITY_API void TestSharedPointer();
REDCRAFTUTILITY_API void TestObserverPointer();
REDCRAFTUTILITY_API void TestInOutPointer();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -1,20 +0,0 @@
#pragma once
#include "CoreTypes.h"
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestNumeric();
REDCRAFTUTILITY_API void TestLiteral();
REDCRAFTUTILITY_API void TestBit();
REDCRAFTUTILITY_API void TestMath();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -1,21 +0,0 @@
#pragma once
#include "CoreTypes.h"
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestString();
REDCRAFTUTILITY_API void TestChar();
REDCRAFTUTILITY_API void TestStringView();
REDCRAFTUTILITY_API void TestTemplateString();
REDCRAFTUTILITY_API void TestStringConversion();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -1,28 +0,0 @@
#pragma once
#include "CoreTypes.h"
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();
REDCRAFTUTILITY_API void TestOptional();
REDCRAFTUTILITY_API void TestVariant();
REDCRAFTUTILITY_API void TestAny();
REDCRAFTUTILITY_API void TestTuple();
REDCRAFTUTILITY_API void TestFunction();
REDCRAFTUTILITY_API void TestAtomic();
REDCRAFTUTILITY_API void TestScopeHelper();
REDCRAFTUTILITY_API void TestPropagateConst();
REDCRAFTUTILITY_API void TestMiscTemplates();
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -8,10 +8,14 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing) NAMESPACE_BEGIN(Testing)
REDCRAFTUTILITY_API void TestTypeTraits();
REDCRAFTUTILITY_API void TestTemplates();
REDCRAFTUTILITY_API void TestNumeric();
REDCRAFTUTILITY_API void TestIterator();
REDCRAFTUTILITY_API void TestMemory();
REDCRAFTUTILITY_API void TestContainers();
REDCRAFTUTILITY_API void TestString();
REDCRAFTUTILITY_API void TestMiscellaneous(); REDCRAFTUTILITY_API void TestMiscellaneous();
REDCRAFTUTILITY_API void TestAssertionMacros();
REDCRAFTUTILITY_API void TestCompare();
REDCRAFTUTILITY_API void TestVarArgs();
NAMESPACE_END(Testing) NAMESPACE_END(Testing)

View File

@ -1,17 +0,0 @@
#pragma once
#include "CoreTypes.h"
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