mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add JsonOptions enum class to contain options passed to getJSON methods
This commit is contained in:
@@ -97,8 +97,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
USD(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
XRP(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -165,9 +167,9 @@ public:
|
||||
BEAST_EXPECT(jv[jss::result].isMember(jss::offers) &&
|
||||
jv[jss::result][jss::offers].size() == 1);
|
||||
BEAST_EXPECT(jv[jss::result][jss::offers][0u][jss::TakerGets] ==
|
||||
XRP(200).value().getJson(0));
|
||||
XRP(200).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::offers][0u][jss::TakerPays] ==
|
||||
USD(100).value().getJson(0));
|
||||
USD(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(! jv[jss::result].isMember(jss::asks));
|
||||
BEAST_EXPECT(! jv[jss::result].isMember(jss::bids));
|
||||
}
|
||||
@@ -184,8 +186,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
USD(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
XRP(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -260,8 +264,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
USD(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
XRP(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -277,8 +283,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(0) &&
|
||||
t[jss::TakerPays] == USD(100).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
XRP(75).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
USD(100).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -340,13 +348,13 @@ public:
|
||||
BEAST_EXPECT(jv[jss::result].isMember(jss::bids) &&
|
||||
jv[jss::result][jss::bids].size() == 1);
|
||||
BEAST_EXPECT(jv[jss::result][jss::asks][0u][jss::TakerGets] ==
|
||||
USD(100).value().getJson(0));
|
||||
USD(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::asks][0u][jss::TakerPays] ==
|
||||
XRP(500).value().getJson(0));
|
||||
XRP(500).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::bids][0u][jss::TakerGets] ==
|
||||
XRP(200).value().getJson(0));
|
||||
XRP(200).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::bids][0u][jss::TakerPays] ==
|
||||
USD(100).value().getJson(0));
|
||||
USD(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(! jv[jss::result].isMember(jss::offers));
|
||||
}
|
||||
|
||||
@@ -362,8 +370,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
USD(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
XRP(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -379,8 +389,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(0) &&
|
||||
t[jss::TakerPays] == USD(100).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
XRP(75).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
USD(100).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -455,8 +467,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
USD(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
XRP(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -480,8 +494,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == JPY(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == CNY(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
JPY(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
CNY(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -566,13 +582,13 @@ public:
|
||||
BEAST_EXPECT(jv[jss::result].isMember(jss::offers) &&
|
||||
jv[jss::result][jss::offers].size() == 2);
|
||||
BEAST_EXPECT(jv[jss::result][jss::offers][0u][jss::TakerGets] ==
|
||||
XRP(200).value().getJson(0));
|
||||
XRP(200).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::offers][0u][jss::TakerPays] ==
|
||||
USD(100).value().getJson(0));
|
||||
USD(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::offers][1u][jss::TakerGets] ==
|
||||
CNY(200).value().getJson(0));
|
||||
CNY(200).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::offers][1u][jss::TakerPays] ==
|
||||
JPY(100).value().getJson(0));
|
||||
JPY(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(! jv[jss::result].isMember(jss::asks));
|
||||
BEAST_EXPECT(! jv[jss::result].isMember(jss::bids));
|
||||
}
|
||||
@@ -589,8 +605,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
USD(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
XRP(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -614,8 +632,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == JPY(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == CNY(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
JPY(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
CNY(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -701,8 +721,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
USD(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
XRP(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -718,8 +740,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(0) &&
|
||||
t[jss::TakerPays] == USD(100).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
XRP(75).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
USD(100).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -735,8 +759,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == JPY(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == CNY(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
JPY(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
CNY(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -752,8 +778,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == CNY(75).value().getJson(0) &&
|
||||
t[jss::TakerPays] == JPY(100).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
CNY(75).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
JPY(100).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -835,21 +863,21 @@ public:
|
||||
BEAST_EXPECT(jv[jss::result].isMember(jss::bids) &&
|
||||
jv[jss::result][jss::bids].size() == 2);
|
||||
BEAST_EXPECT(jv[jss::result][jss::asks][0u][jss::TakerGets] ==
|
||||
USD(100).value().getJson(0));
|
||||
USD(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::asks][0u][jss::TakerPays] ==
|
||||
XRP(500).value().getJson(0));
|
||||
XRP(500).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::asks][1u][jss::TakerGets] ==
|
||||
JPY(100).value().getJson(0));
|
||||
JPY(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::asks][1u][jss::TakerPays] ==
|
||||
CNY(500).value().getJson(0));
|
||||
CNY(500).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::bids][0u][jss::TakerGets] ==
|
||||
XRP(200).value().getJson(0));
|
||||
XRP(200).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::bids][0u][jss::TakerPays] ==
|
||||
USD(100).value().getJson(0));
|
||||
USD(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::bids][1u][jss::TakerGets] ==
|
||||
CNY(200).value().getJson(0));
|
||||
CNY(200).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jv[jss::result][jss::bids][1u][jss::TakerPays] ==
|
||||
JPY(100).value().getJson(0));
|
||||
JPY(100).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(! jv[jss::result].isMember(jss::offers));
|
||||
}
|
||||
|
||||
@@ -865,8 +893,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
USD(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
XRP(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -882,8 +912,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(0) &&
|
||||
t[jss::TakerPays] == USD(100).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
XRP(75).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
USD(100).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -899,8 +931,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == JPY(100).value().getJson(0) &&
|
||||
t[jss::TakerPays] == CNY(700).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
JPY(100).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
CNY(700).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -916,8 +950,10 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == CNY(75).value().getJson(0) &&
|
||||
t[jss::TakerPays] == JPY(100).value().getJson(0);
|
||||
t[jss::TakerGets] ==
|
||||
CNY(75).value().getJson(JsonOptions::none) &&
|
||||
t[jss::TakerPays] ==
|
||||
JPY(100).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1008,8 +1044,10 @@ public:
|
||||
BEAST_EXPECT(jrOffer[sfLedgerEntryType.fieldName] == jss::Offer);
|
||||
BEAST_EXPECT(jrOffer[sfOwnerNode.fieldName] == "0000000000000000");
|
||||
BEAST_EXPECT(jrOffer[sfSequence.fieldName] == 3);
|
||||
BEAST_EXPECT(jrOffer[jss::TakerGets] == USD(10).value().getJson(0));
|
||||
BEAST_EXPECT(jrOffer[jss::TakerPays] == XRP(4000).value().getJson(0));
|
||||
BEAST_EXPECT(jrOffer[jss::TakerGets] ==
|
||||
USD(10).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jrOffer[jss::TakerPays] ==
|
||||
XRP(4000).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jrOffer[jss::owner_funds] == "100");
|
||||
BEAST_EXPECT(jrOffer[jss::quality] == "400000000");
|
||||
|
||||
@@ -1019,9 +1057,11 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(10).value().getJson(0) &&
|
||||
t[jss::TakerGets] ==
|
||||
USD(10).value().getJson(JsonOptions::none) &&
|
||||
t[jss::owner_funds] == "100" &&
|
||||
t[jss::TakerPays] == XRP(4000).value().getJson(0);
|
||||
t[jss::TakerPays] ==
|
||||
XRP(4000).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
|
||||
env(offer(bob, XRP(2000), USD(5)));
|
||||
@@ -1032,9 +1072,11 @@ public:
|
||||
{
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == USD(5).value().getJson(0) &&
|
||||
t[jss::TakerGets] ==
|
||||
USD(5).value().getJson(JsonOptions::none) &&
|
||||
t[jss::owner_funds] == "50" &&
|
||||
t[jss::TakerPays] == XRP(2000).value().getJson(0);
|
||||
t[jss::TakerPays] ==
|
||||
XRP(2000).value().getJson(JsonOptions::none);
|
||||
}));
|
||||
|
||||
jv = wsc->invoke("book_offers", jvParams);
|
||||
@@ -1057,8 +1099,10 @@ public:
|
||||
BEAST_EXPECT(jrNextOffer[sfLedgerEntryType.fieldName] == jss::Offer);
|
||||
BEAST_EXPECT(jrNextOffer[sfOwnerNode.fieldName] == "0000000000000000");
|
||||
BEAST_EXPECT(jrNextOffer[sfSequence.fieldName] == 3);
|
||||
BEAST_EXPECT(jrNextOffer[jss::TakerGets] == USD(5).value().getJson(0));
|
||||
BEAST_EXPECT(jrNextOffer[jss::TakerPays] == XRP(2000).value().getJson(0));
|
||||
BEAST_EXPECT(jrNextOffer[jss::TakerGets] ==
|
||||
USD(5).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jrNextOffer[jss::TakerPays] ==
|
||||
XRP(2000).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(jrNextOffer[jss::owner_funds] == "50");
|
||||
BEAST_EXPECT(jrNextOffer[jss::quality] == "400000000");
|
||||
|
||||
@@ -1090,8 +1134,8 @@ public:
|
||||
return false;
|
||||
auto const& t = (*maybeJv)[jss::transaction];
|
||||
if (t[jss::TransactionType] != jss::OfferCreate ||
|
||||
t[jss::TakerGets] != takerGets.value().getJson(0) ||
|
||||
t[jss::TakerPays] != takerPays.value().getJson(0))
|
||||
t[jss::TakerGets] != takerGets.value().getJson(JsonOptions::none) ||
|
||||
t[jss::TakerPays] != takerPays.value().getJson(JsonOptions::none))
|
||||
return false;
|
||||
// Make sure no other message is waiting
|
||||
return wsc->getMsg(timeout) == boost::none;
|
||||
|
||||
Reference in New Issue
Block a user