mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4
This commit is contained in:
@@ -353,7 +353,9 @@ parseUint32(
|
||||
else
|
||||
{
|
||||
ret = detail::make_stvar<STResult>(
|
||||
field, beast::lexicalCastThrow<Integer>(value.asString()));
|
||||
field,
|
||||
safe_cast<typename STResult::value_type>(
|
||||
beast::lexicalCastThrow<Integer>(value.asString())));
|
||||
}
|
||||
}
|
||||
if (!ret)
|
||||
|
||||
@@ -140,6 +140,30 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::string const goodJson(
|
||||
R"({"CloseResolution":"19","Method":"250",)"
|
||||
R"("TransactionResult":"tecFROZEN"})");
|
||||
std::string const expectedJson(
|
||||
R"({"CloseResolution":19,"Method":250,)"
|
||||
R"("TransactionResult":"tecFROZEN"})");
|
||||
|
||||
Json::Value jv;
|
||||
if (BEAST_EXPECT(parseJSONString(goodJson, jv)))
|
||||
{
|
||||
// Integer values are always parsed as int,
|
||||
// unless they're too big. We want a small uint.
|
||||
jv["CloseResolution"] = Json::UInt(19);
|
||||
STParsedJSONObject parsed("test", jv);
|
||||
if (BEAST_EXPECT(parsed.object))
|
||||
{
|
||||
std::string const& serialized(
|
||||
to_string(parsed.object->getJson(JsonOptions::none)));
|
||||
BEAST_EXPECT(serialized == expectedJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::string const json(R"({"CloseResolution":19,"Method":250,)"
|
||||
R"("TransactionResult":"terQUEUED"})");
|
||||
@@ -227,6 +251,26 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::string const goodJson(R"({"CloseResolution":19,"Method":250,)"
|
||||
R"("TransferFee":"65535"})");
|
||||
std::string const expectedJson(
|
||||
R"({"CloseResolution":19,"Method":250,)"
|
||||
R"("TransferFee":65535})");
|
||||
|
||||
Json::Value jv;
|
||||
if (BEAST_EXPECT(parseJSONString(goodJson, jv)))
|
||||
{
|
||||
STParsedJSONObject parsed("test", jv);
|
||||
if (BEAST_EXPECT(parsed.object))
|
||||
{
|
||||
std::string const& serialized(
|
||||
to_string(parsed.object->getJson(JsonOptions::none)));
|
||||
BEAST_EXPECT(serialized == expectedJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::string const json(R"({"CloseResolution":19,"Method":250,)"
|
||||
R"("TransferFee":"65536"})");
|
||||
|
||||
Reference in New Issue
Block a user