mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
#include "rpc/common/JsonBool.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
@@ -37,16 +38,6 @@ struct JsonBoolTestsCaseBundle {
|
||||
|
||||
class JsonBoolTests : public TestWithParam<JsonBoolTestsCaseBundle> {
|
||||
public:
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<JsonBoolTestsCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
{
|
||||
@@ -72,7 +63,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
JsonBoolCheckGroup,
|
||||
JsonBoolTests,
|
||||
ValuesIn(JsonBoolTests::generateTestValuesForParametersTest()),
|
||||
JsonBoolTests::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(JsonBoolTests, Parse)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/AMMInfo.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -66,15 +67,7 @@ struct AMMInfoParamTestCaseBundle {
|
||||
std::string expectedErrorMessage;
|
||||
};
|
||||
|
||||
struct AMMInfoParameterTest : public RPCAMMInfoHandlerTest, public WithParamInterface<AMMInfoParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
std::string
|
||||
operator()(auto const& info) const
|
||||
{
|
||||
return static_cast<AMMInfoParamTestCaseBundle>(info.param).testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct AMMInfoParameterTest : public RPCAMMInfoHandlerTest, public WithParamInterface<AMMInfoParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -106,7 +99,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAMMInfoGroup1,
|
||||
AMMInfoParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
AMMInfoParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(AMMInfoParameterTest, InvalidParams)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/AccountInfo.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -62,17 +63,7 @@ struct AccountInfoParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct AccountInfoParameterTest : public RPCAccountInfoHandlerTest,
|
||||
public WithParamInterface<AccountInfoParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<AccountInfoParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<AccountInfoParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -114,7 +105,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAccountInfoGroup1,
|
||||
AccountInfoParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
AccountInfoParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(AccountInfoParameterTest, InvalidParams)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/AccountNFTs.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -66,17 +67,7 @@ struct AccountNFTParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct AccountNFTParameterTest : public RPCAccountNFTsHandlerTest,
|
||||
public WithParamInterface<AccountNFTParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<AccountNFTParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<AccountNFTParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -155,7 +146,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAccountNFTsGroup1,
|
||||
AccountNFTParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
AccountNFTParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(AccountNFTParameterTest, InvalidParams)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/AccountObjects.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -71,17 +72,7 @@ struct AccountObjectsParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct AccountObjectsParameterTest : public RPCAccountObjectsHandlerTest,
|
||||
public WithParamInterface<AccountObjectsParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<AccountObjectsParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<AccountObjectsParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -180,7 +171,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAccountObjectsGroup1,
|
||||
AccountObjectsParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
AccountObjectsParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(AccountObjectsParameterTest, InvalidParams)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/AccountOffers.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -62,17 +63,7 @@ struct AccountOfferParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct AccountOfferParameterTest : public RPCAccountOffersHandlerTest,
|
||||
public WithParamInterface<AccountOfferParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<AccountOfferParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<AccountOfferParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -151,7 +142,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAccountOffersGroup1,
|
||||
AccountOfferParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
AccountOfferParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(AccountOfferParameterTest, InvalidParams)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/AccountTx.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -63,15 +64,6 @@ struct AccountTxParamTestCaseBundle {
|
||||
// parameterized test cases for parameters check
|
||||
struct AccountTxParameterTest : public RPCAccountTxHandlerTest,
|
||||
public WithParamInterface<AccountTxParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
return info.param.testName;
|
||||
}
|
||||
};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
{
|
||||
@@ -401,7 +393,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAccountTxGroup1,
|
||||
AccountTxParameterTest,
|
||||
ValuesIn(AccountTxParameterTest::generateTestValuesForParametersTest()),
|
||||
AccountTxParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(AccountTxParameterTest, CheckParams)
|
||||
@@ -1564,17 +1556,7 @@ struct AccountTxTransactionBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct AccountTxTransactionTypeTest : public RPCAccountTxHandlerTest,
|
||||
public WithParamInterface<AccountTxTransactionBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<AccountTxTransactionBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<AccountTxTransactionBundle> {};
|
||||
|
||||
static auto
|
||||
generateTransactionTypeTestValues()
|
||||
@@ -2049,7 +2031,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAccountTxTransactionTypeTest,
|
||||
AccountTxTransactionTypeTest,
|
||||
ValuesIn(generateTransactionTypeTestValues()),
|
||||
AccountTxTransactionTypeTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(AccountTxTransactionTypeTest, SpecificTransactionType)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/BookChanges.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -60,17 +61,7 @@ struct BookChangesParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct BookChangesParameterTest : public RPCBookChangesHandlerTest,
|
||||
public WithParamInterface<BookChangesParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<BookChangesParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<BookChangesParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -92,7 +83,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCBookChangesGroup1,
|
||||
BookChangesParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
BookChangesParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(BookChangesParameterTest, InvalidParams)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/BookOffers.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/asio/spawn.hpp>
|
||||
@@ -75,17 +76,7 @@ struct ParameterTestBundle {
|
||||
std::string expectedErrorMessage;
|
||||
};
|
||||
|
||||
struct RPCBookOffersParameterTest : public RPCBookOffersHandlerTest, public WithParamInterface<ParameterTestBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<ParameterTestBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct RPCBookOffersParameterTest : public RPCBookOffersHandlerTest, public WithParamInterface<ParameterTestBundle> {};
|
||||
|
||||
TEST_P(RPCBookOffersParameterTest, CheckError)
|
||||
{
|
||||
@@ -497,7 +488,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
RPCBookOffersHandler,
|
||||
RPCBookOffersParameterTest,
|
||||
testing::ValuesIn(generateParameterBookOffersTestBundles()),
|
||||
RPCBookOffersParameterTest::NameGenerator()
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
struct BookOffersNormalTestBundle {
|
||||
@@ -511,17 +502,7 @@ struct BookOffersNormalTestBundle {
|
||||
};
|
||||
|
||||
struct RPCBookOffersNormalPathTest : public RPCBookOffersHandlerTest,
|
||||
public WithParamInterface<BookOffersNormalTestBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<BookOffersNormalTestBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<BookOffersNormalTestBundle> {};
|
||||
|
||||
TEST_P(RPCBookOffersNormalPathTest, CheckOutput)
|
||||
{
|
||||
@@ -1172,7 +1153,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
RPCBookOffersHandler,
|
||||
RPCBookOffersNormalPathTest,
|
||||
testing::ValuesIn(generateNormalPathBookOffersTestBundles()),
|
||||
RPCBookOffersNormalPathTest::NameGenerator()
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
// ledger not exist
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/DepositAuthorized.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -61,17 +62,7 @@ struct DepositAuthorizedTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct DepositAuthorizedParameterTest : public RPCDepositAuthorizedTest,
|
||||
public WithParamInterface<DepositAuthorizedTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<DepositAuthorizedTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<DepositAuthorizedTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -172,7 +163,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCDepositAuthorizedGroup,
|
||||
DepositAuthorizedParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
DepositAuthorizedParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(DepositAuthorizedParameterTest, InvalidParams)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/GatewayBalances.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -66,17 +67,7 @@ struct ParameterTestBundle {
|
||||
std::string expectedErrorMessage;
|
||||
};
|
||||
|
||||
struct ParameterTest : public RPCGatewayBalancesHandlerTest, public WithParamInterface<ParameterTestBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<ParameterTestBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct ParameterTest : public RPCGatewayBalancesHandlerTest, public WithParamInterface<ParameterTestBundle> {};
|
||||
|
||||
TEST_P(ParameterTest, CheckError)
|
||||
{
|
||||
@@ -209,7 +200,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
RPCGatewayBalancesHandler,
|
||||
ParameterTest,
|
||||
testing::ValuesIn(generateParameterTestBundles()),
|
||||
ParameterTest::NameGenerator()
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_F(RPCGatewayBalancesHandlerTest, LedgerNotFoundViaStringIndex)
|
||||
@@ -387,17 +378,7 @@ struct NormalTestBundle {
|
||||
std::string hotwallet;
|
||||
};
|
||||
|
||||
struct NormalPathTest : public RPCGatewayBalancesHandlerTest, public WithParamInterface<NormalTestBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<NormalTestBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct NormalPathTest : public RPCGatewayBalancesHandlerTest, public WithParamInterface<NormalTestBundle> {};
|
||||
|
||||
TEST_P(NormalPathTest, CheckOutput)
|
||||
{
|
||||
@@ -661,5 +642,5 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
RPCGatewayBalancesHandler,
|
||||
NormalPathTest,
|
||||
testing::ValuesIn(generateNormalPathTestBundles()),
|
||||
NormalPathTest::NameGenerator()
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/handlers/GetAggregatePrice.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/MockBackend.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/object.hpp>
|
||||
@@ -104,17 +105,7 @@ struct GetAggregatePriceParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct GetAggregatePriceParameterTest : public RPCGetAggregatePriceHandlerTest,
|
||||
public WithParamInterface<GetAggregatePriceParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<GetAggregatePriceParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<GetAggregatePriceParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -315,7 +306,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCGetAggregatePriceGroup1,
|
||||
GetAggregatePriceParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
GetAggregatePriceParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(GetAggregatePriceParameterTest, InvalidParams)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/LedgerData.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -62,17 +63,7 @@ struct LedgerDataParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct LedgerDataParameterTest : public RPCLedgerDataHandlerTest,
|
||||
public WithParamInterface<LedgerDataParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<LedgerDataParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<LedgerDataParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -113,7 +104,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCLedgerDataGroup1,
|
||||
LedgerDataParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
LedgerDataParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(LedgerDataParameterTest, InvalidParams)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/LedgerEntry.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -71,17 +72,7 @@ struct ParamTestCaseBundle {
|
||||
};
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct LedgerEntryParameterTest : public RPCLedgerEntryTest, public WithParamInterface<ParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<ParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct LedgerEntryParameterTest : public RPCLedgerEntryTest, public WithParamInterface<ParamTestCaseBundle> {};
|
||||
|
||||
// TODO: because we extract the error generation from the handler to framework
|
||||
// the error messages need one round fine tuning
|
||||
@@ -1770,7 +1761,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCLedgerEntryGroup1,
|
||||
LedgerEntryParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
LedgerEntryParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(LedgerEntryParameterTest, InvalidParams)
|
||||
@@ -1881,17 +1872,7 @@ struct NormalPathTestBundle {
|
||||
ripple::STObject mockedEntity;
|
||||
};
|
||||
|
||||
struct RPCLedgerEntryNormalPathTest : public RPCLedgerEntryTest, public WithParamInterface<NormalPathTestBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<NormalPathTestBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct RPCLedgerEntryNormalPathTest : public RPCLedgerEntryTest, public WithParamInterface<NormalPathTestBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForNormalPathTest()
|
||||
@@ -2391,7 +2372,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCLedgerEntryGroup2,
|
||||
RPCLedgerEntryNormalPathTest,
|
||||
ValuesIn(generateTestValuesForNormalPathTest()),
|
||||
RPCLedgerEntryNormalPathTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
// Test for normal path
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/Ledger.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -68,17 +69,7 @@ struct LedgerParamTestCaseBundle {
|
||||
};
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct LedgerParameterTest : public RPCLedgerHandlerTest, public WithParamInterface<LedgerParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<LedgerParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct LedgerParameterTest : public RPCLedgerHandlerTest, public WithParamInterface<LedgerParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -175,7 +166,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCLedgerGroup1,
|
||||
LedgerParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
LedgerParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(LedgerParameterTest, InvalidParams)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/NFTHistory.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -59,17 +60,7 @@ struct NFTHistoryParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct NFTHistoryParameterTest : public RPCNFTHistoryHandlerTest,
|
||||
public WithParamInterface<NFTHistoryParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<NFTHistoryParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<NFTHistoryParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -232,7 +223,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCNFTHistoryGroup1,
|
||||
NFTHistoryParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
NFTHistoryParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(NFTHistoryParameterTest, InvalidParams)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "rpc/handlers/NoRippleCheck.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -60,17 +61,7 @@ struct NoRippleParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct NoRippleCheckParameterTest : public RPCNoRippleCheckTest,
|
||||
public WithParamInterface<NoRippleParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<NoRippleParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<NoRippleParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -166,7 +157,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCNoRippleCheckGroup1,
|
||||
NoRippleCheckParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
NoRippleCheckParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(NoRippleCheckParameterTest, InvalidParams)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "rpc/handlers/Subscribe.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/MockWsBase.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/TestObject.hpp"
|
||||
#include "web/interface/ConnectionBase.hpp"
|
||||
|
||||
@@ -91,17 +92,7 @@ struct SubscribeParamTestCaseBundle {
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct SubscribeParameterTest : public RPCSubscribeHandlerTest,
|
||||
public WithParamInterface<SubscribeParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<SubscribeParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
public WithParamInterface<SubscribeParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -577,7 +568,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCSubscribe,
|
||||
SubscribeParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
SubscribeParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(SubscribeParameterTest, InvalidParams)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/MockSubscriptionManager.hpp"
|
||||
#include "util/MockWsBase.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "web/interface/ConnectionBase.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
@@ -73,17 +74,8 @@ struct UnsubscribeParamTestCaseBundle {
|
||||
};
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct UnsubscribeParameterTest : public RPCUnsubscribeTest, public WithParamInterface<UnsubscribeParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<UnsubscribeParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct UnsubscribeParameterTest : public RPCUnsubscribeTest,
|
||||
public WithParamInterface<UnsubscribeParamTestCaseBundle> {};
|
||||
|
||||
static auto
|
||||
generateTestValuesForParametersTest()
|
||||
@@ -519,7 +511,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCUnsubscribe,
|
||||
UnsubscribeParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
UnsubscribeParameterTest::NameGenerator{}
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
TEST_P(UnsubscribeParameterTest, InvalidParams)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
#include "util/MockPrometheus.hpp"
|
||||
#include "util/NameGenerator.hpp"
|
||||
#include "util/config/Config.hpp"
|
||||
#include "util/prometheus/Http.hpp"
|
||||
#include "util/prometheus/Label.hpp"
|
||||
@@ -46,17 +47,7 @@ struct PrometheusCheckRequestTestsParams {
|
||||
bool expected;
|
||||
};
|
||||
|
||||
struct PrometheusCheckRequestTests : public ::testing::TestWithParam<PrometheusCheckRequestTestsParams> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<PrometheusCheckRequestTestsParams>(info.param);
|
||||
return bundle.testName;
|
||||
}
|
||||
};
|
||||
};
|
||||
struct PrometheusCheckRequestTests : public ::testing::TestWithParam<PrometheusCheckRequestTestsParams> {};
|
||||
|
||||
TEST_P(PrometheusCheckRequestTests, isPrometheusRequest)
|
||||
{
|
||||
@@ -113,7 +104,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
.expected = false
|
||||
},
|
||||
}),
|
||||
PrometheusCheckRequestTests::NameGenerator()
|
||||
tests::util::NameGenerator
|
||||
);
|
||||
|
||||
struct PrometheusHandleRequestTests : util::prometheus::WithPrometheus {
|
||||
|
||||
Reference in New Issue
Block a user