mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 21:15:58 +00:00
New unit_test framework:
* Header-only! * No external dependencies or other beast modules * Compilation options allow for: - Stand-alone application to run a single test suite - Stand-alone application to run a set of test suites - Global suite of tests inline with the host application - Disable test suite generation completely * Existing tests reworked to use the new classes
This commit is contained in:
@@ -17,8 +17,9 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace beast
|
||||
{
|
||||
#include "../../../beast/unit_test/suite.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
RandomAccessFile::RandomAccessFile () noexcept
|
||||
: fileHandle (nullptr)
|
||||
@@ -101,13 +102,9 @@ Result RandomAccessFile::flush ()
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class RandomAccessFileTests : public UnitTest
|
||||
class RandomAccessFile_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
RandomAccessFileTests () : UnitTest ("RandomAccessFile", "beast")
|
||||
{
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
maxPayload = 8192
|
||||
@@ -221,7 +218,9 @@ public:
|
||||
|
||||
int const seedValue = 50;
|
||||
|
||||
beginTestCase (String ("numRecords=") + String (numRecords));
|
||||
std::stringstream ss;
|
||||
ss << numRecords << " records";
|
||||
testcase (ss.str());
|
||||
|
||||
// Calculate the path
|
||||
File const path (File::createTempFile ("RandomAccessFile"));
|
||||
@@ -264,14 +263,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void runTest ()
|
||||
void run ()
|
||||
{
|
||||
testFile (10000);
|
||||
}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
static RandomAccessFileTests randomAccessFileTests;
|
||||
BEAST_DEFINE_TESTSUITE(RandomAccessFile,beast_core,beast);
|
||||
|
||||
} // namespace beast
|
||||
} // beast
|
||||
|
||||
Reference in New Issue
Block a user