20 #include <ripple/beast/unit_test.h>
21 #include <ripple/protocol/TER.h>
28 struct TER_test :
public beast::unit_test::suite
33 for (
auto i = -400; i < 400; ++i)
42 BEAST_EXPECT(inRange || !good);
43 BEAST_EXPECT(
transToken(t) == (good ? token :
"-"));
44 BEAST_EXPECT(
transHuman(t) == (good ? text :
"-"));
47 BEAST_EXPECT(good == !!code);
48 BEAST_EXPECT(!code || *code == t);
59 template <std::
size_t I1, std::
size_t I2>
63 template <
typename Tup>
65 operator()(Tup
const& tup, beast::unit_test::suite&)
const
98 template <std::
size_t, std::
size_t>
113 template <std::
size_t, std::
size_t>
121 testIterate<std::tuple_size<Tup>::value - 1, I2 - 1, Func>(tup, s);
128 template <std::
size_t, std::
size_t>
152 static const int hiIndex{
153 std::tuple_size<decltype(terEnums)>::value - 1};
156 testIterate<hiIndex, hiIndex, NotConvertible>(terEnums, *
this);
159 auto isConvertable = [](
auto from,
auto to) {
177 isConvertable(notTec, notTec);
180 auto notConvertible = [](
auto from,
auto to) {
194 notConvertible(ter, notTec);
195 notConvertible(4, notTec);
204 isConvertable(notTec, ter);
205 isConvertable(ter, ter);
208 notConvertible(4, ter);
218 template <std::
size_t I1, std::
size_t I2>
222 template <
typename Tup>
227 auto const lhs = std::get<I1>(tup);
228 auto const rhs = std::get<I2>(tup);
231 std::is_same<decltype(
operator==(lhs, rhs)),
bool>::value,
235 std::is_same<decltype(
operator!=(lhs, rhs)),
bool>::value,
239 std::is_same<decltype(
operator<(lhs, rhs)),
bool>::value,
243 std::is_same<decltype(
operator<=(lhs, rhs)),
bool>::value,
247 std::is_same<decltype(
operator>(lhs, rhs)),
bool>::value,
251 std::is_same<decltype(
operator>=(lhs, rhs)),
bool>::value,
280 static const int hiIndex{std::tuple_size<decltype(ters)>::value - 1};
284 testIterate<hiIndex, hiIndex, CheckComparable>(ters, *
this);