Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ksergey committed Oct 14, 2024
1 parent 1f34b9d commit 6a64b79
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions tests/Binance_exchangeInfo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,26 @@ void view(std::string prefix, F entry) {
fmt::print(stdout, "{}: {}\n", prefix, convert(entry.value()));
}
} else if constexpr (requires { entry.template field<0>(); }) {
// SBEType_Message, SBEType_Group, SBEType_Composite
MP_forEach<MP_IndexSeq<MP_Size<typename F::Fields>>>([&](auto I) {
auto const name = MP_At<typename F::Fields, MP_SizeT<I>>::first_type::value;
view(prefix + "." + std::string(name), entry.template field<I>());
});
if constexpr (requires { entry.hasNext(); }) {
// SBEType_Group
std::size_t num = 0;
while (entry.hasNext()) {
entry.next();
// SBEType_Message, SBEType_Composite
MP_forEach<MP_IndexSeq<MP_Size<typename F::Fields>>>([&](auto I) {
auto const name = MP_At<typename F::Fields, MP_SizeT<I>>::first_type::value;
view(prefix + "[" + std::to_string(num) + "]." + std::string(name), entry.template field<I>());
});
num++;
}

} else {
// SBEType_Message, SBEType_Composite
MP_forEach<MP_IndexSeq<MP_Size<typename F::Fields>>>([&](auto I) {
auto const name = MP_At<typename F::Fields, MP_SizeT<I>>::first_type::value;
view(prefix + "." + std::string(name), entry.template field<I>());
});
}
} else {
fmt::print(stdout, "{}: wtf?\n", prefix);
}
Expand Down

0 comments on commit 6a64b79

Please sign in to comment.