20 #ifndef RIPPLE_BASICS_TESTSUITE_H_INCLUDED
21 #define RIPPLE_BASICS_TESTSUITE_H_INCLUDED
23 #include <ripple/beast/unit_test.h>
31 template <
class S,
class T>
34 if (actual != expected)
38 ss << message <<
"\n";
39 ss <<
"Actual: " << actual <<
"\n"
40 <<
"Expected: " << expected;
49 template <
class S,
class T>
52 if (actual == expected)
56 ss << message <<
"\n";
57 ss <<
"Actual: " << actual <<
"\n"
58 <<
"Expected anything but: " << expected;
67 template <
class Collection>
69 Collection
const& actual, Collection
const& expected,
73 bool success =
expectEquals (actual.size(), expected.size(),
74 msg +
"Sizes are different");
78 auto i = begin (actual);
79 auto j = begin (expected);
82 for (; i != end (actual) && j != end (expected); ++i, ++j, ++k)
92 template <
class Exception,
class Functor>
99 }
catch (Exception
const&)
103 return expect (success,
addPrefix (message) +
"no exception thrown");
106 template <
class Functor>
109 bool success =
false;
118 return expect (success,
addPrefix (message) +
"no exception thrown");
bool expectException(Functor f, std::string const &message="")
bool expectEquals(S actual, T expected, std::string const &message="")
static std::string addPrefix(std::string const &message)
bool expectCollectionEquals(Collection const &actual, Collection const &expected, std::string const &message="")
bool expectNotEquals(S actual, T expected, std::string const &message="")
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool expectException(Functor f, std::string const &message="")