Implement basic transformer tests (#689)

This commit is contained in:
Alex Kremer
2023-06-13 11:16:52 +01:00
committed by GitHub
parent 01e4eed130
commit 14f9f98cf2
23 changed files with 580 additions and 126 deletions

View File

@@ -18,13 +18,13 @@
//==============================================================================
#include <util/Fixtures.h>
#include <util/StringUtils.h>
#include <backend/CassandraBackend.h>
#include <config/Config.h>
#include <etl/NFTHelpers.h>
#include <rpc/RPCHelpers.h>
#include <ripple/basics/base_uint.h>
#include <boost/json/parse.hpp>
#include <fmt/compile.h>
#include <gtest/gtest.h>
@@ -89,29 +89,6 @@ TEST_F(BackendCassandraTest, Basic)
"3E2232B33EF57CECAC2816E3122816E31A0A00F8377CD95DFA484CFAE282656A58"
"CE5AA29652EFFD80AC59CD91416E4E13DBBE";
auto hexStringToBinaryString = [](auto const& hex) {
auto blob = ripple::strUnHex(hex);
std::string strBlob;
for (auto c : *blob)
{
strBlob += c;
}
return strBlob;
};
[[maybe_unused]] auto binaryStringToUint256 = [](auto const& bin) -> ripple::uint256 {
ripple::uint256 uint;
return uint.fromVoid((void const*)bin.data());
};
[[maybe_unused]] auto ledgerInfoToBinaryString = [](auto const& info) {
auto blob = ledgerInfoToBlob(info, true);
std::string strBlob;
for (auto c : blob)
{
strBlob += c;
}
return strBlob;
};
std::string rawHeaderBlob = hexStringToBinaryString(rawHeader);
ripple::LedgerInfo lgrInfo = util::deserializeHeader(ripple::makeSlice(rawHeaderBlob));
@@ -906,29 +883,6 @@ TEST_F(BackendCassandraTest, CacheIntegration)
"142252F328CF91263417762570D67220CCB33B1370";
std::string accountIndexHex = "E0311EB450B6177F969B94DBDDA83E99B7A0576ACD9079573876F16C0C004F06";
auto hexStringToBinaryString = [](auto const& hex) {
auto blob = ripple::strUnHex(hex);
std::string strBlob;
for (auto c : *blob)
{
strBlob += c;
}
return strBlob;
};
auto binaryStringToUint256 = [](auto const& bin) -> ripple::uint256 {
ripple::uint256 uint;
return uint.fromVoid((void const*)bin.data());
};
auto ledgerInfoToBinaryString = [](auto const& info) {
auto blob = ledgerInfoToBlob(info, true);
std::string strBlob;
for (auto c : blob)
{
strBlob += c;
}
return strBlob;
};
std::string rawHeaderBlob = hexStringToBinaryString(rawHeader);
std::string accountBlob = hexStringToBinaryString(accountHex);
std::string accountIndexBlob = hexStringToBinaryString(accountIndexHex);