diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj
index 5ed815b435..64c135d19c 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj
+++ b/Builds/VisualStudio2013/RippleD.vcxproj
@@ -22,12 +22,6 @@
-
- true
- true
- true
- true
-
true
true
@@ -1024,7 +1018,7 @@
true
true
-
+
true
true
true
@@ -1712,6 +1706,12 @@
true
true
+
+ true
+ true
+ true
+ true
+
true
true
@@ -2238,7 +2238,6 @@
-
@@ -2509,7 +2508,6 @@
-
diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters
index 503928fdf6..b2c9bd29d6 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters
@@ -750,9 +750,6 @@
[2] Old Ripple\ripple_app\consensus
-
- [2] Old Ripple\ripple_app\main
-
[2] Old Ripple\ripple_app\websocket
@@ -1356,9 +1353,6 @@
[1] Ripple\radmap\impl
-
- [1] Ripple\common\impl
-
[1] Ripple\common\impl
@@ -1497,6 +1491,12 @@
[1] Ripple\sslutil\impl
+
+ [2] Old Ripple\ripple_data\protocol
+
+
+ [2] Old Ripple\ripple_app\main
+
@@ -1982,9 +1982,6 @@
[2] Old Ripple\ripple_app\consensus
-
- [2] Old Ripple\ripple_app\main
-
[2] Old Ripple\ripple_app\websocket
@@ -2834,9 +2831,6 @@
[1] Ripple\radmap\api
-
- [1] Ripple\common
-
[1] Ripple\common
diff --git a/src/BeastConfig.h b/src/BeastConfig.h
index 36210f93f0..a9184bbac9 100644
--- a/src/BeastConfig.h
+++ b/src/BeastConfig.h
@@ -27,6 +27,21 @@
@file BeastConfig.h
*/
+//------------------------------------------------------------------------------
+//
+// Unit Tests
+//
+//------------------------------------------------------------------------------
+
+/** Config: BEAST_NO_UNIT_TEST_INLINE
+ Prevents unit test definitions from being inserted into a global table.
+ The default is to include inline unit test definitions.
+*/
+
+#ifndef BEAST_NO_UNIT_TEST_INLINE
+//#define BEAST_NO_UNIT_TEST_INLINE 1
+#endif
+
//------------------------------------------------------------------------------
//
// Diagnostics
diff --git a/src/beast/BeastConfig.h b/src/beast/BeastConfig.h
index 40d2da93f9..0765cc3b77 100644
--- a/src/beast/BeastConfig.h
+++ b/src/beast/BeastConfig.h
@@ -27,6 +27,19 @@
@file BeastConfig.h
*/
+//------------------------------------------------------------------------------
+//
+// Unit Tests
+//
+//------------------------------------------------------------------------------
+
+/** Config: BEAST_NO_UNIT_TEST_INLINE
+ Prevents unit test definitions from being inserted into a global table.
+*/
+#ifndef BEAST_NO_UNIT_TEST_INLINE
+#define BEAST_NO_UNIT_TEST_INLINE 0
+#endif
+
//------------------------------------------------------------------------------
//
// Diagnostics
diff --git a/src/beast/Builds/VisualStudio2013/beast.vcxproj b/src/beast/Builds/VisualStudio2013/beast.vcxproj
index 1df00296c4..9dbccaa521 100644
--- a/src/beast/Builds/VisualStudio2013/beast.vcxproj
+++ b/src/beast/Builds/VisualStudio2013/beast.vcxproj
@@ -93,6 +93,7 @@
+
@@ -224,6 +225,24 @@
+
+
+
+ true
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
@@ -284,7 +303,6 @@
-
@@ -300,7 +318,6 @@
-
@@ -380,7 +397,7 @@
true
true
-
+
true
true
true
@@ -392,13 +409,13 @@
true
true
-
+
true
true
true
true
-
+
true
true
true
@@ -406,38 +423,32 @@
-
- true
- true
- true
- true
-
true
true
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
true
true
true
true
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
-
+
true
true
true
@@ -450,12 +461,6 @@
true
-
- true
- true
- true
- true
-
true
true
@@ -492,6 +497,18 @@
true
true
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
true
@@ -548,6 +565,12 @@
true
true
+
+ true
+ true
+ true
+ true
+
true
true
@@ -597,12 +620,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -622,8 +639,19 @@
true
-
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
true
true
@@ -637,12 +665,6 @@
true
-
- true
- true
- true
- true
-
true
true
@@ -673,13 +695,19 @@
true
true
-
-
+
true
true
true
true
+
+ true
+ true
+ true
+ true
+
+
true
true
@@ -716,6 +744,12 @@
true
true
+
+ true
+ true
+ true
+ true
+
true
true
@@ -800,12 +834,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -871,12 +899,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -943,12 +965,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -1285,7 +1301,7 @@
Disabled
WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
- $(ProjectDir);%(AdditionalIncludeDirectories)
+ %(AdditionalIncludeDirectories)
false
true
diff --git a/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters b/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters
index e2c6b8d5bc..eb91f1d7cc 100644
--- a/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters
+++ b/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters
@@ -264,9 +264,6 @@
{48c7ee12-704c-42cb-99ea-9a486bb4b57e}
-
- {e30eda19-95b4-4831-b86a-ee5fae88abd2}
-
{a4dca8cc-7d1f-4353-b7e1-15eab33e8bd4}
@@ -291,6 +288,27 @@
{3c58ba5e-1855-4865-8a9f-c0afd5014e74}
+
+ {09aa885d-9607-4f8c-80d2-43673e541fd0}
+
+
+ {afec071b-bc2c-4d32-a5e3-e99273a81a1c}
+
+
+ {3e1fc57f-e3c0-4889-a1d8-25145aa535a1}
+
+
+ {1e86eefc-51b3-4270-b472-dd3f323e9875}
+
+
+ {a8c4a672-6264-45a5-8c22-e3ce2391300e}
+
+
+ {94cc3672-688a-46e4-8df0-c3523a521c43}
+
+
+ {63c495fa-b6b2-42ed-8ae3-9f3582e76bf5}
+
@@ -416,9 +434,6 @@
beast_core\diagnostic
-
- beast_core\diagnostic
-
beast_core\files
@@ -656,9 +671,6 @@
beast_core\time
-
- beast_core\misc
-
beast_core\diagnostic
@@ -749,9 +761,6 @@
beast
-
- beast
-
beast
@@ -1170,6 +1179,54 @@
beast\streams
+
+ beast\unit_test
+
+
+ beast\unit_test
+
+
+ beast\unit_test
+
+
+ beast\unit_test
+
+
+ beast\unit_test
+
+
+ beast
+
+
+ beast\unit_test
+
+
+ beast
+
+
+ beast\unit_test
+
+
+ beast\container
+
+
+ beast\unit_test
+
+
+ beast\unit_test
+
+
+ beast\unit_test
+
+
+ beast\unit_test
+
+
+ beast\chrono
+
+
+ beast\unit_test
+
@@ -1274,9 +1331,6 @@
beast_core\native
-
- beast_core\diagnostic
-
beast_core\files
@@ -1355,9 +1409,6 @@
beast_asio\basics
-
- beast_asio\system
-
beast_asio\tests
@@ -1418,9 +1469,6 @@
beast_core\time
-
- beast_core\misc
-
beast_core\diagnostic
@@ -1499,15 +1547,6 @@
beast_asio\http
-
- beast\chrono\impl
-
-
- beast\smart_ptr
-
-
- beast\threads\impl
-
beast\threads\impl
@@ -1565,15 +1604,6 @@
beast\insight\impl
-
- beast\chrono\impl
-
-
- beast\chrono\impl
-
-
- beast\crypto\impl
-
beast\crypto\impl
@@ -1583,9 +1613,6 @@
beast\insight\impl
-
- beast\net\impl
-
beast\net\impl
@@ -1595,21 +1622,12 @@
beast\net\impl
-
- beast\utility\impl
-
beast\chrono
-
- beast\chrono\impl
-
beast\container
-
- beast\container\impl
-
beast\container\tests
@@ -1622,15 +1640,6 @@
beast\asio
-
- beast\asio\tests
-
-
- beast\asio\tests
-
-
- beast\asio\tests
-
beast\asio\tests
@@ -1640,11 +1649,56 @@
beast\http\impl
+
+ beast\utility\tests
+
+
+ beast\container\tests
+
+
+ beast\asio\tests
+
+
+ beast\asio\tests
+
+
+ beast\asio\tests
+
+
+ beast\chrono\tests
+
+
+ beast\crypto\tests
+
+
+ beast\crypto\tests
+
+
+ beast\utility\tests
+
+
+ beast\threads\tests
+
+
+ beast\chrono\tests
+
+
+ beast\chrono\impl
+
+
+ beast\http\tests
+
+
+ beast\net\tests
+
+
+ beast\streams\tests
+
beast\streams
-
- beast\utility\tests
+
+ beast\threads\tests
diff --git a/src/beast/beast/asio/Asio.cpp b/src/beast/beast/asio/Asio.cpp
index fb60b4fd36..4f964be9ba 100644
--- a/src/beast/beast/asio/Asio.cpp
+++ b/src/beast/beast/asio/Asio.cpp
@@ -23,10 +23,10 @@
#include "impl/IPAddressConversion.cpp"
-#include "tests/wrap_handler_tests.cpp"
-#include "tests/bind_handler_tests.cpp"
+#include "tests/wrap_handler.test.cpp"
+#include "tests/bind_handler.test.cpp"
#include "tests/enable_wait_for_async.test.cpp"
-#include "tests/shared_handler_tests.cpp"
+#include "tests/shared_handler.test.cpp"
#include "abstract_socket.cpp" // TEMPORARY!
diff --git a/src/beast/beast/asio/tests/bind_handler_tests.cpp b/src/beast/beast/asio/tests/bind_handler.test.cpp
similarity index 78%
rename from src/beast/beast/asio/tests/bind_handler_tests.cpp
rename to src/beast/beast/asio/tests/bind_handler.test.cpp
index 7992e1f106..c9e8d5a7c7 100644
--- a/src/beast/beast/asio/tests/bind_handler_tests.cpp
+++ b/src/beast/beast/asio/tests/bind_handler.test.cpp
@@ -21,7 +21,7 @@
#include "../../../BeastConfig.h"
#endif
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
+#include "../../unit_test/suite.h"
#include "../bind_handler.h"
@@ -30,31 +30,24 @@
namespace beast {
namespace asio {
-class bind_handler_Tests : public UnitTest
+class bind_handler_test : public unit_test::suite
{
public:
static void foo (int)
{
}
- void runTest()
+ void run()
{
- beginTestCase ("call");
-
- auto f (bind_handler (std::bind (&foo, std::placeholders::_1),
+ auto f (bind_handler (
+ std::bind (&foo, std::placeholders::_1),
42));
-
f();
-
pass();
}
-
- bind_handler_Tests() : UnitTest ("bind_handler", "beast", runManual)
- {
- }
};
-static bind_handler_Tests bind_handler_tests;
+BEAST_DEFINE_TESTSUITE(bind_handler,asio,beast);
}
}
diff --git a/src/beast/beast/asio/tests/enable_wait_for_async.test.cpp b/src/beast/beast/asio/tests/enable_wait_for_async.test.cpp
index 191cbb4b7d..f09f53e442 100644
--- a/src/beast/beast/asio/tests/enable_wait_for_async.test.cpp
+++ b/src/beast/beast/asio/tests/enable_wait_for_async.test.cpp
@@ -21,7 +21,7 @@
#include "../../../BeastConfig.h"
#endif
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
+#include "../../unit_test/suite.h"
#include "../bind_handler.h"
#include "../enable_wait_for_async.h"
@@ -30,7 +30,7 @@
namespace beast {
-class enable_wait_for_async_Tests : public UnitTest
+class enable_wait_for_async_test : public unit_test::suite
{
public:
typedef boost::system::error_code error_code;
@@ -89,22 +89,17 @@ public:
}
};
- beginTestCase ("wait_for_async");
owner o;
o();
expect (o.notified);
}
- void runTest()
+ void run()
{
test();
}
-
- enable_wait_for_async_Tests() : UnitTest ("enable_wait_for_async", "beast")
- {
- }
};
-static enable_wait_for_async_Tests enable_wait_for_async_tests;
+BEAST_DEFINE_TESTSUITE(enable_wait_for_async,asio,beast);
}
diff --git a/src/beast/beast/asio/tests/shared_handler_tests.cpp b/src/beast/beast/asio/tests/shared_handler.test.cpp
similarity index 95%
rename from src/beast/beast/asio/tests/shared_handler_tests.cpp
rename to src/beast/beast/asio/tests/shared_handler.test.cpp
index 358ff798bc..686c0f08a9 100644
--- a/src/beast/beast/asio/tests/shared_handler_tests.cpp
+++ b/src/beast/beast/asio/tests/shared_handler.test.cpp
@@ -21,7 +21,7 @@
#include "../../../BeastConfig.h"
#endif
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
+#include "../../unit_test/suite.h"
#include "../shared_handler.h"
@@ -37,7 +37,7 @@
namespace beast {
-class shared_handler_Tests : public UnitTest
+class shared_handler_test : public unit_test::suite
{
public:
struct test_results
@@ -139,10 +139,8 @@ public:
async_op (handler);
}
- void runTest()
+ void run()
{
- beginTestCase ("hooks");
-
#if ! BEAST_NO_STD_FUNCTION_CONSTRUCTIBLE
static_assert (! std::is_constructible <
std::function , int&&>::value,
@@ -230,12 +228,8 @@ public:
expect (r.cont);
}
}
-
- shared_handler_Tests() : UnitTest ("shared_handler", "beast")
- {
- }
};
-static shared_handler_Tests shared_handler_tests;
+BEAST_DEFINE_TESTSUITE(shared_handler,asio,beast);
}
diff --git a/src/beast/beast/asio/tests/wrap_handler_tests.cpp b/src/beast/beast/asio/tests/wrap_handler.test.cpp
similarity index 90%
rename from src/beast/beast/asio/tests/wrap_handler_tests.cpp
rename to src/beast/beast/asio/tests/wrap_handler.test.cpp
index de368f74f3..be72dbb02c 100644
--- a/src/beast/beast/asio/tests/wrap_handler_tests.cpp
+++ b/src/beast/beast/asio/tests/wrap_handler.test.cpp
@@ -21,7 +21,7 @@
#include "../../../BeastConfig.h"
#endif
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
+#include "../../unit_test/suite.h"
#include "../wrap_handler.h"
@@ -38,7 +38,7 @@ namespace asio {
// Displays the order of destruction of parameters in the bind wrapper
//
-class boost_bind_Tests : public UnitTest
+class boost_bind_test : public unit_test::suite
{
public:
struct Result
@@ -84,10 +84,8 @@ public:
{
}
- void runTest()
+ void run()
{
- beginTestCase ("order");
-
{
Result r;
{
@@ -96,7 +94,8 @@ public:
Arg (r, "two"),
Arg (r, "three"));
}
- logMessage (std::string ("boost::bind (") + r.text + ")");
+ log <<
+ std::string ("boost::bind (") + r.text + ")";
}
{
@@ -107,22 +106,20 @@ public:
Arg (r, "two"),
Arg (r, "three"));
}
- logMessage (std::string ("std::bind (") + r.text + ")");
+
+ log <<
+ std::string ("std::bind (") + r.text + ")";
}
pass();
}
-
- boost_bind_Tests() : UnitTest ("bind", "beast", runManual)
- {
- }
};
-static boost_bind_Tests boost_bind_tests;
+BEAST_DEFINE_TESTSUITE(boost_bind,asio,beast);
//------------------------------------------------------------------------------
-class wrap_handler_handler_Tests : public UnitTest
+class wrap_handler_test : public unit_test::suite
{
public:
struct test_results
@@ -218,10 +215,8 @@ public:
return boost_asio_handler_cont_helpers::is_continuation (handler);
}
- void runTest()
+ void run()
{
- beginTestCase ("hooks");
-
// Hooks called when using the raw handler
{
test_results r;
@@ -276,13 +271,9 @@ public:
expect (f.call);
}
}
-
- wrap_handler_handler_Tests() : UnitTest ("wrap_handler", "beast")
- {
- }
};
-static wrap_handler_handler_Tests wrap_handler_handler_tests;
+BEAST_DEFINE_TESTSUITE(wrap_handler,asio,beast);
}
}
diff --git a/src/beast/beast/chrono/Chrono.cpp b/src/beast/beast/chrono/Chrono.cpp
index 2dae119718..4306d7e800 100644
--- a/src/beast/beast/chrono/Chrono.cpp
+++ b/src/beast/beast/chrono/Chrono.cpp
@@ -22,10 +22,9 @@
#endif
#include "../Config.h"
-#include "../../modules/beast_core/beast_core.h" // for UnitTest
-#include "impl/abstract_clock.cpp"
#include "impl/chrono_io.cpp"
-#include "impl/basic_seconds_clock.cpp"
-
#include "impl/RelativeTime.cpp"
+
+#include "tests/abstract_clock.test.cpp"
+#include "tests/basic_seconds_clock.test.cpp"
diff --git a/src/beast/beast/chrono/abstract_clock.h b/src/beast/beast/chrono/abstract_clock.h
index 54c19444ca..d085825c5d 100644
--- a/src/beast/beast/chrono/abstract_clock.h
+++ b/src/beast/beast/chrono/abstract_clock.h
@@ -20,8 +20,6 @@
#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
#define BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
-#include "chrono_io.h"
-
#include
#include
@@ -75,9 +73,10 @@ public:
/** Returns the current time. */
virtual time_point now () const = 0;
+#if 0
/** Convert the specified time point to a string. */
/** @{ */
- virtual std::string to_string (time_point const& tp) const = 0;
+ //virtual std::string to_string (time_point const& tp) const = 0;
template
std::string to_string (
@@ -87,6 +86,7 @@ public:
std::chrono::time_point_cast (tp));
}
/** @} */
+#endif
/** Returning elapsed ticks since the epoch. */
rep elapsed () const
@@ -123,6 +123,7 @@ struct abstract_clock_wrapper
: public basic_abstract_clock_wrapper
{
// generic conversion displays the duration
+ /*
std::string to_string (typename basic_abstract_clock_wrapper <
TrivialClock, Duration>::time_point const& tp) const
{
@@ -130,6 +131,7 @@ struct abstract_clock_wrapper
ss << tp.time_since_epoch();
return ss.str ();
}
+ */
};
/*
diff --git a/src/beast/beast/chrono/impl/basic_seconds_clock.cpp b/src/beast/beast/chrono/abstract_clock_io.h
similarity index 69%
rename from src/beast/beast/chrono/impl/basic_seconds_clock.cpp
rename to src/beast/beast/chrono/abstract_clock_io.h
index 6c12ac1956..bd2ad9931e 100644
--- a/src/beast/beast/chrono/impl/basic_seconds_clock.cpp
+++ b/src/beast/beast/chrono/abstract_clock_io.h
@@ -17,30 +17,21 @@
*/
//==============================================================================
-#include "../basic_seconds_clock.h"
+#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_IO_H_INCLUDED
+#define BEAST_CHRONO_ABSTRACT_CLOCK_IO_H_INCLUDED
-#include "../../Config.h"
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
+#include "chrono_io.h"
namespace beast {
-class basic_seconds_clock_Tests : public UnitTest
+template
+std::basic_ostream &
+operator<< (std::basic_ostream & os,
+ std::chrono::time_point , Duration> const& tp)
{
-public:
- void runTest ()
- {
- beginTestCase ("now");
-
- basic_seconds_clock ::now ();
-
- pass ();
- }
-
- basic_seconds_clock_Tests() : UnitTest("basic_seconds_clock", "beast")
- {
- }
-};
-
-static basic_seconds_clock_Tests basic_seconds_clock_tests;
+ return os << tp.time_since_epoch() << " since epoch";
+}
}
+
+#endif
diff --git a/src/beast/beast/chrono/manual_clock.h b/src/beast/beast/chrono/manual_clock.h
index ad373725c9..8342c7d4f0 100644
--- a/src/beast/beast/chrono/manual_clock.h
+++ b/src/beast/beast/chrono/manual_clock.h
@@ -53,12 +53,14 @@ public:
return m_now;
}
+#if 0
std::string to_string (time_point const& tp) const
{
std::stringstream ss;
ss << tp.time_since_epoch() << " from start";
return ss.str ();
}
+#endif
/** Set the current time of the manual clock.
Precondition:
diff --git a/src/beast/beast/chrono/impl/abstract_clock.cpp b/src/beast/beast/chrono/tests/abstract_clock.test.cpp
similarity index 74%
rename from src/beast/beast/chrono/impl/abstract_clock.cpp
rename to src/beast/beast/chrono/tests/abstract_clock.test.cpp
index 11cc561412..7cf098d1b0 100644
--- a/src/beast/beast/chrono/impl/abstract_clock.cpp
+++ b/src/beast/beast/chrono/tests/abstract_clock.test.cpp
@@ -18,16 +18,18 @@
//==============================================================================
#include "../abstract_clock.h"
+#include "../abstract_clock_io.h"
#include "../manual_clock.h"
-#include
+#include "../../unit_test/suite.h"
-#include
#include
+#include
+#include
namespace beast {
-class abstract_clock_tests : public UnitTest
+class abstract_clock_test : public unit_test::suite
{
public:
void test (abstract_clock & c)
@@ -40,10 +42,10 @@ public:
std::stringstream ss;
ss <<
- "t1= " << c.to_string (t1) <<
- ", t2= " << c.to_string (t2) <<
+ "t1= " << t1.time_since_epoch() <<
+ ", t2= " << t2.time_since_epoch() <<
", elapsed= " << (t2 - t1);
- logMessage (ss.str());
+ log << ss.str();
}
}
@@ -54,45 +56,38 @@ public:
std::stringstream ss;
- ss << "now() = " << c.to_string (c.now ()) << std::endl;
+ ss << "now() = " << c.now () << std::endl;
c.set (clock_type::time_point (std::chrono::seconds (1)));
- ss << "now() = " << c.to_string (c.now ()) << std::endl;
+ ss << "now() = " << c.now () << std::endl;
c.set (clock_type::time_point (std::chrono::seconds (2)));
- ss << "now() = " << c.to_string (c.now ()) << std::endl;
+ ss << "now() = " << c.now () << std::endl;
- logMessage (ss.str());
+ log << ss.str();
}
- void runTest ()
+ void run ()
{
- beginTestCase ("Syntax");
-
- logMessage ("steady_clock");
+ log << "steady_clock";
test (get_abstract_clock ());
- logMessage ("system_clock");
+ log << "system_clock";
test (get_abstract_clock ());
- logMessage ("high_resolution_clock");
+ log << "high_resolution_clock";
test (get_abstract_clock ());
- logMessage ("manual_clock");
+ log << "manual_clock";
test_manual ();
pass ();
}
-
- abstract_clock_tests ()
- : UnitTest ("abstract_clock", "beast", runManual)
- {
- }
};
-static abstract_clock_tests abstract_clock_tests_;
+BEAST_DEFINE_TESTSUITE(abstract_clock,chrono,beast);
}
diff --git a/src/beast/beast/smart_ptr/SmartPtr.cpp b/src/beast/beast/chrono/tests/basic_seconds_clock.test.cpp
similarity index 75%
rename from src/beast/beast/smart_ptr/SmartPtr.cpp
rename to src/beast/beast/chrono/tests/basic_seconds_clock.test.cpp
index f7f123567e..e8e9c58df8 100644
--- a/src/beast/beast/smart_ptr/SmartPtr.cpp
+++ b/src/beast/beast/chrono/tests/basic_seconds_clock.test.cpp
@@ -17,15 +17,24 @@
*/
//==============================================================================
-#if BEAST_INCLUDE_BEASTCONFIG
-#include "../../BeastConfig.h"
-#endif
+#include "../../unit_test/suite.h"
-#include "../Config.h"
+#include "../basic_seconds_clock.h"
-#include "ContainerDeletePolicy.h"
-#include "ScopedPointer.h"
-#include "SharedObject.h"
-#include "SharedPtr.h"
+namespace beast {
-#include "../../modules/beast_core/beast_core.h" // for UnitTest
+class basic_seconds_clock_test : public unit_test::suite
+{
+public:
+ void
+ run()
+ {
+ basic_seconds_clock <
+ std::chrono::steady_clock>::now ();
+ pass ();
+ }
+};
+
+BEAST_DEFINE_TESTSUITE(basic_seconds_clock,chrono,beast);
+
+}
diff --git a/src/beast/beast/container/Container.cpp b/src/beast/beast/container/Container.cpp
index 1cf70c77f2..c11ccfa882 100644
--- a/src/beast/beast/container/Container.cpp
+++ b/src/beast/beast/container/Container.cpp
@@ -21,7 +21,5 @@
#include "../../BeastConfig.h"
#endif
-#include "impl/aged_associative_container.cpp"
-
+#include "tests/aged_associative_container.test.cpp"
#include "tests/buffer_view.test.cpp"
-
diff --git a/src/beast/beast/container/buffer_view.h b/src/beast/beast/container/buffer_view.h
index f9e2ddeef0..1336b69e3c 100644
--- a/src/beast/beast/container/buffer_view.h
+++ b/src/beast/beast/container/buffer_view.h
@@ -22,6 +22,7 @@
#include "../Config.h"
+#include
#include "../cxx14/algorithm.h" //
#include
#include
diff --git a/src/beast/beast/container/detail/aged_ordered_container.h b/src/beast/beast/container/detail/aged_ordered_container.h
index dd151b317a..dd77b28e7d 100644
--- a/src/beast/beast/container/detail/aged_ordered_container.h
+++ b/src/beast/beast/container/detail/aged_ordered_container.h
@@ -23,9 +23,6 @@
#include "aged_container_iterator.h"
#include "aged_associative_container.h"
-#include "../../cxx14/algorithm.h"
-#include "../../cxx14/type_traits.h"
-
#include "../aged_container.h"
#include "../../chrono/abstract_clock.h"
@@ -34,10 +31,12 @@
#include
#include
+#include "../../cxx14/algorithm.h" //
#include
#include
#include
#include
+#include "../../cxx14/type_traits.h" //
#include
namespace beast {
diff --git a/src/beast/beast/container/detail/aged_unordered_container.h b/src/beast/beast/container/detail/aged_unordered_container.h
index 2eac2783ad..5a1054fecc 100644
--- a/src/beast/beast/container/detail/aged_unordered_container.h
+++ b/src/beast/beast/container/detail/aged_unordered_container.h
@@ -31,12 +31,12 @@
#include
#include
-#include "../../cxx14/algorithm.h"
-#include "../../cxx14/type_traits.h"
+#include "../../cxx14/algorithm.h" //
#include
#include
#include
#include
+#include "../../cxx14/type_traits.h" //
#include
/*
diff --git a/src/beast/beast/container/impl/aged_associative_container.cpp b/src/beast/beast/container/tests/aged_associative_container.test.cpp
similarity index 86%
rename from src/beast/beast/container/impl/aged_associative_container.cpp
rename to src/beast/beast/container/tests/aged_associative_container.test.cpp
index c1671ba7f0..7c410fcf8a 100644
--- a/src/beast/beast/container/impl/aged_associative_container.cpp
+++ b/src/beast/beast/container/tests/aged_associative_container.test.cpp
@@ -17,8 +17,9 @@
*/
//==============================================================================
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
#include "../../chrono/manual_clock.h"
+#include "../../unit_test/suite.h"
+
#include "../aged_set.h"
#include "../aged_map.h"
#include "../aged_multiset.h"
@@ -28,6 +29,9 @@
#include "../aged_unordered_multiset.h"
#include "../aged_unordered_multimap.h"
+#include
+#include
+
#ifndef BEAST_AGED_UNORDERED_NO_ALLOC_DEFAULTCTOR
# ifdef _MSC_VER
# define BEAST_AGED_UNORDERED_NO_ALLOC_DEFAULTCTOR 0
@@ -46,7 +50,7 @@
namespace beast {
-class aged_associative_container_TestsBase : public UnitTest
+class aged_associative_container_test_base : public unit_test::suite
{
public:
template
@@ -392,56 +396,6 @@ public:
//--------------------------------------------------------------------------
- // Compile time checks
- //
- void checkAliases ()
- {
- typedef std::string Key;
- typedef int T;
-
- static_assert (std::is_same <
- aged_set ,
- detail::aged_ordered_container >::value,
- "bad alias: aged_set");
-
- static_assert (std::is_same <
- aged_multiset ,
- detail::aged_ordered_container >::value,
- "bad alias: aged_multiset");
-
- static_assert (std::is_same <
- aged_map ,
- detail::aged_ordered_container >::value,
- "bad alias: aged_map");
-
- static_assert (std::is_same <
- aged_multimap ,
- detail::aged_ordered_container >::value,
- "bad alias: aged_multimap");
-
- static_assert (std::is_same <
- aged_unordered_set ,
- detail::aged_unordered_container >::value,
- "bad alias: aged_unordered_set");
-
- static_assert (std::is_same <
- aged_unordered_multiset ,
- detail::aged_unordered_container >::value,
- "bad alias: aged_unordered_multiset");
-
- static_assert (std::is_same <
- aged_unordered_map ,
- detail::aged_unordered_container >::value,
- "bad alias: aged_unordered_map");
-
- static_assert (std::is_same <
- aged_unordered_multimap ,
- detail::aged_unordered_container >::value,
- "bad alias: aged_unordered_multimap");
- }
-
- //--------------------------------------------------------------------------
-
template <
class Container,
class Values
@@ -603,11 +557,6 @@ public:
template
void testMaybeUnordered();
-
- aged_associative_container_TestsBase () : UnitTest (
- "aged_associative_container", "beast")
- {
- }
};
//------------------------------------------------------------------------------
@@ -620,7 +569,7 @@ template <
>
typename std::enable_if <
Container::is_map::value && ! Container::is_multi::value>::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkMapContents (Container& c, Values const& v)
{
if (v.empty())
@@ -651,7 +600,7 @@ template <
>
typename std::enable_if <
std::remove_reference ::type::is_unordered::value>::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkUnorderedContentsRefRef (C&& c, Values const& v)
{
typedef typename std::remove_reference ::type Cont;
@@ -685,7 +634,7 @@ checkUnorderedContentsRefRef (C&& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkContentsRefRef (C&& c, Values const& v)
{
typedef typename std::remove_reference ::type Cont;
@@ -715,7 +664,7 @@ checkContentsRefRef (C&& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkContents (Cont& c, Values const& v)
{
checkContentsRefRef (c, v);
@@ -725,7 +674,7 @@ checkContents (Cont& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkContents (Cont& c)
{
typedef TestTraits <
@@ -746,7 +695,7 @@ checkContents (Cont& c)
// ordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testConstructEmpty ()
{
typedef TestTraits Traits;
@@ -760,7 +709,8 @@ testConstructEmpty ()
typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock;
- beginTestCase (Traits::name() + " empty");
+ //testcase (Traits::name() + " empty");
+ testcase ("empty");
{
typename Traits::template Cont c (
@@ -790,7 +740,7 @@ testConstructEmpty ()
// unordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testConstructEmpty ()
{
typedef TestTraits Traits;
@@ -806,8 +756,8 @@ testConstructEmpty ()
typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock;
- beginTestCase (Traits::name() + " empty");
-
+ //testcase (Traits::name() + " empty");
+ testcase ("empty");
{
typename Traits::template Cont c (
clock);
@@ -860,7 +810,7 @@ testConstructEmpty ()
// ordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testConstructRange ()
{
typedef TestTraits Traits;
@@ -875,7 +825,8 @@ testConstructRange ()
typename Traits::Clock clock;
auto const v (Traits::values());
- beginTestCase (Traits::name() + " range");
+ //testcase (Traits::name() + " range");
+ testcase ("range");
{
typename Traits::template Cont c (
@@ -922,7 +873,7 @@ testConstructRange ()
// unordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testConstructRange ()
{
typedef TestTraits Traits;
@@ -939,7 +890,8 @@ testConstructRange ()
typename Traits::Clock clock;
auto const v (Traits::values());
- beginTestCase (Traits::name() + " range");
+ //testcase (Traits::name() + " range");
+ testcase ("range");
{
typename Traits::template Cont c (
@@ -1001,7 +953,7 @@ testConstructRange ()
// ordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testConstructInitList ()
{
typedef TestTraits Traits;
@@ -1015,7 +967,8 @@ testConstructInitList ()
typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock;
- beginTestCase (Traits::name() + " init-list");
+ //testcase (Traits::name() + " init-list");
+ testcase ("init-list");
// VFALCO TODO
@@ -1025,7 +978,7 @@ testConstructInitList ()
// unordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testConstructInitList ()
{
typedef TestTraits Traits;
@@ -1041,7 +994,9 @@ testConstructInitList ()
typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock;
- beginTestCase (Traits::name() + " init-list");
+ //testcase (Traits::name() + " init-list");
+ testcase ("init-list");
+
// VFALCO TODO
pass();
}
@@ -1054,7 +1009,7 @@ testConstructInitList ()
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testCopyMove ()
{
typedef TestTraits Traits;
@@ -1063,7 +1018,8 @@ testCopyMove ()
typename Traits::Clock clock;
auto const v (Traits::values());
- beginTestCase (Traits::name() + " copy/move");
+ //testcase (Traits::name() + " copy/move");
+ testcase ("copy/move");
// copy
@@ -1136,7 +1092,7 @@ testCopyMove ()
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkInsertCopy (Container& c, Values const& v)
{
for (auto const& e : v)
@@ -1146,7 +1102,7 @@ checkInsertCopy (Container& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkInsertMove (Container& c, Values const& v)
{
Values v2 (v);
@@ -1157,7 +1113,7 @@ checkInsertMove (Container& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkInsertHintCopy (Container& c, Values const& v)
{
for (auto const& e : v)
@@ -1167,7 +1123,7 @@ checkInsertHintCopy (Container& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkInsertHintMove (Container& c, Values const& v)
{
Values v2 (v);
@@ -1178,7 +1134,7 @@ checkInsertHintMove (Container& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkEmplace (Container& c, Values const& v)
{
for (auto const& e : v)
@@ -1188,7 +1144,7 @@ checkEmplace (Container& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
checkEmplaceHint (Container& c, Values const& v)
{
for (auto const& e : v)
@@ -1198,7 +1154,7 @@ checkEmplaceHint (Container& c, Values const& v)
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testModifiers()
{
typedef TestTraits Traits;
@@ -1206,7 +1162,8 @@ testModifiers()
auto const v (Traits::values());
auto const l (make_list (v));
- beginTestCase (Traits::name() + " modify");
+ //testcase (Traits::name() + " modify");
+ testcase ("modify");
{
typename Traits::template Cont <> c (clock);
@@ -1257,7 +1214,7 @@ testModifiers()
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testChronological ()
{
typedef TestTraits Traits;
@@ -1265,7 +1222,8 @@ testChronological ()
typename Traits::Clock clock;
auto const v (Traits::values());
- beginTestCase (Traits::name() + " chronological");
+ //testcase (Traits::name() + " chronological");
+ testcase ("chronological");
typename Traits::template Cont <> c (
v.begin(), v.end(), clock);
@@ -1297,14 +1255,15 @@ testChronological ()
// map, unordered_map
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testArrayCreate()
{
typedef TestTraits Traits;
typename Traits::Clock clock;
auto v (Traits::values());
- beginTestCase (Traits::name() + " array create");
+ //testcase (Traits::name() + " array create");
+ testcase ("array create");
{
// Copy construct key
@@ -1332,7 +1291,7 @@ testArrayCreate()
// ordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testCompare ()
{
typedef TestTraits Traits;
@@ -1340,7 +1299,8 @@ testCompare ()
typename Traits::Clock clock;
auto const v (Traits::values());
- beginTestCase (Traits::name() + " array create");
+ //testcase (Traits::name() + " array create");
+ testcase ("array create");
typename Traits::template Cont <> c1 (
v.begin(), v.end(), clock);
@@ -1366,13 +1326,14 @@ testCompare ()
// ordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testObservers()
{
typedef TestTraits Traits;
typename Traits::Clock clock;
- beginTestCase (Traits::name() + " observers");
+ //testcase (Traits::name() + " observers");
+ testcase ("observers");
typename Traits::template Cont <> c (clock);
c.key_comp();
@@ -1384,13 +1345,14 @@ testObservers()
// unordered
template
typename std::enable_if ::type
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testObservers()
{
typedef TestTraits Traits;
typename Traits::Clock clock;
- beginTestCase (Traits::name() + " observers");
+ //testcase (Traits::name() + " observers");
+ testcase ("observers");
typename Traits::template Cont <> c (clock);
c.hash_function();
@@ -1407,7 +1369,7 @@ testObservers()
template
void
-aged_associative_container_TestsBase::
+aged_associative_container_test_base::
testMaybeUnorderedMultiMap ()
{
typedef TestTraits Traits;
@@ -1423,38 +1385,133 @@ testMaybeUnorderedMultiMap ()
testObservers ();
}
-template
-void
-aged_associative_container_TestsBase::
-testMaybeUnorderedMulti()
-{
- testMaybeUnorderedMultiMap ();
- testMaybeUnorderedMultiMap ();
-}
-
-template
-void
-aged_associative_container_TestsBase::
-testMaybeUnordered()
-{
- testMaybeUnorderedMulti ();
- testMaybeUnorderedMulti ();
-}
-
//------------------------------------------------------------------------------
-class aged_associative_container_Tests :
- public aged_associative_container_TestsBase
+class aged_set_test : public aged_associative_container_test_base
{
public:
- void runTest ()
+ // Compile time checks
+
+ typedef std::string Key;
+ typedef int T;
+
+ static_assert (std::is_same <
+ aged_set ,
+ detail::aged_ordered_container >::value,
+ "bad alias: aged_set");
+
+ static_assert (std::is_same <
+ aged_multiset ,
+ detail::aged_ordered_container >::value,
+ "bad alias: aged_multiset");
+
+ static_assert (std::is_same <
+ aged_map ,
+ detail::aged_ordered_container >::value,
+ "bad alias: aged_map");
+
+ static_assert (std::is_same <
+ aged_multimap ,
+ detail::aged_ordered_container >::value,
+ "bad alias: aged_multimap");
+
+ static_assert (std::is_same <
+ aged_unordered_set ,
+ detail::aged_unordered_container >::value,
+ "bad alias: aged_unordered_set");
+
+ static_assert (std::is_same <
+ aged_unordered_multiset ,
+ detail::aged_unordered_container >::value,
+ "bad alias: aged_unordered_multiset");
+
+ static_assert (std::is_same <
+ aged_unordered_map ,
+ detail::aged_unordered_container >::value,
+ "bad alias: aged_unordered_map");
+
+ static_assert (std::is_same <
+ aged_unordered_multimap ,
+ detail::aged_unordered_container >::value,
+ "bad alias: aged_unordered_multimap");
+
+ void run ()
{
- checkAliases ();
- testMaybeUnordered ();
- testMaybeUnordered ();
+ testMaybeUnorderedMultiMap ();
}
};
-static aged_associative_container_Tests aged_associative_container_tests;
+class aged_map_test : public aged_associative_container_test_base
+{
+public:
+ void run ()
+ {
+ testMaybeUnorderedMultiMap ();
+ }
+};
+
+class aged_multiset_test : public aged_associative_container_test_base
+{
+public:
+ void run ()
+ {
+ testMaybeUnorderedMultiMap ();
+ }
+};
+
+class aged_multimap_test : public aged_associative_container_test_base
+{
+public:
+ void run ()
+ {
+ testMaybeUnorderedMultiMap ();
+ }
+};
+
+
+class aged_unordered_set_test : public aged_associative_container_test_base
+{
+public:
+ void run ()
+ {
+ testMaybeUnorderedMultiMap ();
+ }
+};
+
+class aged_unordered_map_test : public aged_associative_container_test_base
+{
+public:
+ void run ()
+ {
+ testMaybeUnorderedMultiMap ();
+ }
+};
+
+class aged_unordered_multiset_test : public aged_associative_container_test_base
+{
+public:
+ void run ()
+ {
+ testMaybeUnorderedMultiMap ();
+ }
+};
+
+class aged_unordered_multimap_test : public aged_associative_container_test_base
+{
+public:
+ void run ()
+ {
+ testMaybeUnorderedMultiMap ();
+ }
+};
+
+BEAST_DEFINE_TESTSUITE(aged_set,container,beast);
+BEAST_DEFINE_TESTSUITE(aged_map,container,beast);
+BEAST_DEFINE_TESTSUITE(aged_multiset,container,beast);
+BEAST_DEFINE_TESTSUITE(aged_multimap,container,beast);
+BEAST_DEFINE_TESTSUITE(aged_unordered_set,container,beast);
+BEAST_DEFINE_TESTSUITE(aged_unordered_map,container,beast);
+BEAST_DEFINE_TESTSUITE(aged_unordered_multiset,container,beast);
+BEAST_DEFINE_TESTSUITE(aged_unordered_multimap,container,beast);
}
diff --git a/src/beast/beast/container/tests/buffer_view.test.cpp b/src/beast/beast/container/tests/buffer_view.test.cpp
index 3bc2172834..743430cb4c 100644
--- a/src/beast/beast/container/tests/buffer_view.test.cpp
+++ b/src/beast/beast/container/tests/buffer_view.test.cpp
@@ -17,14 +17,15 @@
*/
//==============================================================================
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
+#include "../../unit_test/suite.h"
+
#include "../buffer_view.h"
#include "../../cxx14/algorithm.h" //
namespace beast {
-class buffer_view_Tests : public UnitTest
+class buffer_view_test : public unit_test::suite
{
public:
// Returns `true` if the iterator distance matches the size
@@ -153,7 +154,7 @@ public:
// Test empty containers
void testEmpty()
{
- beginTestCase ("empty");
+ testcase ("empty");
buffer_view v1;
checkEmpty (v1);
@@ -239,11 +240,11 @@ public:
void testConstruct()
{
- beginTestCase ("std::vector ");
+ testcase ("std::vector ");
testConstruct (
std::vector ({'h', 'e', 'l', 'l', 'o'}));
- beginTestCase ("std::string ");
+ testcase ("std::string ");
testConstruct (
std::basic_string ("hello"));
}
@@ -252,7 +253,7 @@ public:
void testCoerce()
{
- beginTestCase ("coerce");
+ testcase ("coerce");
std::string const s ("hello");
const_buffer_view v (s);
@@ -264,7 +265,7 @@ public:
void testAssign()
{
- beginTestCase ("testAssign");
+ testcase ("testAssign");
std::vector v1({1, 2, 3});
buffer_view r1(v1);
std::vector v2({4, 5, 6, 7});
@@ -305,19 +306,15 @@ public:
static_assert (std::is_nothrow_move_assignable <
buffer_view >::value, "");
- void runTest()
+ void run()
{
testEmpty();
testConstruct();
testCoerce();
testAssign();
}
-
- buffer_view_Tests() : UnitTest ("buffer_view", "beast")
- {
- }
};
-static buffer_view_Tests buffer_view_tests;
+BEAST_DEFINE_TESTSUITE(buffer_view,container,beast);
}
diff --git a/src/beast/beast/crypto/Crypto.cpp b/src/beast/beast/crypto/Crypto.cpp
index f4c1eb1cbb..327df57d50 100644
--- a/src/beast/beast/crypto/Crypto.cpp
+++ b/src/beast/beast/crypto/Crypto.cpp
@@ -21,9 +21,9 @@
#include "../../BeastConfig.h"
#endif
-#include "../../modules/beast_core/beast_core.h" // for UnitTest
-
-#include "impl/BinaryEncoding.cpp"
#include "impl/MurmurHash.cpp"
#include "impl/Sha256.cpp"
#include "impl/UnsignedInteger.cpp"
+
+#include "tests/BinaryEncoding.test.cpp"
+#include "tests/UnsignedInteger.test.cpp"
diff --git a/src/beast/beast/crypto/UnsignedInteger.h b/src/beast/beast/crypto/UnsignedInteger.h
index b276e12868..a810b60b3a 100644
--- a/src/beast/beast/crypto/UnsignedInteger.h
+++ b/src/beast/beast/crypto/UnsignedInteger.h
@@ -23,6 +23,8 @@
#include "UnsignedIntegerCalc.h"
#include "MurmurHash.h"
+#include "../../modules/beast_core/beast_core.h" // FIX ASAP
+
#include
#include
diff --git a/src/beast/beast/crypto/UnsignedIntegerCalc.h b/src/beast/beast/crypto/UnsignedIntegerCalc.h
index ef1d48120f..2f48049317 100644
--- a/src/beast/beast/crypto/UnsignedIntegerCalc.h
+++ b/src/beast/beast/crypto/UnsignedIntegerCalc.h
@@ -20,6 +20,7 @@
#ifndef BEAST_CRYPTO_UNSIGNEDINTEGERCALC_H_INCLUDED
#define BEAST_CRYPTO_UNSIGNEDINTEGERCALC_H_INCLUDED
+#include
#include
namespace beast {
@@ -155,7 +156,7 @@ public:
*/
UnsignedIntegerCalc& operator= (UnsignedIntegerCalc const& other)
{
- bassert (other.size() <= size());
+ assert (other.size() <= size());
size_type n (size());
UInt* dest (m_values + size());
for (; n-- > other.size();)
@@ -335,7 +336,7 @@ public:
}
*lhs++ = UInt (part);
}
- bassert (carry == 0); // overflow
+ assert (carry == 0); // overflow
return *this;
}
@@ -359,7 +360,7 @@ public:
carry = part >> numBits;
*lhs = UInt (part & maxUInt);
}
- bassert (carry == 0); // overflow
+ assert (carry == 0); // overflow
return *this;
}
diff --git a/src/beast/beast/crypto/impl/UnsignedInteger.cpp b/src/beast/beast/crypto/impl/UnsignedInteger.cpp
index 2cd246257c..a35bb2d5f0 100644
--- a/src/beast/beast/crypto/impl/UnsignedInteger.cpp
+++ b/src/beast/beast/crypto/impl/UnsignedInteger.cpp
@@ -5,8 +5,7 @@
Portions are Copyright (c) 2013 the authors listed at the following URL,
and/or the authors of referenced articles or incorporated external code:
- http://en.literateprograms.org/Arbitrary-precision_integer_arithmetic_(C)?action=history&offset=20100923155004
-
+ http://en.literateprograms.org/Arbitrary-precision_integer_arithmetic_(C)
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
@@ -23,6 +22,8 @@
#include "../UnsignedInteger.h"
+#include "../../unit_test/suite.h"
+
namespace beast {
namespace multiprecsion {
@@ -31,7 +32,7 @@ namespace multiprecsion {
/* Copyright (c) 2013 the authors listed at the following URL, and/or
the authors of referenced articles or incorporated external code:
- http://en.literateprograms.org/Arbitrary-precision_integer_arithmetic_(C)?action=history&offset=20100923155004
+ http://en.literateprograms.org/Arbitrary-precision_integer_arithmetic_(C)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -342,63 +343,4 @@ char* integer_to_string(integer x) {
}
-//------------------------------------------------------------------------------
-
-class UnsignedIntegerTests : public UnitTest
-{
-public:
- UnsignedIntegerTests () : UnitTest ("UnsignedInteger", "beast")
- {
- }
-
- template
- void runTest ()
- {
- typedef UnsignedInteger UInt;
-
- String s;
-
- s << "Bytes=" << String(Bytes);
-
- beginTestCase (s);
-
- UInt zero;
- zero.fill (0);
- expect (zero.isZero (), "should be zero");
- expect (! zero.isNotZero (), "sould not be non-zero");
-
- UInt one (UInt::createFromInteger (1U));
- expect (one == UInt::createFromInteger (1U), "should be equal");
-
- expect (! one.isZero (), "should not be zero");
- expect (one.isNotZero (), "sould be non-zero");
-
- expect (zero < one, "should be less");
- expect (one > zero, "should be greater");
- expect (zero >= zero, "should be less than or equal");
- expect (one <= one, "should be less than or equal");
-
- expect (zero == zero, "should be equal");
- expect (zero != one, "should not be equal");
-
- expect (zero == UInt::createFromInteger (0U), "should be zero");
- expect (one == UInt::createFromInteger (1U), "should be one");
- expect (one != UInt::createFromInteger (2U), "should not be two");
-
- UInt largest = UInt::createFilled (0xff);
-
- expect (largest > zero && largest > one, "should be greater");
- }
-
- void runTest()
- {
- runTest <16> ();
- runTest <33> ();
- }
-
-private:
-};
-
-static UnsignedIntegerTests unsignedIntegerTests;
-
}
diff --git a/src/beast/beast/crypto/impl/BinaryEncoding.cpp b/src/beast/beast/crypto/tests/BinaryEncoding.test.cpp
similarity index 93%
rename from src/beast/beast/crypto/impl/BinaryEncoding.cpp
rename to src/beast/beast/crypto/tests/BinaryEncoding.test.cpp
index dfdca1bcd6..f66185f589 100644
--- a/src/beast/beast/crypto/impl/BinaryEncoding.cpp
+++ b/src/beast/beast/crypto/tests/BinaryEncoding.test.cpp
@@ -20,6 +20,8 @@
#include "../BinaryEncoding.h"
#include "../UnsignedInteger.h"
+#include "../../unit_test/suite.h"
+
#include
#include
@@ -276,19 +278,20 @@ public:
//------------------------------------------------------------------------------
-class BinaryEncodingTests : public UnitTest
+class BinaryEncoding_test : public unit_test::suite
{
public:
// This is a baseline for the other tests
template
void testBase16 ()
{
- beginTestCase ("base16");
+ Random r;
+ testcase ("base16");
for (int i = 0; i < 50; ++i)
{
typedef UnsignedInteger UInt;
UInt v0;
- random().fillBitsRandomly (v0.begin(), UInt::size);
+ r.fillBitsRandomly (v0.begin(), UInt::size);
std::string const good (HexEncoding::encode (v0));
UInt v1;
@@ -299,8 +302,8 @@ public:
Base16Conversion c;
std::string const check (BinaryEncoding::encode (v0, c));
- if (! expect (good == check))
- logMessage (String ("expected ") + good + " but got " + check);
+ expect (good == check,
+ std::string ("expected ") + good + " but got " + check);
}
}
}
@@ -313,7 +316,8 @@ public:
typedef UnsignedInteger UInt;
UInt v1 (vin.c_str());
std::string const s1 (BinaryEncoding::encode (v1, c));
- logMessage (vout + " to " + s1);
+ log <<
+ vout + " to " + s1;
expect (vout == s1);
UInt v2;
@@ -321,14 +325,14 @@ public:
if (expect (success))
{
std::string const s2 (BinaryEncoding::encode (v2, c));
- logMessage (vin + " to " + s2);
- //expect (vin == v2);
+ log <<
+ vin + " to " + s2;
}
}
void testBase64 ()
{
- beginTestCase ("Base64");
+ testcase ("Base64");
// input (uint)
std::string const vin [] = {
@@ -354,12 +358,16 @@ public:
{
typedef UnsignedInteger UInt;
- beginTestCase (String (c.name()) + " <" + String::fromNumber (Bytes) + ">");
+ std::stringstream ss;
+ ss <<
+ c.name() << " <" << Bytes << ">";
+ testcase (ss.str());
+ Random r;
for (int i = 0; i < 50; ++i)
{
UInt v1;
- random().fillBitsRandomly (v1.begin(), UInt::size);
+ r.fillBitsRandomly (v1.begin(), UInt::size);
std::string const s1 (BinaryEncoding::encode (v1, c));
UInt v2;
@@ -369,7 +377,7 @@ public:
}
}
- void runTest ()
+ void run ()
{
testBase16 <10> ();
@@ -394,12 +402,8 @@ public:
testEncode ();
#endif
}
-
- BinaryEncodingTests () : UnitTest ("BinaryEncoding", "beast", runManual)
- {
- }
};
-static BinaryEncodingTests BinaryEncodingTests;
+BEAST_DEFINE_TESTSUITE_MANUAL(BinaryEncoding,crypto,beast);
}
diff --git a/src/beast/beast/crypto/tests/UnsignedInteger.test.cpp b/src/beast/beast/crypto/tests/UnsignedInteger.test.cpp
new file mode 100644
index 0000000000..2263e61e94
--- /dev/null
+++ b/src/beast/beast/crypto/tests/UnsignedInteger.test.cpp
@@ -0,0 +1,81 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Portions are Copyright (c) 2013 the authors listed at the following URL,
+ and/or the authors of referenced articles or incorporated external code:
+ http://en.literateprograms.org/Arbitrary-precision_integer_arithmetic_(C)
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include "../UnsignedInteger.h"
+
+#include "../../unit_test/suite.h"
+
+namespace beast {
+
+class UnsignedInteger_test : public unit_test::suite
+{
+public:
+ template
+ void test ()
+ {
+ typedef UnsignedInteger UInt;
+
+ std::stringstream ss;
+ ss <<
+ "bytes=" << Bytes;
+ testcase (ss.str());
+
+ UInt zero;
+ zero.fill (0);
+ expect (zero.isZero (), "should be zero");
+ expect (! zero.isNotZero (), "sould not be non-zero");
+
+ UInt one (UInt::createFromInteger (1U));
+ expect (one == UInt::createFromInteger (1U), "should be equal");
+
+ expect (! one.isZero (), "should not be zero");
+ expect (one.isNotZero (), "sould be non-zero");
+
+ expect (zero < one, "should be less");
+ expect (one > zero, "should be greater");
+ expect (zero >= zero, "should be less than or equal");
+ expect (one <= one, "should be less than or equal");
+
+ expect (zero == zero, "should be equal");
+ expect (zero != one, "should not be equal");
+
+ expect (zero == UInt::createFromInteger (0U), "should be zero");
+ expect (one == UInt::createFromInteger (1U), "should be one");
+ expect (one != UInt::createFromInteger (2U), "should not be two");
+
+ UInt largest = UInt::createFilled (0xff);
+
+ expect (largest > zero && largest > one, "should be greater");
+ }
+
+ void run()
+ {
+ test <16> ();
+ test <33> ();
+ }
+
+private:
+};
+
+BEAST_DEFINE_TESTSUITE(UnsignedInteger,crypto,beast);
+
+}
diff --git a/src/beast/beast/cxx14/tests/integer_sequence.test.cpp b/src/beast/beast/cxx14/tests/integer_sequence.test.cpp
index 5846cfe6a7..f7360baa28 100644
--- a/src/beast/beast/cxx14/tests/integer_sequence.test.cpp
+++ b/src/beast/beast/cxx14/tests/integer_sequence.test.cpp
@@ -23,12 +23,12 @@
#include "../utility.h"
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
+#include "../../unit_test/suite.h"
namespace beast {
namespace asio {
-class integer_sequence_Tests : public UnitTest
+class integer_sequence_test : public unit_test::suite
{
public:
template
@@ -41,10 +41,8 @@ public:
return std::make_tuple (std::get (t)...);
}
- void runTest()
+ void run()
{
- beginTestCase ("call");
-
// Code from
// http://llvm.org/svn/llvm-project/libcxx/trunk/test/utilities/intseq/intseq.general/integer_seq.pass.cpp
@@ -103,13 +101,9 @@ public:
expect ( tsizemix == std::make_tuple ( 11, 11, 12, 13, 15 ));
pass();
}
-
- integer_sequence_Tests() : UnitTest ("integer_sequence", "beast")
- {
- }
};
-static integer_sequence_Tests integer_sequence_tests;
+BEAST_DEFINE_TESTSUITE(integer_sequence,cxx14,beast);
}
}
diff --git a/src/beast/beast/http/HTTP.cpp b/src/beast/beast/http/HTTP.cpp
index 25a2286475..c8c010e94c 100644
--- a/src/beast/beast/http/HTTP.cpp
+++ b/src/beast/beast/http/HTTP.cpp
@@ -25,3 +25,5 @@
#include "impl/ParsedURL.cpp"
#include "impl/joyent_parser.cpp"
#include "impl/raw_parser.cpp"
+
+#include "tests/ParsedURL.test.cpp"
diff --git a/src/beast/beast/http/impl/ParsedURL.cpp b/src/beast/beast/http/impl/ParsedURL.cpp
index d1b97dd1e6..f889f39830 100644
--- a/src/beast/beast/http/impl/ParsedURL.cpp
+++ b/src/beast/beast/http/impl/ParsedURL.cpp
@@ -18,11 +18,12 @@
//==============================================================================
#include "../ParsedURL.h"
-
-#include "../../../modules/beast_core/beast_core.h" // for UnitTest
+#include "../../strings/String.h"
#include "joyent_parser.h"
+#include
+
namespace beast {
ParsedURL::ParsedURL ()
@@ -146,35 +147,4 @@ URL ParsedURL::url () const
return m_url;
}
-//------------------------------------------------------------------------------
-
-class ParsedURLTests : public UnitTest
-{
-public:
- void checkURL (String const& url)
- {
- ParsedURL result (url);
- expect (result.error () == 0);
- expect (result.url ().toString () == url);
- }
-
- void testURL ()
- {
- beginTestCase ("parse URL");
-
- checkURL ("http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference.html");
- }
-
- void runTest ()
- {
- testURL ();
- }
-
- ParsedURLTests () : UnitTest ("ParsedURL", "beast", runManual)
- {
- }
-};
-
-static ParsedURLTests parsedURLTests;
-
}
diff --git a/src/beast/beast/http/tests/ParsedURL.test.cpp b/src/beast/beast/http/tests/ParsedURL.test.cpp
new file mode 100644
index 0000000000..ca236210de
--- /dev/null
+++ b/src/beast/beast/http/tests/ParsedURL.test.cpp
@@ -0,0 +1,51 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include "../ParsedURL.h"
+
+#include "../../unit_test/suite.h"
+
+#include "../impl/joyent_parser.h"
+
+namespace beast {
+
+class ParsedURL_test : public unit_test::suite
+{
+public:
+ void checkURL (String const& url)
+ {
+ ParsedURL result (url);
+ expect (result.error () == 0);
+ expect (result.url ().toString () == url);
+ }
+
+ void testURL ()
+ {
+ checkURL ("http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference.html");
+ }
+
+ void run ()
+ {
+ testURL ();
+ }
+};
+
+BEAST_DEFINE_TESTSUITE(ParsedURL,http,beast);
+
+}
diff --git a/src/beast/beast/insight/BaseImpl.h b/src/beast/beast/insight/BaseImpl.h
index 86953efe0d..6c3d7821d3 100644
--- a/src/beast/beast/insight/BaseImpl.h
+++ b/src/beast/beast/insight/BaseImpl.h
@@ -20,6 +20,9 @@
#ifndef BEAST_INSIGHT_BASEIMPL_H_INCLUDED
#define BEAST_INSIGHT_BASEIMPL_H_INCLUDED
+#include
+#include
+#include
#include
namespace beast {
diff --git a/src/beast/beast/insight/Collector.h b/src/beast/beast/insight/Collector.h
index 74bb8998a9..6325ad37b5 100644
--- a/src/beast/beast/insight/Collector.h
+++ b/src/beast/beast/insight/Collector.h
@@ -20,14 +20,14 @@
#ifndef BEAST_INSIGHT_COLLECTOR_H_INCLUDED
#define BEAST_INSIGHT_COLLECTOR_H_INCLUDED
-#include
-
#include "Counter.h"
#include "Event.h"
#include "Gauge.h"
#include "Hook.h"
#include "Meter.h"
+#include
+
namespace beast {
namespace insight {
diff --git a/src/beast/beast/insight/Counter.h b/src/beast/beast/insight/Counter.h
index 9f27128b66..2da422261f 100644
--- a/src/beast/beast/insight/Counter.h
+++ b/src/beast/beast/insight/Counter.h
@@ -20,11 +20,11 @@
#ifndef BEAST_INSIGHT_COUNTER_H_INCLUDED
#define BEAST_INSIGHT_COUNTER_H_INCLUDED
-#include
-
#include "Base.h"
#include "CounterImpl.h"
+#include
+
namespace beast {
namespace insight {
@@ -60,32 +60,58 @@ public:
/** Increment the counter. */
/** @{ */
- void increment (value_type amount) const
+ void
+ increment (value_type amount) const
{
if (m_impl)
m_impl->increment (amount);
}
- Counter const& operator+= (value_type amount) const
- { increment (amount); return *this; }
+ Counter const&
+ operator+= (value_type amount) const
+ {
+ increment (amount);
+ return *this;
+ }
- Counter const& operator-= (value_type amount) const
- { increment (-amount); return *this; }
+ Counter const&
+ operator-= (value_type amount) const
+ {
+ increment (-amount);
+ return *this;
+ }
- Counter const& operator++ () const
- { increment (1); return *this; }
+ Counter const&
+ operator++ () const
+ {
+ increment (1);
+ return *this;
+ }
- Counter const& operator++ (int) const
- { increment (1); return *this; }
+ Counter const&
+ operator++ (int) const
+ {
+ increment (1);
+ return *this;
+ }
- Counter const& operator-- () const
- { increment (-1); return *this; }
+ Counter const&
+ operator-- () const
+ {
+ increment (-1);
+ return *this;
+ }
- Counter const& operator-- (int) const
- { increment (-1); return *this; }
+ Counter const&
+ operator-- (int) const
+ {
+ increment (-1);
+ return *this;
+ }
/** @} */
- std::shared_ptr const& impl () const
+ std::shared_ptr const&
+ impl () const
{
return m_impl;
}
diff --git a/src/beast/beast/insight/CounterImpl.h b/src/beast/beast/insight/CounterImpl.h
index c1a0254be3..61f150509d 100644
--- a/src/beast/beast/insight/CounterImpl.h
+++ b/src/beast/beast/insight/CounterImpl.h
@@ -20,8 +20,6 @@
#ifndef BEAST_INSIGHT_COUNTERIMPL_H_INCLUDED
#define BEAST_INSIGHT_COUNTERIMPL_H_INCLUDED
-#include
-
#include "BaseImpl.h"
namespace beast {
@@ -34,7 +32,7 @@ class CounterImpl
, public BaseImpl
{
public:
- typedef int64 value_type;
+ typedef std::int64_t value_type;
virtual ~CounterImpl () = 0;
virtual void increment (value_type amount) = 0;
diff --git a/src/beast/beast/insight/Event.h b/src/beast/beast/insight/Event.h
index 0bcf6df590..52189a505b 100644
--- a/src/beast/beast/insight/Event.h
+++ b/src/beast/beast/insight/Event.h
@@ -20,14 +20,14 @@
#ifndef BEAST_INSIGHT_EVENT_H_INCLUDED
#define BEAST_INSIGHT_EVENT_H_INCLUDED
-#include
-#include
-
#include "Base.h"
#include "EventImpl.h"
#include "../chrono/chrono_util.h"
+#include
+#include
+
namespace beast {
namespace insight {
@@ -62,7 +62,8 @@ public:
/** Push an event notification. */
template
- void notify (std::chrono::duration const& value) const
+ void
+ notify (std::chrono::duration const& value) const
{
if (m_impl)
m_impl->notify (ceil (value));
diff --git a/src/beast/beast/insight/EventImpl.h b/src/beast/beast/insight/EventImpl.h
index d2d684e555..4113d59daf 100644
--- a/src/beast/beast/insight/EventImpl.h
+++ b/src/beast/beast/insight/EventImpl.h
@@ -20,8 +20,6 @@
#ifndef BEAST_INSIGHT_EVENTIMPL_H_INCLUDED
#define BEAST_INSIGHT_EVENTIMPL_H_INCLUDED
-#include
-
#include "BaseImpl.h"
namespace beast {
diff --git a/src/beast/beast/insight/Gauge.h b/src/beast/beast/insight/Gauge.h
index 22875214f9..d02a68d345 100644
--- a/src/beast/beast/insight/Gauge.h
+++ b/src/beast/beast/insight/Gauge.h
@@ -20,11 +20,11 @@
#ifndef BEAST_INSIGHT_GAUGE_H_INCLUDED
#define BEAST_INSIGHT_GAUGE_H_INCLUDED
-#include
-
#include "Base.h"
#include "GaugeImpl.h"
+#include
+
namespace beast {
namespace insight {
@@ -40,7 +40,7 @@ namespace insight {
class Gauge : public Base
{
public:
- typedef GaugeImpl::value_type value_type;
+ typedef GaugeImpl::value_type value_type;
typedef GaugeImpl::difference_type difference_type;
/** Create a null metric.
@@ -84,26 +84,51 @@ public:
m_impl->increment (amount);
}
- Gauge const& operator+= (difference_type amount) const
- { increment (amount); return *this; }
+ Gauge const&
+ operator+= (difference_type amount) const
+ {
+ increment (amount);
+ return *this;
+ }
- Gauge const& operator-= (difference_type amount) const
- { increment (-amount); return *this; }
+ Gauge const&
+ operator-= (difference_type amount) const
+ {
+ increment (-amount);
+ return *this;
+ }
- Gauge const& operator++ () const
- { increment (1); return *this; }
+ Gauge const&
+ operator++ () const
+ {
+ increment (1);
+ return *this;
+ }
- Gauge const& operator++ (int) const
- { increment (1); return *this; }
+ Gauge const&
+ operator++ (int) const
+ {
+ increment (1);
+ return *this;
+ }
- Gauge const& operator-- () const
- { increment (-1); return *this; }
+ Gauge const&
+ operator-- () const
+ {
+ increment (-1);
+ return *this;
+ }
- Gauge const& operator-- (int) const
- { increment (-1); return *this; }
+ Gauge const&
+ operator-- (int) const
+ {
+ increment (-1);
+ return *this;
+ }
/** @} */
- std::shared_ptr const& impl () const
+ std::shared_ptr const&
+ impl () const
{
return m_impl;
}
diff --git a/src/beast/beast/insight/GaugeImpl.h b/src/beast/beast/insight/GaugeImpl.h
index 1f5794e958..081c534b3b 100644
--- a/src/beast/beast/insight/GaugeImpl.h
+++ b/src/beast/beast/insight/GaugeImpl.h
@@ -20,8 +20,6 @@
#ifndef BEAST_INSIGHT_GAUGEIMPL_H_INCLUDED
#define BEAST_INSIGHT_GAUGEIMPL_H_INCLUDED
-#include
-
#include "BaseImpl.h"
namespace beast {
@@ -34,8 +32,8 @@ class GaugeImpl
, public BaseImpl
{
public:
- typedef uint64 value_type;
- typedef int64 difference_type;
+ typedef std::uint64_t value_type;
+ typedef std::int64_t difference_type;
virtual ~GaugeImpl () = 0;
virtual void set (value_type value) = 0;
diff --git a/src/beast/beast/insight/Group.h b/src/beast/beast/insight/Group.h
index 273472914e..f47c72a226 100644
--- a/src/beast/beast/insight/Group.h
+++ b/src/beast/beast/insight/Group.h
@@ -20,10 +20,11 @@
#ifndef BEAST_INSIGHT_GROUP_H_INCLUDED
#define BEAST_INSIGHT_GROUP_H_INCLUDED
-#include
-
#include "Collector.h"
+#include
+#include
+
namespace beast {
namespace insight {
diff --git a/src/beast/beast/insight/Groups.h b/src/beast/beast/insight/Groups.h
index 6138938205..be4f297606 100644
--- a/src/beast/beast/insight/Groups.h
+++ b/src/beast/beast/insight/Groups.h
@@ -20,12 +20,12 @@
#ifndef BEAST_INSIGHT_GROUPS_H_INCLUDED
#define BEAST_INSIGHT_GROUPS_H_INCLUDED
-#include
-#include
-
#include "Collector.h"
#include "Group.h"
+#include
+#include
+
namespace beast {
namespace insight {
@@ -37,9 +37,12 @@ public:
/** Find or create a new collector with a given name. */
/** @{ */
- virtual Group::ptr const& get (std::string const& name) = 0;
+ virtual
+ Group::ptr const&
+ get (std::string const& name) = 0;
- Group::ptr const& operator[] (std::string const& name)
+ Group::ptr const&
+ operator[] (std::string const& name)
{
return get (name);
}
diff --git a/src/beast/beast/insight/Hook.h b/src/beast/beast/insight/Hook.h
index 783477a4e7..696fe6815a 100644
--- a/src/beast/beast/insight/Hook.h
+++ b/src/beast/beast/insight/Hook.h
@@ -20,11 +20,11 @@
#ifndef BEAST_INSIGHT_HOOK_H_INCLUDED
#define BEAST_INSIGHT_HOOK_H_INCLUDED
-#include
-
#include "Base.h"
#include "HookImpl.h"
+#include
+
namespace beast {
namespace insight {
diff --git a/src/beast/beast/insight/HookImpl.h b/src/beast/beast/insight/HookImpl.h
index 84b2b3e7f2..78ecb0e4ea 100644
--- a/src/beast/beast/insight/HookImpl.h
+++ b/src/beast/beast/insight/HookImpl.h
@@ -20,9 +20,6 @@
#ifndef BEAST_INSIGHT_HOOKIMPL_H_INCLUDED
#define BEAST_INSIGHT_HOOKIMPL_H_INCLUDED
-#include
-#include
-
#include "BaseImpl.h"
namespace beast {
diff --git a/src/beast/beast/insight/Insight.cpp b/src/beast/beast/insight/Insight.cpp
index 209364788a..5ab9a4df6b 100644
--- a/src/beast/beast/insight/Insight.cpp
+++ b/src/beast/beast/insight/Insight.cpp
@@ -23,8 +23,6 @@
#include "../Config.h"
-#include "../../modules/beast_core/beast_core.h" // for UnitTest
-
#include "../Insight.h"
#include "impl/Collector.cpp"
diff --git a/src/beast/beast/insight/MeterImpl.h b/src/beast/beast/insight/MeterImpl.h
index 21dae58a0c..301f86e638 100644
--- a/src/beast/beast/insight/MeterImpl.h
+++ b/src/beast/beast/insight/MeterImpl.h
@@ -20,8 +20,6 @@
#ifndef BEAST_INSIGHT_METERIMPL_H_INCLUDED
#define BEAST_INSIGHT_METERIMPL_H_INCLUDED
-#include
-
#include "BaseImpl.h"
namespace beast {
@@ -34,7 +32,7 @@ class MeterImpl
, public BaseImpl
{
public:
- typedef uint64 value_type;
+ typedef std::uint64_t value_type;
virtual ~MeterImpl () = 0;
virtual void increment (value_type amount) = 0;
diff --git a/src/beast/beast/insight/StatsDCollector.h b/src/beast/beast/insight/StatsDCollector.h
index b5efbbc813..ea5bf61ee5 100644
--- a/src/beast/beast/insight/StatsDCollector.h
+++ b/src/beast/beast/insight/StatsDCollector.h
@@ -22,6 +22,7 @@
#include "Collector.h"
+#include "../utility/Journal.h"
#include "../net/IPEndpoint.h"
namespace beast {
@@ -39,7 +40,9 @@ public:
@param prefix A string pre-pended before each metric name.
@param journal Destination for logging output.
*/
- static std::shared_ptr New (IP::Endpoint const& address,
+ static
+ std::shared_ptr
+ New (IP::Endpoint const& address,
std::string const& prefix, Journal journal);
};
diff --git a/src/beast/beast/insight/impl/StatsDCollector.cpp b/src/beast/beast/insight/impl/StatsDCollector.cpp
index 85271097c4..cc54769337 100644
--- a/src/beast/beast/insight/impl/StatsDCollector.cpp
+++ b/src/beast/beast/insight/impl/StatsDCollector.cpp
@@ -18,19 +18,21 @@
//==============================================================================
#include "../../asio/IPAddressConversion.h"
+#include "../../intrusive/List.h"
#include "../../threads/SharedData.h"
-#include
-#include
-#include
-#include
-#include
-
-#include
+#include
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
+#include
+
#ifndef BEAST_STATSDCOLLECTOR_TRACING_ENABLED
#define BEAST_STATSDCOLLECTOR_TRACING_ENABLED 0
#endif
@@ -364,7 +366,7 @@ public:
{
std::string const& buffer (*iter);
std::size_t const length (buffer.size ());
- check_precondition (! buffer.empty ());
+ assert (! buffer.empty ());
if (! buffers.empty () && (size + length) > max_packet_size)
{
#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED
diff --git a/src/beast/beast/net/Net.cpp b/src/beast/beast/net/Net.cpp
index 6180dfa1ab..d65e14aa68 100644
--- a/src/beast/beast/net/Net.cpp
+++ b/src/beast/beast/net/Net.cpp
@@ -17,18 +17,11 @@
*/
//==============================================================================
-#if BEAST_INCLUDE_BEASTCONFIG
-#include "../../BeastConfig.h"
-#endif
-
#include "../Config.h"
-#include "../../modules/beast_core/beast_core.h" // for UnitTest
-
#include "impl/DynamicBuffer.cpp"
-#include "impl/IPAddress.cpp"
#include "impl/IPAddressV4.cpp"
#include "impl/IPAddressV6.cpp"
#include "impl/IPEndpoint.cpp"
-
+#include "tests/IPEndpoint.test.cpp"
diff --git a/src/beast/beast/net/impl/DynamicBuffer.cpp b/src/beast/beast/net/impl/DynamicBuffer.cpp
index 4dec2d5dfb..459c2231d3 100644
--- a/src/beast/beast/net/impl/DynamicBuffer.cpp
+++ b/src/beast/beast/net/impl/DynamicBuffer.cpp
@@ -17,10 +17,15 @@
*/
//==============================================================================
-#include
+#if BEAST_INCLUDE_BEASTCONFIG
+#include "../../BeastConfig.h"
+#endif
#include "../DynamicBuffer.h"
+#include
+#include
+
namespace beast {
DynamicBuffer::DynamicBuffer (size_type blocksize)
diff --git a/src/beast/beast/net/impl/IPAddressV4.cpp b/src/beast/beast/net/impl/IPAddressV4.cpp
index a74daacffb..37af00ef2e 100644
--- a/src/beast/beast/net/impl/IPAddressV4.cpp
+++ b/src/beast/beast/net/impl/IPAddressV4.cpp
@@ -17,7 +17,14 @@
*/
//==============================================================================
+#if BEAST_INCLUDE_BEASTCONFIG
+#include "../../BeastConfig.h"
+#endif
+
#include "../IPAddressV4.h"
+#include "../detail/Parse.h"
+
+#include
namespace beast {
namespace IP {
diff --git a/src/beast/beast/net/impl/IPAddressV6.cpp b/src/beast/beast/net/impl/IPAddressV6.cpp
index 4c9baa31d4..3086228281 100644
--- a/src/beast/beast/net/impl/IPAddressV6.cpp
+++ b/src/beast/beast/net/impl/IPAddressV6.cpp
@@ -17,6 +17,10 @@
*/
//==============================================================================
+#if BEAST_INCLUDE_BEASTCONFIG
+#include "../../BeastConfig.h"
+#endif
+
#include "../IPAddressV6.h"
namespace beast {
diff --git a/src/beast/beast/net/impl/IPEndpoint.cpp b/src/beast/beast/net/impl/IPEndpoint.cpp
index 0f6f232534..f401c3159d 100644
--- a/src/beast/beast/net/impl/IPEndpoint.cpp
+++ b/src/beast/beast/net/impl/IPEndpoint.cpp
@@ -17,6 +17,11 @@
*/
//==============================================================================
+#if BEAST_INCLUDE_BEASTCONFIG
+#include "../../BeastConfig.h"
+#endif
+
+#include "../IPEndpoint.h"
#include "../detail/Parse.h"
namespace beast {
diff --git a/src/beast/beast/net/impl/IPAddress.cpp b/src/beast/beast/net/tests/IPEndpoint.test.cpp
similarity index 94%
rename from src/beast/beast/net/impl/IPAddress.cpp
rename to src/beast/beast/net/tests/IPEndpoint.test.cpp
index 61c3b707a8..ccbee18cce 100644
--- a/src/beast/beast/net/impl/IPAddress.cpp
+++ b/src/beast/beast/net/tests/IPEndpoint.test.cpp
@@ -17,17 +17,23 @@
*/
//==============================================================================
-#include
+#if BEAST_INCLUDE_BEASTCONFIG
+#include "../../BeastConfig.h"
+#endif
#include "../IPEndpoint.h"
#include "../detail/Parse.h"
+#include "../../unit_test/suite.h"
+
+#include
+
namespace beast {
namespace IP {
//------------------------------------------------------------------------------
-class IPAddressTests : public UnitTest
+class IPEndpoint_test : public unit_test::suite
{
public:
void shouldParseV4 (std::string const& s, uint32 value)
@@ -51,7 +57,7 @@ public:
void testAddressV4 ()
{
- beginTestCase ("AddressV4");
+ testcase ("AddressV4");
expect (AddressV4().value == 0);
expect (is_unspecified (AddressV4()));
@@ -100,7 +106,7 @@ public:
void testAddressV4Proxy ()
{
- beginTestCase ("AddressV4::Proxy");
+ testcase ("AddressV4::Proxy");
AddressV4 v4 (10, 0, 0, 1);
expect (v4[0]==10);
@@ -122,7 +128,7 @@ public:
void testAddress ()
{
- beginTestCase ("Address");
+ testcase ("Address");
std::pair result (
Address::from_string ("1.2.3.4"));
@@ -135,7 +141,7 @@ public:
void testEndpoint ()
{
- beginTestCase ("Endpoint");
+ testcase ("Endpoint");
{
std::pair result (
@@ -220,7 +226,7 @@ public:
template
void testParse (char const* name)
{
- beginTestCase (name);
+ testcase (name);
shouldPass ("0.0.0.0");
shouldPass ("192.168.0.1");
@@ -235,7 +241,7 @@ public:
shouldFail ("1.2.3:80");
}
- void runTest ()
+ void run ()
{
testAddressV4 ();
testAddressV4Proxy();
@@ -244,13 +250,9 @@ public:
testParse ("Parse Endpoint");
}
-
- IPAddressTests () : UnitTest ("IP::Endpoint", "beast")
- {
- }
};
-static IPAddressTests ipEndpointTests;
+BEAST_DEFINE_TESTSUITE(IPEndpoint,net,beast);
}
}
diff --git a/src/beast/beast/streams/basic_scoped_ostream.h b/src/beast/beast/streams/basic_scoped_ostream.h
index 71f97bb307..d1a001ada5 100644
--- a/src/beast/beast/streams/basic_scoped_ostream.h
+++ b/src/beast/beast/streams/basic_scoped_ostream.h
@@ -21,6 +21,7 @@
#define BEAST_STREAMS_BASIC_SCOPED_OSTREAM_H_INCLUDED
#include "../cxx14/memory.h" //
+
#include
#include