mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
Fix gcc compile
This commit is contained in:
@@ -207,6 +207,7 @@ namespace beast
|
||||
#include "containers/beast_LockFreeStack.h"
|
||||
#include "threads/beast_SpinDelay.h"
|
||||
#include "memory/beast_StaticObject.h"
|
||||
#include "memory/beast_Memory.h"
|
||||
|
||||
#include "text/beast_String.h"
|
||||
#include "text/beast_CharacterFunctions.h"
|
||||
@@ -217,7 +218,6 @@ namespace beast
|
||||
|
||||
#include "time/beast_PerformedAtExit.h"
|
||||
#include "diagnostic/beast_LeakChecked.h"
|
||||
#include "memory/beast_Memory.h"
|
||||
#include "memory/beast_ByteOrder.h"
|
||||
#include "logging/beast_Logger.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:
|
||||
AbstractFifoTests() : UnitTestType <AbstractFifoTests> ("Abstract Fifo")
|
||||
AbstractFifoTests() : UnitTest ("Abstract Fifo")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -225,5 +225,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <AbstractFifoTests>;
|
||||
static AbstractFifoTests abstractFifoTests;
|
||||
#endif
|
||||
|
||||
@@ -28,14 +28,50 @@
|
||||
#include "../containers/beast_OwnedArray.h"
|
||||
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
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates a test with the given name. */
|
||||
explicit UnitTest (const String& name);
|
||||
explicit UnitTest (String const& name);
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~UnitTest();
|
||||
@@ -241,58 +277,4 @@ private:
|
||||
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
|
||||
|
||||
@@ -923,10 +923,10 @@ MemoryMappedFile::MemoryMappedFile (const File& file, const Range<int64>& fileRa
|
||||
|
||||
//==============================================================================
|
||||
|
||||
class FileTests : public UnitTestType <FileTests>
|
||||
class FileTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
FileTests() : UnitTestType <FileTests> ("File") {}
|
||||
FileTests() : UnitTest ("File") {}
|
||||
|
||||
void runTest()
|
||||
{
|
||||
@@ -1107,6 +1107,6 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <FileTests>;
|
||||
static FileTests fileTests;
|
||||
#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:
|
||||
JSONTests() : UnitTestType <JSONTests> ("JSON") {}
|
||||
JSONTests() : UnitTest ("JSON") { }
|
||||
|
||||
static String createRandomWideCharString (Random& r)
|
||||
{
|
||||
@@ -640,5 +640,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <JSONTests>;
|
||||
static JSONTests jsonTests;
|
||||
#endif
|
||||
|
||||
@@ -134,10 +134,10 @@ void Random::fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numB
|
||||
|
||||
//==============================================================================
|
||||
|
||||
class RandomTests : public UnitTestType <RandomTests>
|
||||
class RandomTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
RandomTests() : UnitTestType <RandomTests> ("Random") {}
|
||||
RandomTests() : UnitTest ("Random") {}
|
||||
|
||||
void runTest()
|
||||
{
|
||||
@@ -166,5 +166,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <RandomTests>;
|
||||
static RandomTests randomTests;
|
||||
#endif
|
||||
|
||||
@@ -89,10 +89,10 @@ int64 MemoryInputStream::getPosition()
|
||||
|
||||
//==============================================================================
|
||||
|
||||
class MemoryStreamTests : public UnitTestType <MemoryStreamTests>
|
||||
class MemoryStreamTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
MemoryStreamTests() : UnitTestType <MemoryStreamTests> ("MemoryStream") {}
|
||||
MemoryStreamTests() : UnitTest ("MemoryStream") { }
|
||||
|
||||
void runTest()
|
||||
{
|
||||
@@ -149,6 +149,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <MemoryStreamTests>;
|
||||
static MemoryStreamTests memoryStreamTests;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2075,10 +2075,10 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes)
|
||||
//==============================================================================
|
||||
//==============================================================================
|
||||
|
||||
class StringTests : public UnitTestType <StringTests>
|
||||
class StringTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
StringTests() : UnitTestType <StringTests> ("String") {}
|
||||
StringTests() : UnitTest ("String") { }
|
||||
|
||||
template <class CharPointerType>
|
||||
struct TestUTFConversion
|
||||
@@ -2403,5 +2403,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <StringTests>;
|
||||
static StringTests stringTests;
|
||||
#endif
|
||||
|
||||
@@ -174,10 +174,10 @@ String TextDiff::Change::appliedTo (const String& text) const noexcept
|
||||
|
||||
//==============================================================================
|
||||
|
||||
class DiffTests : public UnitTestType <DiffTests>
|
||||
class DiffTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
DiffTests() : UnitTestType <DiffTests> ("TextDiff") {}
|
||||
DiffTests() : UnitTest ("TextDiff") {}
|
||||
|
||||
static String createString()
|
||||
{
|
||||
@@ -230,5 +230,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <DiffTests>;
|
||||
static DiffTests diffTests;
|
||||
#endif
|
||||
|
||||
@@ -58,10 +58,10 @@ String ChildProcess::readAllProcessOutput()
|
||||
|
||||
//==============================================================================
|
||||
|
||||
class ChildProcessTests : public UnitTestType <ChildProcessTests>
|
||||
class ChildProcessTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
ChildProcessTests() : UnitTestType <ChildProcessTests> ("ChildProcess") {}
|
||||
ChildProcessTests() : UnitTest ("ChildProcess") {}
|
||||
|
||||
void runTest()
|
||||
{
|
||||
@@ -83,5 +83,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <ChildProcessTests>;
|
||||
static ChildProcessTests childProcessTests;
|
||||
#endif
|
||||
|
||||
@@ -252,10 +252,10 @@ void SpinLock::enter() const noexcept
|
||||
|
||||
//==============================================================================
|
||||
|
||||
class AtomicTests : public UnitTestType <AtomicTests>
|
||||
class AtomicTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
AtomicTests() : UnitTestType <AtomicTests> ("Atomic") {}
|
||||
AtomicTests() : UnitTest ("Atomic") {}
|
||||
|
||||
void runTest()
|
||||
{
|
||||
@@ -351,5 +351,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <AtomicTests>;
|
||||
static AtomicTests atomicTests;
|
||||
#endif
|
||||
|
||||
@@ -158,10 +158,10 @@ bool GZIPCompressorOutputStream::setPosition (int64 /*newPosition*/)
|
||||
|
||||
//==============================================================================
|
||||
|
||||
class GZIPTests : public UnitTestType <GZIPTests>
|
||||
class GZIPTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
GZIPTests() : UnitTestType <GZIPTests> ("GZIP") {}
|
||||
GZIPTests() : UnitTest ("GZIP") {}
|
||||
|
||||
void runTest()
|
||||
{
|
||||
@@ -206,5 +206,5 @@ public:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <GZIPTests>;
|
||||
static GZIPTests gzipTests;
|
||||
#endif
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
class UnsignedIntegerTests : public UnitTestType <UnsignedIntegerTests>
|
||||
class UnsignedIntegerTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
UnsignedIntegerTests ()
|
||||
: UnitTestType <UnsignedIntegerTests> ("UnsignedInteger")
|
||||
UnsignedIntegerTests () : UnitTest ("UnsignedInteger")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -84,5 +83,5 @@ private:
|
||||
};
|
||||
|
||||
#if BEAST_UNIT_TESTS
|
||||
template class UnitTestType <UnsignedIntegerTests>;
|
||||
static UnsignedIntegerTests unsignedIntegerTests;
|
||||
#endif
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
*/
|
||||
bool asBoolean () const noexcept
|
||||
{
|
||||
return isNonZero ();
|
||||
return isNotZero ();
|
||||
}
|
||||
|
||||
/** Access a particular byte.
|
||||
|
||||
Reference in New Issue
Block a user