1#define BOOST_TEST_MODULE trace_data_handlers
2#include <boost/test/included/unit_test.hpp>
12BOOST_AUTO_TEST_SUITE(abi_data_handler_tests)
16 0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {}
18 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
22 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
24 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
30 {0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {}},
33 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
37 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
39 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
45 0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {0x00, 0x01, 0x02, 0x03}
47 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
51 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
53 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
59 { 0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {0x00, 0x01, 0x02, 0x03}},
60 {0x04, 0x05, 0x06, 0x07}
62 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
66 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
68 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
74 0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {0x00, 0x01, 0x02, 0x03}
77 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
81 {
"foo",
"", { {
"a",
"varuint32"}, {
"b",
"varuint32"}, {
"c",
"varuint32"}, {
"d",
"varuint32"} } }
91 handler.
add_abi(
"alice"_n, abi);
99 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
101 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
107 { 0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {0x00, 0x01, 0x02, 0x03}},
108 {0x04, 0x05, 0x06, 0x07}
111 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
115 {
"foo",
"", { {
"a",
"varuint32"}, {
"b",
"varuint32"}, {
"c",
"varuint32"}, {
"d",
"varuint32"} } }
118 {
"foo"_n,
"foo",
""}
125 handler.
add_abi(
"alice"_n, abi);
133 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
135 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
141 0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {0x00, 0x01, 0x02, 0x03}
144 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
148 {
"foo",
"", { {
"a",
"varuint32"}, {
"b",
"varuint32"}, {
"c",
"varuint32"}, {
"d",
"varuint32"} } }
151 {
"bar"_n,
"foo",
""}
158 handler.
add_abi(
"alice"_n, abi);
162 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
164 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
170 { 0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {0x00, 0x01, 0x02, 0x03}},
171 {0x04, 0x05, 0x06, 0x07}
173 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
177 {
"foo",
"", { {
"a",
"varuint32"}, {
"b",
"varuint32"}, {
"c",
"varuint32"}, {
"d",
"varuint32"} } }
180 {
"bar"_n,
"foo",
""}
187 handler.
add_abi(
"alice"_n, abi);
191 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
193 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
199 0,
"alice"_n,
"alice"_n,
"foo"_n, {}, {0x00, 0x01, 0x02}
202 std::variant<action_trace_v0, action_trace_v1> action_trace_t =
action;
206 {
"foo",
"", { {
"a",
"varuint32"}, {
"b",
"varuint32"}, {
"c",
"varuint32"}, {
"d",
"varuint32"} } }
209 {
"foo"_n,
"foo",
""}
215 bool log_called =
false;
217 handler.
add_abi(
"alice"_n, abi);
221 auto actual = handler.serialize_to_variant(action_trace_t, [](){});
223 BOOST_TEST(
to_kv(expected) ==
to_kv(std::get<0>(actual)), boost::test_tools::per_element());
224 BOOST_TEST(log_called);
227BOOST_AUTO_TEST_SUITE_END()
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
void add_abi(const chain::name &name, const chain::abi_def &abi)
auto to_kv(const fc::variant &v)
std::tuple< const std::exception_ptr &, char const *, uint64_t, char const * > exception_with_context
BOOST_AUTO_TEST_CASE(empty_data)