mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Fix gcc compile
This commit is contained in:
@@ -207,6 +207,7 @@ namespace beast
|
|||||||
#include "containers/beast_LockFreeStack.h"
|
#include "containers/beast_LockFreeStack.h"
|
||||||
#include "threads/beast_SpinDelay.h"
|
#include "threads/beast_SpinDelay.h"
|
||||||
#include "memory/beast_StaticObject.h"
|
#include "memory/beast_StaticObject.h"
|
||||||
|
#include "memory/beast_Memory.h"
|
||||||
|
|
||||||
#include "text/beast_String.h"
|
#include "text/beast_String.h"
|
||||||
#include "text/beast_CharacterFunctions.h"
|
#include "text/beast_CharacterFunctions.h"
|
||||||
@@ -217,7 +218,6 @@ namespace beast
|
|||||||
|
|
||||||
#include "time/beast_PerformedAtExit.h"
|
#include "time/beast_PerformedAtExit.h"
|
||||||
#include "diagnostic/beast_LeakChecked.h"
|
#include "diagnostic/beast_LeakChecked.h"
|
||||||
#include "memory/beast_Memory.h"
|
|
||||||
#include "memory/beast_ByteOrder.h"
|
#include "memory/beast_ByteOrder.h"
|
||||||
#include "logging/beast_Logger.h"
|
#include "logging/beast_Logger.h"
|
||||||
#include "threads/beast_Thread.h"
|
#include "threads/beast_Thread.h"
|
||||||
|
|||||||
@@ -126,10 +126,10 @@ void AbstractFifo::finishedRead (int numRead) noexcept
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class AbstractFifoTests : public UnitTestType <AbstractFifoTests>
|
class AbstractFifoTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AbstractFifoTests() : UnitTestType <AbstractFifoTests> ("Abstract Fifo")
|
AbstractFifoTests() : UnitTest ("Abstract Fifo")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,5 +225,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <AbstractFifoTests>;
|
static AbstractFifoTests abstractFifoTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,14 +28,50 @@
|
|||||||
#include "../containers/beast_OwnedArray.h"
|
#include "../containers/beast_OwnedArray.h"
|
||||||
class UnitTests;
|
class UnitTests;
|
||||||
|
|
||||||
/** Factored base class for unit test template.
|
|
||||||
|
/** This is a base class for classes that perform a unit test.
|
||||||
|
|
||||||
|
To write a test using this class, your code should look something like this:
|
||||||
|
|
||||||
|
@code
|
||||||
|
|
||||||
|
class MyTest : public UnitTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyTest() : UnitTest ("Foobar testing") { }
|
||||||
|
|
||||||
|
void runTest()
|
||||||
|
{
|
||||||
|
beginTest ("Part 1");
|
||||||
|
|
||||||
|
expect (myFoobar.doesSomething());
|
||||||
|
expect (myFoobar.doesSomethingElse());
|
||||||
|
|
||||||
|
beginTest ("Part 2");
|
||||||
|
|
||||||
|
expect (myOtherFoobar.doesSomething());
|
||||||
|
expect (myOtherFoobar.doesSomethingElse());
|
||||||
|
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Explicit template instantiation is required to make the unit
|
||||||
|
// test get automatically added to the set of unit tests.
|
||||||
|
template class UnitTestType <MyTest>;
|
||||||
|
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
To run one or more unit tests, use the UnitTests class.
|
||||||
|
|
||||||
|
@see UnitTests
|
||||||
*/
|
*/
|
||||||
class BEAST_API UnitTest : Uncopyable
|
class BEAST_API UnitTest : Uncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/** Creates a test with the given name. */
|
/** Creates a test with the given name. */
|
||||||
explicit UnitTest (const String& name);
|
explicit UnitTest (String const& name);
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
virtual ~UnitTest();
|
virtual ~UnitTest();
|
||||||
@@ -241,58 +277,4 @@ private:
|
|||||||
bool logPasses;
|
bool logPasses;
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** This is a base class for classes that perform a unit test.
|
|
||||||
|
|
||||||
To write a test using this class, your code should look something like this:
|
|
||||||
|
|
||||||
@code
|
|
||||||
|
|
||||||
class MyTest : public UnitTestType <MyTest>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MyTest() : UnitTestType <MyTest> ("Foobar testing") { }
|
|
||||||
|
|
||||||
void runTest()
|
|
||||||
{
|
|
||||||
beginTest ("Part 1");
|
|
||||||
|
|
||||||
expect (myFoobar.doesSomething());
|
|
||||||
expect (myFoobar.doesSomethingElse());
|
|
||||||
|
|
||||||
beginTest ("Part 2");
|
|
||||||
|
|
||||||
expect (myOtherFoobar.doesSomething());
|
|
||||||
expect (myOtherFoobar.doesSomethingElse());
|
|
||||||
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Explicit template instantiation is required to make the unit
|
|
||||||
// test get automatically added to the set of unit tests.
|
|
||||||
template class UnitTestType <MyTest>;
|
|
||||||
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
To run one or more unit tests, use the UnitTests class.
|
|
||||||
|
|
||||||
@see UnitTests
|
|
||||||
*/
|
|
||||||
template <class Type>
|
|
||||||
class UnitTestType : public UnitTest
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit UnitTestType (String const& name)
|
|
||||||
: UnitTest (name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static Type s_test;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Type>
|
|
||||||
Type UnitTestType <Type>::s_test;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -923,10 +923,10 @@ MemoryMappedFile::MemoryMappedFile (const File& file, const Range<int64>& fileRa
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class FileTests : public UnitTestType <FileTests>
|
class FileTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FileTests() : UnitTestType <FileTests> ("File") {}
|
FileTests() : UnitTest ("File") {}
|
||||||
|
|
||||||
void runTest()
|
void runTest()
|
||||||
{
|
{
|
||||||
@@ -1107,6 +1107,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <FileTests>;
|
static FileTests fileTests;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -532,10 +532,10 @@ void JSON::writeToStream (OutputStream& output, const var& data, const bool allO
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class JSONTests : public UnitTestType <JSONTests>
|
class JSONTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
JSONTests() : UnitTestType <JSONTests> ("JSON") {}
|
JSONTests() : UnitTest ("JSON") { }
|
||||||
|
|
||||||
static String createRandomWideCharString (Random& r)
|
static String createRandomWideCharString (Random& r)
|
||||||
{
|
{
|
||||||
@@ -640,5 +640,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <JSONTests>;
|
static JSONTests jsonTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -134,10 +134,10 @@ void Random::fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numB
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class RandomTests : public UnitTestType <RandomTests>
|
class RandomTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RandomTests() : UnitTestType <RandomTests> ("Random") {}
|
RandomTests() : UnitTest ("Random") {}
|
||||||
|
|
||||||
void runTest()
|
void runTest()
|
||||||
{
|
{
|
||||||
@@ -166,5 +166,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <RandomTests>;
|
static RandomTests randomTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -89,10 +89,10 @@ int64 MemoryInputStream::getPosition()
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class MemoryStreamTests : public UnitTestType <MemoryStreamTests>
|
class MemoryStreamTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MemoryStreamTests() : UnitTestType <MemoryStreamTests> ("MemoryStream") {}
|
MemoryStreamTests() : UnitTest ("MemoryStream") { }
|
||||||
|
|
||||||
void runTest()
|
void runTest()
|
||||||
{
|
{
|
||||||
@@ -149,6 +149,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <MemoryStreamTests>;
|
static MemoryStreamTests memoryStreamTests;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2075,10 +2075,10 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes)
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class StringTests : public UnitTestType <StringTests>
|
class StringTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StringTests() : UnitTestType <StringTests> ("String") {}
|
StringTests() : UnitTest ("String") { }
|
||||||
|
|
||||||
template <class CharPointerType>
|
template <class CharPointerType>
|
||||||
struct TestUTFConversion
|
struct TestUTFConversion
|
||||||
@@ -2403,5 +2403,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <StringTests>;
|
static StringTests stringTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -174,10 +174,10 @@ String TextDiff::Change::appliedTo (const String& text) const noexcept
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class DiffTests : public UnitTestType <DiffTests>
|
class DiffTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DiffTests() : UnitTestType <DiffTests> ("TextDiff") {}
|
DiffTests() : UnitTest ("TextDiff") {}
|
||||||
|
|
||||||
static String createString()
|
static String createString()
|
||||||
{
|
{
|
||||||
@@ -230,5 +230,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <DiffTests>;
|
static DiffTests diffTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ String ChildProcess::readAllProcessOutput()
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class ChildProcessTests : public UnitTestType <ChildProcessTests>
|
class ChildProcessTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ChildProcessTests() : UnitTestType <ChildProcessTests> ("ChildProcess") {}
|
ChildProcessTests() : UnitTest ("ChildProcess") {}
|
||||||
|
|
||||||
void runTest()
|
void runTest()
|
||||||
{
|
{
|
||||||
@@ -83,5 +83,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <ChildProcessTests>;
|
static ChildProcessTests childProcessTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -252,10 +252,10 @@ void SpinLock::enter() const noexcept
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class AtomicTests : public UnitTestType <AtomicTests>
|
class AtomicTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AtomicTests() : UnitTestType <AtomicTests> ("Atomic") {}
|
AtomicTests() : UnitTest ("Atomic") {}
|
||||||
|
|
||||||
void runTest()
|
void runTest()
|
||||||
{
|
{
|
||||||
@@ -351,5 +351,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <AtomicTests>;
|
static AtomicTests atomicTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -158,10 +158,10 @@ bool GZIPCompressorOutputStream::setPosition (int64 /*newPosition*/)
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class GZIPTests : public UnitTestType <GZIPTests>
|
class GZIPTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GZIPTests() : UnitTestType <GZIPTests> ("GZIP") {}
|
GZIPTests() : UnitTest ("GZIP") {}
|
||||||
|
|
||||||
void runTest()
|
void runTest()
|
||||||
{
|
{
|
||||||
@@ -206,5 +206,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <GZIPTests>;
|
static GZIPTests gzipTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,11 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class UnsignedIntegerTests : public UnitTestType <UnsignedIntegerTests>
|
class UnsignedIntegerTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UnsignedIntegerTests ()
|
UnsignedIntegerTests () : UnitTest ("UnsignedInteger")
|
||||||
: UnitTestType <UnsignedIntegerTests> ("UnsignedInteger")
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,5 +83,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if BEAST_UNIT_TESTS
|
#if BEAST_UNIT_TESTS
|
||||||
template class UnitTestType <UnsignedIntegerTests>;
|
static UnsignedIntegerTests unsignedIntegerTests;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool asBoolean () const noexcept
|
bool asBoolean () const noexcept
|
||||||
{
|
{
|
||||||
return isNonZero ();
|
return isNotZero ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Access a particular byte.
|
/** Access a particular byte.
|
||||||
|
|||||||
Reference in New Issue
Block a user