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 "Miscellaneous/AssertionMacros.h"
@ -11,15 +11,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestContainers()
{
TestArray();
TestStaticArray();
TestArrayView();
TestBitset();
TestStaticBitset();
TestList();
}
NAMESPACE_PRIVATE_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)
// ReSharper restore CppInconsistentNaming

View File

@ -1,4 +1,4 @@
#include "Testing/IteratorTesting.h"
#include "Testing/Testing.h"
#include "Iterator/Iterator.h"
#include "Containers/List.h"
@ -10,13 +10,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestIterator()
{
TestMoveIterator();
TestReverseIterator();
TestCountedIterator();
TestInsertIterator();
}
NAMESPACE_PRIVATE_BEGIN
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_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/MemoryTesting.h"
#include "Testing/Testing.h"
#include "Memory/Memory.h"
#include "Memory/Alignment.h"
@ -15,18 +15,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestMemory()
{
TestAddress();
TestAlignment();
TestMemoryBuffer();
TestMemoryMalloc();
TestMemoryOperator();
TestPointerTraits();
TestUniquePointer();
TestSharedPointer();
TestInOutPointer();
}
NAMESPACE_PRIVATE_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_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/MiscellaneousTesting.h"
#include "Testing/Testing.h"
#include "Miscellaneous/AssertionMacros.h"
#include "Miscellaneous/Compare.h"
@ -10,12 +10,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestMiscellaneous()
{
TestAssertionMacros();
TestCompare();
TestVarArgs();
}
NAMESPACE_PRIVATE_BEGIN
NAMESPACE_UNNAMED_BEGIN
@ -127,7 +122,7 @@ void TestCompare()
always_check(( 0 <=> 0) == strong_ordering::equivalent);
always_check(( 0 <=> 0) == strong_ordering::equal);
always_check(( 0 <=> -1) == strong_ordering::greater);
always_check((-1 <=> 0) < 0);
always_check((-1 <=> 0) <= 0);
always_check(( 0 <=> 0) <= 0);
@ -148,12 +143,12 @@ void TestCompare()
always_check((-1.0 <=> 0.0) == weak_ordering::less);
always_check(( 0.0 <=> 0.0) == weak_ordering::equivalent);
always_check(( 0.0 <=> -1.0) == weak_ordering::greater);
always_check((-1.0 <=> 0.0) == strong_ordering::less);
always_check(( 0.0 <=> 0.0) == strong_ordering::equivalent);
always_check(( 0.0 <=> 0.0) == strong_ordering::equal);
always_check(( 0.0 <=> -1.0) == strong_ordering::greater);
always_check((-1.0 <=> 0.0) < 0);
always_check((-1.0 <=> 0.0) <= 0);
always_check(( 0.0 <=> 0.0) <= 0);
@ -162,26 +157,26 @@ void TestCompare()
always_check(( 0.0 <=> -1.0) >= 0);
always_check(( 0.0 <=> -1.0) > 0);
always_check((-1.0 <=> 1.0) != 0);
always_check((FTestPartialOrdering(-1) <=> FTestPartialOrdering( 0)) == partial_ordering::less);
always_check((FTestPartialOrdering( 0) <=> FTestPartialOrdering( 0)) == partial_ordering::equivalent);
always_check((FTestPartialOrdering( 0) <=> FTestPartialOrdering(-1)) == partial_ordering::greater);
always_check((FTestPartialOrdering( 0, true) <=> FTestPartialOrdering( 0, false)) == partial_ordering::unordered);
always_check((FTestWeakOrdering(-1) <=> FTestWeakOrdering( 0)) == weak_ordering::less);
always_check((FTestWeakOrdering( 0) <=> FTestWeakOrdering( 0)) == weak_ordering::equivalent);
always_check((FTestWeakOrdering( 0) <=> FTestWeakOrdering(-1)) == weak_ordering::greater);
always_check((FTestStrongOrdering(-1) <=> FTestStrongOrdering( 0)) == strong_ordering::less);
always_check((FTestStrongOrdering( 0) <=> FTestStrongOrdering( 0)) == strong_ordering::equivalent);
always_check((FTestStrongOrdering( 0) <=> FTestStrongOrdering( 0)) == strong_ordering::equal);
always_check((FTestStrongOrdering( 0) <=> FTestStrongOrdering(-1)) == strong_ordering::greater);
always_check((FTestPartialOrdering(-1) < FTestPartialOrdering( 0)));
always_check((FTestPartialOrdering( 0) == FTestPartialOrdering( 0)));
always_check((FTestPartialOrdering( 0) > FTestPartialOrdering(-1)));
always_check((FTestWeakOrdering(-1) < FTestWeakOrdering( 0)));
always_check((FTestWeakOrdering( 0) == FTestWeakOrdering( 0)));
always_check((FTestWeakOrdering( 0) > FTestWeakOrdering(-1)));
@ -216,7 +211,7 @@ void TestCompare()
always_check(SynthThreeWayCompare(FTestPartialOrdering( 0), FTestPartialOrdering(-1)) == partial_ordering::greater);
always_check(SynthThreeWayCompare(FTestPartialOrdering( 0, true), FTestPartialOrdering( 0, false)) == partial_ordering::unordered);
always_check(SynthThreeWayCompare(FTestSynth(-1), FTestSynth( 0)) == weak_ordering::less);
always_check(SynthThreeWayCompare(FTestSynth( 0), FTestSynth( 0)) == weak_ordering::equivalent);
always_check(SynthThreeWayCompare(FTestSynth( 0), FTestSynth(-1)) == weak_ordering::greater);
@ -285,6 +280,15 @@ void TestVarArgs()
);
}
NAMESPACE_PRIVATE_END
void TestMiscellaneous()
{
NAMESPACE_PRIVATE::TestAssertionMacros();
NAMESPACE_PRIVATE::TestCompare();
NAMESPACE_PRIVATE::TestVarArgs();
}
NAMESPACE_END(Testing)
NAMESPACE_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/NumericTesting.h"
#include "Testing/Testing.h"
#include "Numeric/Numeric.h"
#include "Miscellaneous/AssertionMacros.h"
@ -9,12 +9,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestNumeric()
{
TestLiteral();
TestBit();
TestMath();
}
NAMESPACE_PRIVATE_BEGIN
void TestLiteral()
{
@ -606,6 +601,15 @@ void TestMath()
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_MODULE_END(Utility)

View File

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

View File

@ -1,4 +1,4 @@
#include "Testing/TemplatesTesting.h"
#include "Testing/Testing.h"
#include "Miscellaneous/AssertionMacros.h"
#include "Miscellaneous/Compare.h"
@ -14,20 +14,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
void TestTemplates()
{
TestInvoke();
TestReferenceWrapper();
TestOptional();
TestVariant();
TestAny();
TestTuple();
TestFunction();
TestAtomic();
TestScopeHelper();
TestPropagateConst();
TestMiscTemplates();
}
NAMESPACE_PRIVATE_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_MODULE_END(Utility)

View File

@ -1,4 +1,4 @@
#include "Testing/TypeTraitsTesting.h"
#include "Testing/Testing.h"
#include "Miscellaneous/AssertionMacros.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)
/** 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. */
#define VARARGS_ACCESS_END(ContextName) va_end(ContextName)

View File

@ -57,7 +57,7 @@ struct TLiteral<u32char>
NAMESPACE_PRIVATE_END
/** 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<u16char>, "TChar assumes u16char is an unsigned integer");

View File

@ -17,7 +17,7 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
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.
//

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)
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 TestAssertionMacros();
REDCRAFTUTILITY_API void TestCompare();
REDCRAFTUTILITY_API void TestVarArgs();
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