1#include <xrpl/beast/unit_test.h>
2#include <xrpl/protocol/TER.h>
14 for (
auto i = -400; i < 400; ++i)
22 BEAST_EXPECT(inRange || !good);
23 BEAST_EXPECT(
transToken(t) == (good ? token :
"-"));
24 BEAST_EXPECT(
transHuman(t) == (good ? text :
"-"));
27 BEAST_EXPECT(good == !!code);
28 BEAST_EXPECT(!code || *code == t);
39 template <std::
size_t I1, std::
size_t I2>
43 template <
typename Tup>
65 template <std::
size_t I1, std::
size_t I2,
template <std::
size_t, std::
size_t>
class Func,
typename Tup>
75 template <std::
size_t I1, std::
size_t I2,
template <std::
size_t, std::
size_t>
class Func,
typename Tup>
81 testIterate<std::tuple_size<Tup>::value - 1, I2 - 1, Func>(tup, s);
85 template <std::
size_t I1, std::
size_t I2,
template <std::
size_t, std::
size_t>
class Func,
typename Tup>
100 static auto const terEnums =
102 static int const hiIndex{
std::tuple_size<
decltype(terEnums)>::value - 1};
105 testIterate<hiIndex, hiIndex, NotConvertible>(terEnums, *
this);
108 auto isConvertible = [](
auto from,
auto to) {
123 isConvertible(notTec, notTec);
126 auto notConvertible = [](
auto from,
auto to) {
137 notConvertible(ter, notTec);
138 notConvertible(4, notTec);
147 isConvertible(notTec, ter);
148 isConvertible(ter, ter);
151 notConvertible(4, ter);
161 template <std::
size_t I1, std::
size_t I2>
165 template <
typename Tup>
215 testIterate<hiIndex, hiIndex, CheckComparable>(ters, *
this);
bool expect(Condition const &shouldBeTrue)
Evaluate a test condition.
static constexpr TERSubset fromInt(int from)
void operator()(Tup const &tup, beast::unit_test::suite &s) const
void operator()(Tup const &tup, beast::unit_test::suite &) const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool operator<(Slice const &lhs, Slice const &rhs) noexcept
bool isTerRetry(TER x) noexcept
bool operator>=(STAmount const &lhs, STAmount const &rhs)
std::string transHuman(TER code)
bool transResultInfo(TER code, std::string &token, std::string &text)
std::string transToken(TER code)
constexpr bool operator==(base_uint< Bits, Tag > const &lhs, base_uint< Bits, Tag > const &rhs)
bool isTefFailure(TER x) noexcept
bool operator!=(Buffer const &lhs, Buffer const &rhs) noexcept
bool operator<=(STAmount const &lhs, STAmount const &rhs)
bool isTelLocal(TER x) noexcept
constexpr TERUnderlyingType TERtoInt(TELcodes v)
bool isTesSuccess(TER x) noexcept
std::optional< TER > transCode(std::string const &token)
bool isTecClaim(TER x) noexcept
bool isTemMalformed(TER x) noexcept
void testTransResultInfo()
void run() override
Runs the suite.
std::enable_if_t< I1 !=0 > testIterate(Tup const &tup, beast::unit_test::suite &s)
std::enable_if_t< I1==0 &&I2 !=0 > testIterate(Tup const &tup, beast::unit_test::suite &s)
std::enable_if_t< I1==0 &&I2==0 > testIterate(Tup const &tup, beast::unit_test::suite &s)