From cce7aa2893fb4666ff6a4b6a578550cf8f7e95db Mon Sep 17 00:00:00 2001 From: Peter Chen <34582813+PeterChen13579@users.noreply.github.com> Date: Fri, 3 Jan 2025 23:00:03 -0500 Subject: [PATCH] style: Fix formatting via clang-format (#1809) For #1760 --- .../CassandraMigrationManagerTests.cpp | 3 +- tests/unit/rpc/handlers/BookOffersTests.cpp | 385 +++++++++--------- .../rpc/handlers/GatewayBalancesTests.cpp | 95 +++-- tests/unit/rpc/handlers/LedgerIndexTests.cpp | 30 +- tests/unit/rpc/handlers/LedgerTests.cpp | 14 +- tests/unit/rpc/handlers/MPTHoldersTests.cpp | 22 +- tests/unit/rpc/handlers/NFTBuyOffersTests.cpp | 10 +- tests/unit/rpc/handlers/NFTHistoryTests.cpp | 26 +- tests/unit/rpc/handlers/NFTInfoTests.cpp | 12 +- .../unit/rpc/handlers/NFTSellOffersTests.cpp | 10 +- tests/unit/rpc/handlers/NFTsByIssuerTest.cpp | 25 +- tests/unit/web/RPCServerHandlerTests.cpp | 17 +- .../web/ng/impl/ConnectionHandlerTests.cpp | 8 +- 13 files changed, 352 insertions(+), 305 deletions(-) diff --git a/tests/integration/migration/cassandra/CassandraMigrationManagerTests.cpp b/tests/integration/migration/cassandra/CassandraMigrationManagerTests.cpp index 80392ed56..80f9c9757 100644 --- a/tests/integration/migration/cassandra/CassandraMigrationManagerTests.cpp +++ b/tests/integration/migration/cassandra/CassandraMigrationManagerTests.cpp @@ -310,7 +310,8 @@ TEST_F(MigrationCassandraManagerLedgerTableTest, MigrateExampleLedgerMigrator) EXPECT_EQ(newTableSize, gLedgerHeaderRawData.size()); auto const getAccountHash = [this](std::uint32_t seq) { - return data::synchronous([&](auto ctx) { return testMigrationBackend_->fetchAccountHashViaSequence(seq, ctx); }); + return data::synchronous([&](auto ctx) { return testMigrationBackend_->fetchAccountHashViaSequence(seq, ctx); } + ); }; EXPECT_EQ( diff --git a/tests/unit/rpc/handlers/BookOffersTests.cpp b/tests/unit/rpc/handlers/BookOffersTests.cpp index 379f23146..88d6f3bed 100644 --- a/tests/unit/rpc/handlers/BookOffersTests.cpp +++ b/tests/unit/rpc/handlers/BookOffersTests.cpp @@ -646,31 +646,33 @@ generateNormalPathBookOffersTestBundles() return std::vector{ BookOffersNormalTestBundle{ - .testName="PaysUSDGetsXRPNoFrozenOwnerFundEnough", - .inputJson=getsXRPPaysUSDInputJson, + .testName = "PaysUSDGetsXRPNoFrozenOwnerFundEnough", + .inputJson = getsXRPPaysUSDInputJson, // prepare offer dir index - .mockedSuccessors=std::map>{ - {getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}}, - {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional{}} - }, - .mockedLedgerObjects=std::map{ - // book dir object - {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, - createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, - // pays issuer account object - {ripple::keylet::account(account).key, - createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2).getSerializer().peekData()}, - // owner account object - {ripple::keylet::account(account2).key, - createAccountRootObject(kACCOUNT2, 0, 2, 200, 2, kINDEX1, 2).getSerializer().peekData()}, - // fee settings: base ->3 inc->2, account2 has 2 objects ,total - // reserve ->7 - // owner_funds should be 193 - {ripple::keylet::fees().key, feeLedgerObject} - }, - .ledgerObjectCalls=5, - .mockedOffers=std::vector{gets10XRPPays20USDOffer}, - .expectedJson=fmt::format( + .mockedSuccessors = + std::map>{ + {getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}}, + {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional{}} + }, + .mockedLedgerObjects = + std::map{ + // book dir object + {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, + createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, + // pays issuer account object + {ripple::keylet::account(account).key, + createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2).getSerializer().peekData()}, + // owner account object + {ripple::keylet::account(account2).key, + createAccountRootObject(kACCOUNT2, 0, 2, 200, 2, kINDEX1, 2).getSerializer().peekData()}, + // fee settings: base ->3 inc->2, account2 has 2 objects ,total + // reserve ->7 + // owner_funds should be 193 + {ripple::keylet::fees().key, feeLedgerObject} + }, + .ledgerObjectCalls = 5, + .mockedOffers = std::vector{gets10XRPPays20USDOffer}, + .expectedJson = fmt::format( R"({{ "ledger_hash":"{}", "ledger_index":300, @@ -704,31 +706,33 @@ generateNormalPathBookOffersTestBundles() ) }, BookOffersNormalTestBundle{ - .testName="PaysUSDGetsXRPNoFrozenOwnerFundNotEnough", - .inputJson=getsXRPPaysUSDInputJson, + .testName = "PaysUSDGetsXRPNoFrozenOwnerFundNotEnough", + .inputJson = getsXRPPaysUSDInputJson, // prepare offer dir index - .mockedSuccessors=std::map>{ - {getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}}, - {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional{}} - }, - .mockedLedgerObjects=std::map{ - // book dir object - {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, - createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, - // pays issuer account object - {ripple::keylet::account(account).key, - createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2).getSerializer().peekData()}, - // owner account object, hold - {ripple::keylet::account(account2).key, - createAccountRootObject(kACCOUNT2, 0, 2, 5 + 7, 2, kINDEX1, 2).getSerializer().peekData()}, - // fee settings: base ->3 inc->2, account2 has 2 objects - // ,total - // reserve ->7 - {ripple::keylet::fees().key, feeLedgerObject} - }, - .ledgerObjectCalls=5, - .mockedOffers=std::vector{gets10XRPPays20USDOffer}, - .expectedJson=fmt::format( + .mockedSuccessors = + std::map>{ + {getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}}, + {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional{}} + }, + .mockedLedgerObjects = + std::map{ + // book dir object + {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, + createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, + // pays issuer account object + {ripple::keylet::account(account).key, + createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2).getSerializer().peekData()}, + // owner account object, hold + {ripple::keylet::account(account2).key, + createAccountRootObject(kACCOUNT2, 0, 2, 5 + 7, 2, kINDEX1, 2).getSerializer().peekData()}, + // fee settings: base ->3 inc->2, account2 has 2 objects + // ,total + // reserve ->7 + {ripple::keylet::fees().key, feeLedgerObject} + }, + .ledgerObjectCalls = 5, + .mockedOffers = std::vector{gets10XRPPays20USDOffer}, + .expectedJson = fmt::format( R"({{ "ledger_hash":"{}", "ledger_index":300, @@ -769,26 +773,28 @@ generateNormalPathBookOffersTestBundles() ) }, BookOffersNormalTestBundle{ - .testName="PaysUSDGetsXRPFrozen", - .inputJson=getsXRPPaysUSDInputJson, + .testName = "PaysUSDGetsXRPFrozen", + .inputJson = getsXRPPaysUSDInputJson, // prepare offer dir index - .mockedSuccessors=std::map>{ - {getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}}, - {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional{}} - }, - .mockedLedgerObjects=std::map{ - // book dir object - {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, - createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, - // pays issuer account object - {ripple::keylet::account(account).key, - createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 2, 200, 2, kINDEX1, 2) - .getSerializer() - .peekData()} - }, - .ledgerObjectCalls=3, - .mockedOffers=std::vector{gets10XRPPays20USDOffer}, - .expectedJson=fmt::format( + .mockedSuccessors = + std::map>{ + {getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}}, + {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional{}} + }, + .mockedLedgerObjects = + std::map{ + // book dir object + {ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, + createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, + // pays issuer account object + {ripple::keylet::account(account).key, + createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 2, 200, 2, kINDEX1, 2) + .getSerializer() + .peekData()} + }, + .ledgerObjectCalls = 3, + .mockedOffers = std::vector{gets10XRPPays20USDOffer}, + .expectedJson = fmt::format( R"({{ "ledger_hash":"{}", "ledger_index":300, @@ -829,26 +835,30 @@ generateNormalPathBookOffersTestBundles() ) }, BookOffersNormalTestBundle{ - .testName="GetsUSDPaysXRPFrozen", - .inputJson=paysXRPGetsUSDInputJson, + .testName = "GetsUSDPaysXRPFrozen", + .inputJson = paysXRPGetsUSDInputJson, // prepare offer dir index - .mockedSuccessors=std::map>{ - {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} - }, - .mockedLedgerObjects=std::map{ - // book dir object - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, - createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, - // gets issuer account object - {ripple::keylet::account(account).key, - createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) - .getSerializer() - .peekData()} - }, - .ledgerObjectCalls=3, - .mockedOffers=std::vector{gets10USDPays20XRPOffer}, - .expectedJson=fmt::format( + .mockedSuccessors = + std::map>{ + {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} + }, + .mockedLedgerObjects = + std::map{ + // book dir object + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, + createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, + // gets issuer account object + {ripple::keylet::account(account).key, + createAccountRootObject( + kACCOUNT, ripple::lsfGlobalFreeze, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2 + ) + .getSerializer() + .peekData()} + }, + .ledgerObjectCalls = 3, + .mockedOffers = std::vector{gets10USDPays20XRPOffer}, + .expectedJson = fmt::format( R"({{ "ledger_hash":"{}", "ledger_index":300, @@ -890,29 +900,31 @@ generateNormalPathBookOffersTestBundles() ) }, BookOffersNormalTestBundle{ - .testName="PaysXRPGetsUSDWithTransferFee", - .inputJson=paysXRPGetsUSDInputJson, + .testName = "PaysXRPGetsUSDWithTransferFee", + .inputJson = paysXRPGetsUSDInputJson, // prepare offer dir index - .mockedSuccessors=std::map>{ - {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} - }, - .mockedLedgerObjects=std::map{ - // book dir object - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, - createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, - // gets issuer account object, rate is 1/2 - {ripple::keylet::account(account).key, - createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) - .getSerializer() - .peekData()}, - // trust line between gets issuer and owner,owner has 8 USD - {ripple::keylet::line(account2, account, ripple::to_currency("USD")).key, - trustline8Balance.getSerializer().peekData()}, - }, - .ledgerObjectCalls=6, - .mockedOffers=std::vector{gets10USDPays20XRPOffer}, - .expectedJson=fmt::format( + .mockedSuccessors = + std::map>{ + {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} + }, + .mockedLedgerObjects = + std::map{ + // book dir object + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, + createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, + // gets issuer account object, rate is 1/2 + {ripple::keylet::account(account).key, + createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) + .getSerializer() + .peekData()}, + // trust line between gets issuer and owner,owner has 8 USD + {ripple::keylet::line(account2, account, ripple::to_currency("USD")).key, + trustline8Balance.getSerializer().peekData()}, + }, + .ledgerObjectCalls = 6, + .mockedOffers = std::vector{gets10USDPays20XRPOffer}, + .expectedJson = fmt::format( R"({{ "ledger_hash":"{}", "ledger_index":300, @@ -954,36 +966,39 @@ generateNormalPathBookOffersTestBundles() ) }, BookOffersNormalTestBundle{ - .testName="PaysXRPGetsUSDWithMultipleOffers", - .inputJson=paysXRPGetsUSDInputJson, + .testName = "PaysXRPGetsUSDWithMultipleOffers", + .inputJson = paysXRPGetsUSDInputJson, // prepare offer dir index - .mockedSuccessors=std::map>{ - {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} - }, - .mockedLedgerObjects=std::map{ - // book dir object - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, - createOwnerDirLedgerObject({ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1) - .getSerializer() - .peekData()}, - // gets issuer account object - {ripple::keylet::account(account).key, - createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) - .getSerializer() - .peekData()}, - // trust line between gets issuer and owner,owner has 30 USD - {ripple::keylet::line(account2, account, ripple::to_currency("USD")).key, - trustline30Balance.getSerializer().peekData()}, - }, - .ledgerObjectCalls=6, - .mockedOffers=std::vector{// After offer1, balance is 30 - 2*10 = 10 - gets10USDPays20XRPOffer, - // offer2 not fully funded, balance is 10, rate is 2, so only - // gets 5 - gets10USDPays20XRPOffer - }, - .expectedJson=fmt::format( + .mockedSuccessors = + std::map>{ + {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} + }, + .mockedLedgerObjects = + std::map{ + // book dir object + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, + createOwnerDirLedgerObject({ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1) + .getSerializer() + .peekData()}, + // gets issuer account object + {ripple::keylet::account(account).key, + createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) + .getSerializer() + .peekData()}, + // trust line between gets issuer and owner,owner has 30 USD + {ripple::keylet::line(account2, account, ripple::to_currency("USD")).key, + trustline30Balance.getSerializer().peekData()}, + }, + .ledgerObjectCalls = 6, + .mockedOffers = + std::vector{// After offer1, balance is 30 - 2*10 = 10 + gets10USDPays20XRPOffer, + // offer2 not fully funded, balance is 10, rate is 2, so only + // gets 5 + gets10USDPays20XRPOffer + }, + .expectedJson = fmt::format( R"({{ "ledger_hash":"{}", "ledger_index":300, @@ -1047,26 +1062,28 @@ generateNormalPathBookOffersTestBundles() ) }, BookOffersNormalTestBundle{ - .testName="PaysXRPGetsUSDSellingOwnCurrency", - .inputJson=paysXRPGetsUSDInputJson, + .testName = "PaysXRPGetsUSDSellingOwnCurrency", + .inputJson = paysXRPGetsUSDInputJson, // prepare offer dir index - .mockedSuccessors=std::map>{ - {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} - }, - .mockedLedgerObjects=std::map{ - // book dir object - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, - createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, - // gets issuer account object, rate is 1/2 - {ripple::keylet::account(account).key, - createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) - .getSerializer() - .peekData()}, - }, - .ledgerObjectCalls=3, - .mockedOffers=std::vector{gets10USDPays20XRPOwnerOffer}, - .expectedJson=fmt::format( + .mockedSuccessors = + std::map>{ + {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} + }, + .mockedLedgerObjects = + std::map{ + // book dir object + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, + createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, + // gets issuer account object, rate is 1/2 + {ripple::keylet::account(account).key, + createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) + .getSerializer() + .peekData()}, + }, + .ledgerObjectCalls = 3, + .mockedOffers = std::vector{gets10USDPays20XRPOwnerOffer}, + .expectedJson = fmt::format( R"({{ "ledger_hash":"{}", "ledger_index":300, @@ -1102,29 +1119,31 @@ generateNormalPathBookOffersTestBundles() ) }, BookOffersNormalTestBundle{ - .testName="PaysXRPGetsUSDTrustLineFrozen", - .inputJson=paysXRPGetsUSDInputJson, + .testName = "PaysXRPGetsUSDTrustLineFrozen", + .inputJson = paysXRPGetsUSDInputJson, // prepare offer dir index - .mockedSuccessors=std::map>{ - {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} - }, - .mockedLedgerObjects=std::map{ - // book dir object - {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, - createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, - // gets issuer account object, rate is 1/2 - {ripple::keylet::account(account).key, - createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) - .getSerializer() - .peekData()}, - // trust line between gets issuer and owner,owner has 8 USD - {ripple::keylet::line(account2, account, ripple::to_currency("USD")).key, - frozenTrustLine.getSerializer().peekData()}, - }, - .ledgerObjectCalls=6, - .mockedOffers=std::vector{gets10USDPays20XRPOffer}, - .expectedJson=fmt::format( + .mockedSuccessors = + std::map>{ + {getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}}, + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional{}} + }, + .mockedLedgerObjects = + std::map{ + // book dir object + {ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, + createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()}, + // gets issuer account object, rate is 1/2 + {ripple::keylet::account(account).key, + createAccountRootObject(kACCOUNT, 0, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2) + .getSerializer() + .peekData()}, + // trust line between gets issuer and owner,owner has 8 USD + {ripple::keylet::line(account2, account, ripple::to_currency("USD")).key, + frozenTrustLine.getSerializer().peekData()}, + }, + .ledgerObjectCalls = 6, + .mockedOffers = std::vector{gets10USDPays20XRPOffer}, + .expectedJson = fmt::format( R"({{ "ledger_hash":"{}", "ledger_index":300, @@ -1199,7 +1218,7 @@ TEST_F(RPCBookOffersHandlerTest, LedgerNonExistViaIntSequence) )); auto const handler = AnyHandler{BookOffersHandler{backend_}}; runSpawn([&](boost::asio::yield_context yield) { - auto const output = handler.process(kINPUT, Context{.yield=yield}); + auto const output = handler.process(kINPUT, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -1230,7 +1249,7 @@ TEST_F(RPCBookOffersHandlerTest, LedgerNonExistViaSequence) )); auto const handler = AnyHandler{BookOffersHandler{backend_}}; runSpawn([&](boost::asio::yield_context yield) { - auto const output = handler.process(kINPUT, Context{.yield=yield}); + auto const output = handler.process(kINPUT, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -1263,7 +1282,7 @@ TEST_F(RPCBookOffersHandlerTest, LedgerNonExistViaHash) )); auto const handler = AnyHandler{BookOffersHandler{backend_}}; runSpawn([&](boost::asio::yield_context yield) { - auto const output = handler.process(kINPUT, Context{.yield=yield}); + auto const output = handler.process(kINPUT, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -1338,7 +1357,7 @@ TEST_F(RPCBookOffersHandlerTest, Limit) )); auto const handler = AnyHandler{BookOffersHandler{backend_}}; runSpawn([&](boost::asio::yield_context yield) { - auto const output = handler.process(kINPUT, Context{.yield=yield}); + auto const output = handler.process(kINPUT, Context{.yield = yield}); ASSERT_TRUE(output); EXPECT_EQ(output.result.value().as_object().at("offers").as_array().size(), 5); }); @@ -1412,7 +1431,7 @@ TEST_F(RPCBookOffersHandlerTest, LimitMoreThanMax) )); auto const handler = AnyHandler{BookOffersHandler{backend_}}; runSpawn([&](boost::asio::yield_context yield) { - auto const output = handler.process(kINPUT, Context{.yield=yield}); + auto const output = handler.process(kINPUT, Context{.yield = yield}); ASSERT_TRUE(output); EXPECT_EQ(output.result.value().as_object().at("offers").as_array().size(), BookOffersHandler::kLIMIT_MAX); }); diff --git a/tests/unit/rpc/handlers/GatewayBalancesTests.cpp b/tests/unit/rpc/handlers/GatewayBalancesTests.cpp index 76e7433fe..a4891ef28 100644 --- a/tests/unit/rpc/handlers/GatewayBalancesTests.cpp +++ b/tests/unit/rpc/handlers/GatewayBalancesTests.cpp @@ -444,8 +444,8 @@ generateNormalPathTestBundles() overflowState.setFieldAmount(ripple::sfBalance, ripple::STAmount(getIssue("JPY", kISSUER), min64, 80)); return std::vector{ NormalTestBundle{ - .testName="AllBranches", - .mockedDir=createOwnerDirLedgerObject( + .testName = "AllBranches", + .mockedDir = createOwnerDirLedgerObject( {ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}, @@ -454,20 +454,22 @@ generateNormalPathTestBundles() ripple::uint256{kINDEX2}}, kINDEX1 ), - .mockedObjects=std::vector{// hotwallet - createRippleStateLedgerObject("USD", kISSUER, -10, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123), - // hotwallet - createRippleStateLedgerObject("CNY", kISSUER, -20, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123), - // positive balance -> asset - createRippleStateLedgerObject("EUR", kISSUER, 30, kACCOUNT, 100, kACCOUNT3, 200, kTXN_ID, 123), - // positive balance -> asset - createRippleStateLedgerObject("JPY", kISSUER, 40, kACCOUNT, 100, kACCOUNT3, 200, kTXN_ID, 123), - // obligation - createRippleStateLedgerObject("JPY", kISSUER, -50, kACCOUNT, 10, kACCOUNT3, 20, kTXN_ID, 123), - frozenState - - }, - .expectedJson=fmt::format( + .mockedObjects = + std::vector{ + // hotwallet + createRippleStateLedgerObject("USD", kISSUER, -10, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123), + // hotwallet + createRippleStateLedgerObject("CNY", kISSUER, -20, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123), + // positive balance -> asset + createRippleStateLedgerObject("EUR", kISSUER, 30, kACCOUNT, 100, kACCOUNT3, 200, kTXN_ID, 123), + // positive balance -> asset + createRippleStateLedgerObject("JPY", kISSUER, 40, kACCOUNT, 100, kACCOUNT3, 200, kTXN_ID, 123), + // obligation + createRippleStateLedgerObject("JPY", kISSUER, -50, kACCOUNT, 10, kACCOUNT3, 20, kTXN_ID, 123), + frozenState + + }, + .expectedJson = fmt::format( R"({{ "obligations":{{ "JPY":"50" @@ -513,13 +515,15 @@ generateNormalPathTestBundles() kACCOUNT3, kACCOUNT ), - .hotwallet=fmt::format(R"("hotwallet": "{}")", kACCOUNT2) + .hotwallet = fmt::format(R"("hotwallet": "{}")", kACCOUNT2) }, NormalTestBundle{ - .testName="NoHotwallet", - .mockedDir=createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1), - .mockedObjects=std::vector{createRippleStateLedgerObject("JPY", kISSUER, -50, kACCOUNT, 10, kACCOUNT3, 20, kTXN_ID, 123)}, - .expectedJson=fmt::format( + .testName = "NoHotwallet", + .mockedDir = createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1), + .mockedObjects = std::vector{createRippleStateLedgerObject( + "JPY", kISSUER, -50, kACCOUNT, 10, kACCOUNT3, 20, kTXN_ID, 123 + )}, + .expectedJson = fmt::format( R"({{ "obligations":{{ "JPY":"50" @@ -533,10 +537,10 @@ generateNormalPathTestBundles() .hotwallet = R"("ledger_index" : "validated")" }, NormalTestBundle{ - .testName="ObligationOverflow", - .mockedDir=createOwnerDirLedgerObject({ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1), - .mockedObjects=std::vector{overflowState, overflowState}, - .expectedJson=fmt::format( + .testName = "ObligationOverflow", + .mockedDir = createOwnerDirLedgerObject({ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1), + .mockedObjects = std::vector{overflowState, overflowState}, + .expectedJson = fmt::format( R"({{ "obligations":{{ "JPY":"9999999999999999e80" @@ -550,20 +554,22 @@ generateNormalPathTestBundles() .hotwallet = R"("ledger_index" : "validated")" }, NormalTestBundle{ - .testName="HighID", - .mockedDir=createOwnerDirLedgerObject( + .testName = "HighID", + .mockedDir = createOwnerDirLedgerObject( {ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2} }, kINDEX1 ), - .mockedObjects=std::vector{// hotwallet - createRippleStateLedgerObject("USD", kISSUER, 10, kACCOUNT2, 100, kACCOUNT, 200, kTXN_ID, 123), - // hotwallet - createRippleStateLedgerObject("CNY", kISSUER, 20, kACCOUNT2, 100, kACCOUNT, 200, kTXN_ID, 123), - createRippleStateLedgerObject("EUR", kISSUER, 30, kACCOUNT3, 100, kACCOUNT, 200, kTXN_ID, 123), - createRippleStateLedgerObject("JPY", kISSUER, -50, kACCOUNT3, 10, kACCOUNT, 20, kTXN_ID, 123) - }, - .expectedJson=fmt::format( + .mockedObjects = + std::vector{ + // hotwallet + createRippleStateLedgerObject("USD", kISSUER, 10, kACCOUNT2, 100, kACCOUNT, 200, kTXN_ID, 123), + // hotwallet + createRippleStateLedgerObject("CNY", kISSUER, 20, kACCOUNT2, 100, kACCOUNT, 200, kTXN_ID, 123), + createRippleStateLedgerObject("EUR", kISSUER, 30, kACCOUNT3, 100, kACCOUNT, 200, kTXN_ID, 123), + createRippleStateLedgerObject("JPY", kISSUER, -50, kACCOUNT3, 10, kACCOUNT, 20, kTXN_ID, 123) + }, + .expectedJson = fmt::format( R"({{ "obligations":{{ "EUR":"30" @@ -596,19 +602,20 @@ generateNormalPathTestBundles() kACCOUNT3, kACCOUNT ), - .hotwallet=fmt::format(R"("hotwallet": "{}")", kACCOUNT2) + .hotwallet = fmt::format(R"("hotwallet": "{}")", kACCOUNT2) }, NormalTestBundle{ - .testName="HotWalletArray", - .mockedDir=createOwnerDirLedgerObject( + .testName = "HotWalletArray", + .mockedDir = createOwnerDirLedgerObject( {ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1 ), - .mockedObjects=std::vector{ - createRippleStateLedgerObject("USD", kISSUER, -10, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123), - createRippleStateLedgerObject("CNY", kISSUER, -20, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123), - createRippleStateLedgerObject("EUR", kISSUER, -30, kACCOUNT, 100, kACCOUNT3, 200, kTXN_ID, 123) + .mockedObjects = + std::vector{ + createRippleStateLedgerObject("USD", kISSUER, -10, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123), + createRippleStateLedgerObject("CNY", kISSUER, -20, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123), + createRippleStateLedgerObject("EUR", kISSUER, -30, kACCOUNT, 100, kACCOUNT3, 200, kTXN_ID, 123) - }, + }, .expectedJson = fmt::format( R"({{ "balances":{{ @@ -637,7 +644,7 @@ generateNormalPathTestBundles() kACCOUNT2, kACCOUNT ), - .hotwallet=fmt::format(R"("hotwallet": ["{}", "{}"])", kACCOUNT2, kACCOUNT3) + .hotwallet = fmt::format(R"("hotwallet": ["{}", "{}"])", kACCOUNT2, kACCOUNT3) }, }; } diff --git a/tests/unit/rpc/handlers/LedgerIndexTests.cpp b/tests/unit/rpc/handlers/LedgerIndexTests.cpp index 5df40c95d..6bdb8430a 100644 --- a/tests/unit/rpc/handlers/LedgerIndexTests.cpp +++ b/tests/unit/rpc/handlers/LedgerIndexTests.cpp @@ -130,12 +130,30 @@ class LedgerIndexTests : public RPCLedgerIndexTest, public WithParamInterface{ - {.testName="LaterThanMaxLedger", .json=R"({"date": "2024-06-25T12:23:55Z"})", .expectedLedgerIndex=kRANGE_MAX, .closeTimeIso="2024-06-25T12:23:50Z"}, - {.testName="GreaterThanMinLedger", .json=R"({"date": "2024-06-25T12:23:11Z"})", .expectedLedgerIndex=kRANGE_MIN, .closeTimeIso="2024-06-25T12:23:10Z"}, - {.testName="IsMinLedger", .json=R"({"date": "2024-06-25T12:23:10Z"})", .expectedLedgerIndex=kRANGE_MIN, .closeTimeIso="2024-06-25T12:23:10Z"}, - {.testName="IsMaxLedger", .json=R"({"date": "2024-06-25T12:23:50Z"})", .expectedLedgerIndex=kRANGE_MAX, .closeTimeIso="2024-06-25T12:23:50Z"}, - {.testName="IsMidLedger", .json=R"({"date": "2024-06-25T12:23:30Z"})", .expectedLedgerIndex=20, .closeTimeIso="2024-06-25T12:23:30Z"}, - {.testName="BetweenLedgers", .json=R"({"date": "2024-06-25T12:23:29Z"})", .expectedLedgerIndex=19, .closeTimeIso="2024-06-25T12:23:28Z"} + {.testName = "LaterThanMaxLedger", + .json = R"({"date": "2024-06-25T12:23:55Z"})", + .expectedLedgerIndex = kRANGE_MAX, + .closeTimeIso = "2024-06-25T12:23:50Z"}, + {.testName = "GreaterThanMinLedger", + .json = R"({"date": "2024-06-25T12:23:11Z"})", + .expectedLedgerIndex = kRANGE_MIN, + .closeTimeIso = "2024-06-25T12:23:10Z"}, + {.testName = "IsMinLedger", + .json = R"({"date": "2024-06-25T12:23:10Z"})", + .expectedLedgerIndex = kRANGE_MIN, + .closeTimeIso = "2024-06-25T12:23:10Z"}, + {.testName = "IsMaxLedger", + .json = R"({"date": "2024-06-25T12:23:50Z"})", + .expectedLedgerIndex = kRANGE_MAX, + .closeTimeIso = "2024-06-25T12:23:50Z"}, + {.testName = "IsMidLedger", + .json = R"({"date": "2024-06-25T12:23:30Z"})", + .expectedLedgerIndex = 20, + .closeTimeIso = "2024-06-25T12:23:30Z"}, + {.testName = "BetweenLedgers", + .json = R"({"date": "2024-06-25T12:23:29Z"})", + .expectedLedgerIndex = 19, + .closeTimeIso = "2024-06-25T12:23:28Z"} }; } }; diff --git a/tests/unit/rpc/handlers/LedgerTests.cpp b/tests/unit/rpc/handlers/LedgerTests.cpp index 805bbb2f9..96d9b1a39 100644 --- a/tests/unit/rpc/handlers/LedgerTests.cpp +++ b/tests/unit/rpc/handlers/LedgerTests.cpp @@ -766,10 +766,11 @@ TEST_F(RPCLedgerHandlerTest, DiffNotBinary) EXPECT_CALL(*backend_, fetchLedgerDiff).Times(1); - los.push_back(LedgerObject{.key=ripple::uint256{kINDEX2}, .blob=Blob{}}); // NOLINT(modernize-use-emplace) + los.push_back(LedgerObject{.key = ripple::uint256{kINDEX2}, .blob = Blob{}}); // NOLINT(modernize-use-emplace) los.push_back(LedgerObject{ - .key=ripple::uint256{kINDEX1}, - .blob=createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 1, 10, 2, kINDEX1, 3).getSerializer().peekData() + .key = ripple::uint256{kINDEX1}, + .blob = + createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 1, 10, 2, kINDEX1, 3).getSerializer().peekData() }); ON_CALL(*backend_, fetchLedgerDiff(kRANGE_MAX, _)).WillByDefault(Return(los)); @@ -809,10 +810,11 @@ TEST_F(RPCLedgerHandlerTest, DiffBinary) EXPECT_CALL(*backend_, fetchLedgerDiff).Times(1); - los.push_back(LedgerObject{.key=ripple::uint256{kINDEX2}, .blob=Blob{}}); // NOLINT(modernize-use-emplace) + los.push_back(LedgerObject{.key = ripple::uint256{kINDEX2}, .blob = Blob{}}); // NOLINT(modernize-use-emplace) los.push_back(LedgerObject{ - .key=ripple::uint256{kINDEX1}, - .blob=createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 1, 10, 2, kINDEX1, 3).getSerializer().peekData() + .key = ripple::uint256{kINDEX1}, + .blob = + createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 1, 10, 2, kINDEX1, 3).getSerializer().peekData() }); ON_CALL(*backend_, fetchLedgerDiff(kRANGE_MAX, _)).WillByDefault(Return(los)); diff --git a/tests/unit/rpc/handlers/MPTHoldersTests.cpp b/tests/unit/rpc/handlers/MPTHoldersTests.cpp index 9c030fb1e..144ccf380 100644 --- a/tests/unit/rpc/handlers/MPTHoldersTests.cpp +++ b/tests/unit/rpc/handlers/MPTHoldersTests.cpp @@ -264,7 +264,7 @@ TEST_F(RPCMPTHoldersHandlerTest, NonExistLedgerViaLedgerStringIndex) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{MPTHoldersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -285,7 +285,7 @@ TEST_F(RPCMPTHoldersHandlerTest, NonExistLedgerViaLedgerIntIndex) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{MPTHoldersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -311,7 +311,7 @@ TEST_F(RPCMPTHoldersHandlerTest, NonExistLedgerViaLedgerHash2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{MPTHoldersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -334,7 +334,7 @@ TEST_F(RPCMPTHoldersHandlerTest, NonExistLedgerViaLedgerIndex2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{MPTHoldersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -361,7 +361,7 @@ TEST_F(RPCMPTHoldersHandlerTest, MPTNotFound) )); runSpawn([&, this](boost::asio::yield_context yield) { auto handler = AnyHandler{MPTHoldersHandler{this->backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "objectNotFound"); @@ -391,7 +391,7 @@ TEST_F(RPCMPTHoldersHandlerTest, DefaultParameters) auto const mptoken = createMpTokenObject(kHOLDE_R1_ACCOUNT, ripple::uint192(kMPT_ID)); std::vector const mpts = {mptoken.getSerializer().peekData()}; - ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens=mpts, .cursor={}})); + ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens = mpts, .cursor = {}})); EXPECT_CALL( *backend_, fetchMPTHolders(ripple::uint192(kMPT_ID), testing::_, testing::Eq(std::nullopt), Const(30), testing::_) @@ -439,7 +439,7 @@ TEST_F(RPCMPTHoldersHandlerTest, CustomAmounts) auto const mptoken = createMpTokenObject(kHOLDE_R1_ACCOUNT, ripple::uint192(kMPT_ID), 0); std::vector const mpts = {mptoken.getSerializer().peekData()}; - ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens=mpts, .cursor={}})); + ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens = mpts, .cursor = {}})); EXPECT_CALL( *backend_, fetchMPTHolders(ripple::uint192(kMPT_ID), testing::_, testing::Eq(std::nullopt), Const(30), testing::_) @@ -485,7 +485,7 @@ TEST_F(RPCMPTHoldersHandlerTest, SpecificLedgerIndex) auto const mptoken = createMpTokenObject(kHOLDE_R1_ACCOUNT, ripple::uint192(kMPT_ID)); std::vector const mpts = {mptoken.getSerializer().peekData()}; - ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens=mpts, .cursor={}})); + ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens = mpts, .cursor = {}})); EXPECT_CALL( *backend_, fetchMPTHolders( @@ -534,7 +534,7 @@ TEST_F(RPCMPTHoldersHandlerTest, MarkerParameter) auto const mptoken = createMpTokenObject(kHOLDE_R2_ACCOUNT, ripple::uint192(kMPT_ID)); std::vector const mpts = {mptoken.getSerializer().peekData()}; auto const marker = getAccountIdWithString(kHOLDE_R1_ACCOUNT); - ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens=mpts, .cursor=marker})); + ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens = mpts, .cursor = marker})); EXPECT_CALL( *backend_, fetchMPTHolders(ripple::uint192(kMPT_ID), testing::_, testing::Eq(marker), Const(30), testing::_) ) @@ -580,7 +580,7 @@ TEST_F(RPCMPTHoldersHandlerTest, MultipleMPTs) auto const mptoken1 = createMpTokenObject(kHOLDE_R1_ACCOUNT, ripple::uint192(kMPT_ID)); auto const mptoken2 = createMpTokenObject(kHOLDE_R2_ACCOUNT, ripple::uint192(kMPT_ID)); std::vector const mpts = {mptoken1.getSerializer().peekData(), mptoken2.getSerializer().peekData()}; - ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens=mpts, .cursor={}})); + ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens = mpts, .cursor = {}})); EXPECT_CALL( *backend_, fetchMPTHolders(ripple::uint192(kMPT_ID), testing::_, testing::Eq(std::nullopt), Const(30), testing::_) @@ -622,7 +622,7 @@ TEST_F(RPCMPTHoldersHandlerTest, LimitMoreThanMAx) auto const mptoken = createMpTokenObject(kHOLDE_R1_ACCOUNT, ripple::uint192(kMPT_ID)); std::vector const mpts = {mptoken.getSerializer().peekData()}; - ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens=mpts, .cursor={}})); + ON_CALL(*backend_, fetchMPTHolders).WillByDefault(Return(MPTHoldersAndCursor{.mptokens = mpts, .cursor = {}})); EXPECT_CALL( *backend_, fetchMPTHolders( diff --git a/tests/unit/rpc/handlers/NFTBuyOffersTests.cpp b/tests/unit/rpc/handlers/NFTBuyOffersTests.cpp index 6fb50f2b4..3b1aeabb9 100644 --- a/tests/unit/rpc/handlers/NFTBuyOffersTests.cpp +++ b/tests/unit/rpc/handlers/NFTBuyOffersTests.cpp @@ -229,7 +229,7 @@ TEST_F(RPCNFTBuyOffersHandlerTest, NonExistLedgerViaLedgerHash) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTBuyOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); @@ -253,7 +253,7 @@ TEST_F(RPCNFTBuyOffersHandlerTest, NonExistLedgerViaLedgerIndex) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTBuyOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -279,7 +279,7 @@ TEST_F(RPCNFTBuyOffersHandlerTest, NonExistLedgerViaLedgerHash2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTBuyOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -302,7 +302,7 @@ TEST_F(RPCNFTBuyOffersHandlerTest, NonExistLedgerViaLedgerIndex2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTBuyOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -328,7 +328,7 @@ TEST_F(RPCNFTBuyOffersHandlerTest, NoNFT) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTBuyOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "objectNotFound"); diff --git a/tests/unit/rpc/handlers/NFTHistoryTests.cpp b/tests/unit/rpc/handlers/NFTHistoryTests.cpp index b156d8064..8d42cc2d9 100644 --- a/tests/unit/rpc/handlers/NFTHistoryTests.cpp +++ b/tests/unit/rpc/handlers/NFTHistoryTests.cpp @@ -290,7 +290,7 @@ genTransactions(uint32_t seq1, uint32_t seq2) TEST_F(RPCNFTHistoryHandlerTest, IndexSpecificForwardTrue) { auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -434,7 +434,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexSpecificForwardFalseV1) })"; auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -585,7 +585,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexSpecificForwardFalseV2) })"; auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; EXPECT_CALL( *backend_, fetchNFTTransactions( @@ -624,7 +624,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexSpecificForwardFalseV2) TEST_F(RPCNFTHistoryHandlerTest, IndexNotSpecificForwardTrue) { auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -661,7 +661,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexNotSpecificForwardTrue) TEST_F(RPCNFTHistoryHandlerTest, IndexNotSpecificForwardFalse) { auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -702,7 +702,7 @@ TEST_F(RPCNFTHistoryHandlerTest, IndexNotSpecificForwardFalse) TEST_F(RPCNFTHistoryHandlerTest, BinaryTrueV1) { auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -757,7 +757,7 @@ TEST_F(RPCNFTHistoryHandlerTest, BinaryTrueV1) TEST_F(RPCNFTHistoryHandlerTest, BinaryTrueV2) { auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; EXPECT_CALL( *backend_, fetchNFTTransactions( @@ -811,7 +811,7 @@ TEST_F(RPCNFTHistoryHandlerTest, BinaryTrueV2) TEST_F(RPCNFTHistoryHandlerTest, LimitAndMarker) { auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -851,7 +851,7 @@ TEST_F(RPCNFTHistoryHandlerTest, SpecificLedgerIndex) { // adjust the order for forward->false auto const transactions = genTransactions(kMAX_SEQ - 1, kMIN_SEQ + 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -940,7 +940,7 @@ TEST_F(RPCNFTHistoryHandlerTest, SpecificLedgerHash) { // adjust the order for forward->false auto const transactions = genTransactions(kMAX_SEQ - 1, kMIN_SEQ + 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -982,7 +982,7 @@ TEST_F(RPCNFTHistoryHandlerTest, SpecificLedgerHash) TEST_F(RPCNFTHistoryHandlerTest, TxLessThanMinSeq) { auto const transactions = genTransactions(kMAX_SEQ - 1, kMIN_SEQ + 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -1023,7 +1023,7 @@ TEST_F(RPCNFTHistoryHandlerTest, TxLessThanMinSeq) TEST_F(RPCNFTHistoryHandlerTest, TxLargerThanMaxSeq) { auto const transactions = genTransactions(kMAX_SEQ - 1, kMIN_SEQ + 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, @@ -1064,7 +1064,7 @@ TEST_F(RPCNFTHistoryHandlerTest, TxLargerThanMaxSeq) TEST_F(RPCNFTHistoryHandlerTest, LimitMoreThanMax) { auto const transactions = genTransactions(kMIN_SEQ + 1, kMAX_SEQ - 1); - auto const transCursor = TransactionsAndCursor{.txns=transactions, .cursor=TransactionsCursor{12, 34}}; + auto const transCursor = TransactionsAndCursor{.txns = transactions, .cursor = TransactionsCursor{12, 34}}; ON_CALL(*backend_, fetchNFTTransactions).WillByDefault(Return(transCursor)); EXPECT_CALL( *backend_, diff --git a/tests/unit/rpc/handlers/NFTInfoTests.cpp b/tests/unit/rpc/handlers/NFTInfoTests.cpp index 048ec7eed..86410b384 100644 --- a/tests/unit/rpc/handlers/NFTInfoTests.cpp +++ b/tests/unit/rpc/handlers/NFTInfoTests.cpp @@ -167,7 +167,7 @@ TEST_F(RPCNFTInfoHandlerTest, NonExistLedgerViaLedgerHash) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTInfoHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); @@ -191,7 +191,7 @@ TEST_F(RPCNFTInfoHandlerTest, NonExistLedgerViaLedgerStringIndex) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTInfoHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -213,7 +213,7 @@ TEST_F(RPCNFTInfoHandlerTest, NonExistLedgerViaLedgerIntIndex) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTInfoHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -239,7 +239,7 @@ TEST_F(RPCNFTInfoHandlerTest, NonExistLedgerViaLedgerHash2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTInfoHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -262,7 +262,7 @@ TEST_F(RPCNFTInfoHandlerTest, NonExistLedgerViaLedgerIndex2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTInfoHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -289,7 +289,7 @@ TEST_F(RPCNFTInfoHandlerTest, NonExistNFT) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTInfoHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "objectNotFound"); diff --git a/tests/unit/rpc/handlers/NFTSellOffersTests.cpp b/tests/unit/rpc/handlers/NFTSellOffersTests.cpp index 4c3a1efec..da650955d 100644 --- a/tests/unit/rpc/handlers/NFTSellOffersTests.cpp +++ b/tests/unit/rpc/handlers/NFTSellOffersTests.cpp @@ -229,7 +229,7 @@ TEST_F(RPCNFTSellOffersHandlerTest, NonExistLedgerViaLedgerHash) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTSellOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); @@ -253,7 +253,7 @@ TEST_F(RPCNFTSellOffersHandlerTest, NonExistLedgerViaLedgerIndex) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTSellOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -279,7 +279,7 @@ TEST_F(RPCNFTSellOffersHandlerTest, NonExistLedgerViaLedgerHash2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTSellOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -302,7 +302,7 @@ TEST_F(RPCNFTSellOffersHandlerTest, NonExistLedgerViaLedgerIndex2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTSellOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -328,7 +328,7 @@ TEST_F(RPCNFTSellOffersHandlerTest, NoNFT) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTSellOffersHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "objectNotFound"); diff --git a/tests/unit/rpc/handlers/NFTsByIssuerTest.cpp b/tests/unit/rpc/handlers/NFTsByIssuerTest.cpp index 3ff589f0d..9cdf8ce6a 100644 --- a/tests/unit/rpc/handlers/NFTsByIssuerTest.cpp +++ b/tests/unit/rpc/handlers/NFTsByIssuerTest.cpp @@ -225,7 +225,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, NonExistLedgerViaLedgerHash) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTsByIssuerHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); @@ -248,7 +248,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, NonExistLedgerViaLedgerStringIndex) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTsByIssuerHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -269,7 +269,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, NonExistLedgerViaLedgerIntIndex) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTsByIssuerHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -295,7 +295,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, NonExistLedgerViaLedgerHash2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTsByIssuerHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -318,7 +318,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, NonExistLedgerViaLedgerIndex2) )); runSpawn([&, this](boost::asio::yield_context yield) { auto const handler = AnyHandler{NFTsByIssuerHandler{backend_}}; - auto const output = handler.process(input, Context{.yield=std::ref(yield)}); + auto const output = handler.process(input, Context{.yield = std::ref(yield)}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "lgrNotFound"); @@ -345,7 +345,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, AccountNotFound) )); runSpawn([&, this](boost::asio::yield_context yield) { auto handler = AnyHandler{NFTsByIssuerHandler{this->backend_}}; - auto const output = handler.process(input, Context{.yield=yield}); + auto const output = handler.process(input, Context{.yield = yield}); ASSERT_FALSE(output); auto const err = rpc::makeError(output.result.error()); EXPECT_EQ(err.at("error").as_string(), "actNotFound"); @@ -375,7 +375,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, DefaultParameters) std::vector const nfts = {createNft(kNFT_ID1, kACCOUNT, 29)}; auto const account = getAccountIdWithString(kACCOUNT); - ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts=nfts, .cursor={}})); + ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts = nfts, .cursor = {}})); EXPECT_CALL(*backend_, fetchNFTsByIssuer(account, Eq(std::nullopt), Const(30), _, Eq(std::nullopt), _)).Times(1); auto const input = json::parse(fmt::format( @@ -427,7 +427,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, SpecificLedgerIndex) std::vector const nfts = {createNft(kNFT_ID1, kACCOUNT, specificLedger)}; auto const account = getAccountIdWithString(kACCOUNT); - ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts=nfts, .cursor={}})); + ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts = nfts, .cursor = {}})); EXPECT_CALL(*backend_, fetchNFTsByIssuer(account, Eq(std::nullopt), Const(specificLedger), _, Eq(std::nullopt), _)) .Times(1); @@ -469,7 +469,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, TaxonParameter) std::vector const nfts = {createNft(kNFT_ID1, kACCOUNT, 29)}; auto const account = getAccountIdWithString(kACCOUNT); - ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts=nfts, .cursor={}})); + ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts = nfts, .cursor = {}})); EXPECT_CALL(*backend_, fetchNFTsByIssuer(account, Optional(0), Const(30), _, Eq(std::nullopt), _)).Times(1); auto const input = json::parse(fmt::format( @@ -509,7 +509,8 @@ TEST_F(RPCNFTsByIssuerHandlerTest, MarkerParameter) std::vector const nfts = {createNft(kNFT_ID3, kACCOUNT, 29)}; auto const account = getAccountIdWithString(kACCOUNT); - ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts=nfts, .cursor=ripple::uint256{kNFT_ID3}})); + ON_CALL(*backend_, fetchNFTsByIssuer) + .WillByDefault(Return(NFTsAndCursor{.nfts = nfts, .cursor = ripple::uint256{kNFT_ID3}})); EXPECT_CALL(*backend_, fetchNFTsByIssuer(account, _, Const(30), _, Eq(ripple::uint256{kNFT_ID1}), _)).Times(1); auto const input = json::parse(fmt::format( @@ -553,7 +554,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, MultipleNFTs) createNft(kNFT_ID1, kACCOUNT, 29), createNft(kNFT_ID2, kACCOUNT, 29), createNft(kNFT_ID3, kACCOUNT, 29) }; auto const account = getAccountIdWithString(kACCOUNT); - ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts=nfts, .cursor={}})); + ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts = nfts, .cursor = {}})); EXPECT_CALL(*backend_, fetchNFTsByIssuer(account, Eq(std::nullopt), Const(30), _, Eq(std::nullopt), _)).Times(1); auto const input = json::parse(fmt::format( @@ -591,7 +592,7 @@ TEST_F(RPCNFTsByIssuerHandlerTest, LimitMoreThanMax) std::vector const nfts = {createNft(kNFT_ID1, kACCOUNT, 29)}; auto const account = getAccountIdWithString(kACCOUNT); - ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts=nfts, .cursor={}})); + ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts = nfts, .cursor = {}})); EXPECT_CALL( *backend_, fetchNFTsByIssuer(account, Eq(std::nullopt), Const(30), NFTsByIssuerHandler::kLIMIT_MAX, Eq(std::nullopt), _) diff --git a/tests/unit/web/RPCServerHandlerTests.cpp b/tests/unit/web/RPCServerHandlerTests.cpp index 81be80e5f..64d101186 100644 --- a/tests/unit/web/RPCServerHandlerTests.cpp +++ b/tests/unit/web/RPCServerHandlerTests.cpp @@ -855,12 +855,17 @@ auto generateInvalidVersions() { return std::vector{ - {.testName="v0", .version="0", .wsMessage=fmt::format("Requested API version is lower than minimum supported ({})", rpc::kAPI_VERSION_MIN)}, - {.testName="v4", .version="4", .wsMessage=fmt::format("Requested API version is higher than maximum supported ({})", rpc::kAPI_VERSION_MAX)}, - {.testName="null", .version="null", .wsMessage="API version must be an integer"}, - {.testName="str", .version="\"bogus\"", .wsMessage="API version must be an integer"}, - {.testName="bool", .version="false", .wsMessage="API version must be an integer"}, - {.testName="double", .version="12.34", .wsMessage="API version must be an integer"}, + {.testName = "v0", + .version = "0", + .wsMessage = fmt::format("Requested API version is lower than minimum supported ({})", rpc::kAPI_VERSION_MIN)}, + {.testName = "v4", + .version = "4", + .wsMessage = fmt::format("Requested API version is higher than maximum supported ({})", rpc::kAPI_VERSION_MAX) + }, + {.testName = "null", .version = "null", .wsMessage = "API version must be an integer"}, + {.testName = "str", .version = "\"bogus\"", .wsMessage = "API version must be an integer"}, + {.testName = "bool", .version = "false", .wsMessage = "API version must be an integer"}, + {.testName = "double", .version = "12.34", .wsMessage = "API version must be an integer"}, }; } diff --git a/tests/unit/web/ng/impl/ConnectionHandlerTests.cpp b/tests/unit/web/ng/impl/ConnectionHandlerTests.cpp index 6f3fdc7b5..dc66b339f 100644 --- a/tests/unit/web/ng/impl/ConnectionHandlerTests.cpp +++ b/tests/unit/web/ng/impl/ConnectionHandlerTests.cpp @@ -69,13 +69,7 @@ struct ConnectionHandlerTest : SyncAsioContextTest { : tagFactory{util::config::ClioConfigDefinition{ {"log_tag_style", config::ConfigValue{config::ConfigType::String}.defaultValue("uint")} }} - , connectionHandler{ - policy, - maxParallelConnections, - tagFactory, - std::nullopt, - onDisconnectMock.AsStdFunction() - } + , connectionHandler{policy, maxParallelConnections, tagFactory, std::nullopt, onDisconnectMock.AsStdFunction()} { }