Compare commits

..

No commits in common. "1e6beb83f2591b5f758f35f304c9ab458251303d" and "566052c8c2afcb9f791ec780014a44c98d7a71af" have entirely different histories.

19 changed files with 241 additions and 117 deletions

View File

@ -1,4 +1,4 @@
#include "Testing/Testing.h"
#include "Testing/ContainersTesting.h"
#include "Containers/Containers.h"
#include "Miscellaneous/AssertionMacros.h"
@ -11,7 +11,15 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
NAMESPACE_PRIVATE_BEGIN
void TestContainers()
{
TestArray();
TestStaticArray();
TestArrayView();
TestBitset();
TestStaticBitset();
TestList();
}
NAMESPACE_UNNAMED_BEGIN
@ -595,18 +603,6 @@ 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/Testing.h"
#include "Testing/IteratorTesting.h"
#include "Iterator/Iterator.h"
#include "Containers/List.h"
@ -10,7 +10,13 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
NAMESPACE_PRIVATE_BEGIN
void TestIterator()
{
TestMoveIterator();
TestReverseIterator();
TestCountedIterator();
TestInsertIterator();
}
void TestMoveIterator()
{
@ -213,16 +219,6 @@ 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/Testing.h"
#include "Testing/MemoryTesting.h"
#include "Memory/Memory.h"
#include "Memory/Alignment.h"
@ -15,7 +15,18 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
NAMESPACE_PRIVATE_BEGIN
void TestMemory()
{
TestAddress();
TestAlignment();
TestMemoryBuffer();
TestMemoryMalloc();
TestMemoryOperator();
TestPointerTraits();
TestUniquePointer();
TestSharedPointer();
TestInOutPointer();
}
NAMESPACE_UNNAMED_BEGIN
@ -1061,21 +1072,6 @@ 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/Testing.h"
#include "Testing/MiscellaneousTesting.h"
#include "Miscellaneous/AssertionMacros.h"
#include "Miscellaneous/Compare.h"
@ -10,7 +10,12 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
NAMESPACE_PRIVATE_BEGIN
void TestMiscellaneous()
{
TestAssertionMacros();
TestCompare();
TestVarArgs();
}
NAMESPACE_UNNAMED_BEGIN
@ -122,7 +127,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);
@ -143,12 +148,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);
@ -157,26 +162,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)));
@ -211,7 +216,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);
@ -280,15 +285,6 @@ 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/Testing.h"
#include "Testing/NumericTesting.h"
#include "Numeric/Numeric.h"
#include "Miscellaneous/AssertionMacros.h"
@ -9,7 +9,12 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
NAMESPACE_PRIVATE_BEGIN
void TestNumeric()
{
TestLiteral();
TestBit();
TestMath();
}
void TestLiteral()
{
@ -601,15 +606,6 @@ 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/Testing.h"
#include "Testing/StringTesting.h"
#include "String/Char.h"
#include "Memory/Memory.h"
@ -13,7 +13,13 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
NAMESPACE_PRIVATE_BEGIN
void TestString()
{
TestChar();
TestStringView();
TestTemplateString();
TestStringConversion();
}
void TestChar()
{
@ -26,7 +32,6 @@ void TestChar()
always_check(CCharType<u32char>);
always_check(CCharType<unicodechar>);
}
auto Test = []<typename T>(TInPlaceType<T>)
{
always_check(TChar<T>::IsASCII(LITERAL(T, '0')));
@ -620,16 +625,6 @@ 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/Testing.h"
#include "Testing/TemplatesTesting.h"
#include "Miscellaneous/AssertionMacros.h"
#include "Miscellaneous/Compare.h"
@ -14,7 +14,20 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Testing)
NAMESPACE_PRIVATE_BEGIN
void TestTemplates()
{
TestInvoke();
TestReferenceWrapper();
TestOptional();
TestVariant();
TestAny();
TestTuple();
TestFunction();
TestAtomic();
TestScopeHelper();
TestPropagateConst();
TestMiscTemplates();
}
NAMESPACE_UNNAMED_BEGIN
@ -1608,23 +1621,6 @@ 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/Testing.h"
#include "Testing/TypeTraitsTesting.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_REDCRAFT::NAMESPACE_PRIVATE::VarArgsAssert<Type>, va_arg(ContextName, Type))
#define VARARGS_ACCESS(ContextName, Type) (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_REDCRAFT::NAMESPACE_PRIVATE::TLiteral<CharType>::Select(TEXT(StringLiteral), WTEXT(StringLiteral), U8TEXT(StringLiteral), U16TEXT(StringLiteral), U32TEXT(StringLiteral))
#define LITERAL(CharType, StringLiteral) 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

@ -0,0 +1,23 @@
#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

@ -0,0 +1,21 @@
#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

@ -0,0 +1,27 @@
#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

@ -8,14 +8,10 @@ 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

@ -0,0 +1,20 @@
#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

@ -0,0 +1,21 @@
#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

@ -0,0 +1,28 @@
#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

@ -0,0 +1,17 @@
#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