From e7dab07e9170bc9e3f3eb99701938faa8988a773 Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Mon, 14 Aug 2023 12:00:26 -0400 Subject: [PATCH] Update URIToken_test.cpp --- src/test/app/URIToken_test.cpp | 43 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/test/app/URIToken_test.cpp b/src/test/app/URIToken_test.cpp index 981ef4fb1..444df7536 100644 --- a/src/test/app/URIToken_test.cpp +++ b/src/test/app/URIToken_test.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -452,10 +453,6 @@ struct URIToken_test : public beast::unit_test::suite IOU const BAD{gw, badCurrency()}; env(sell(alice, id, BAD(10)), ter(temBAD_CURRENCY)); - // temMALFORMED - no destination and 0 value - env(sell(alice, id, USD(0)), ter(temMALFORMED)); - env.close(); - //---------------------------------------------------------------------- // preclaim // tecNO_PERMISSION - invalid account @@ -743,6 +740,26 @@ struct URIToken_test : public beast::unit_test::suite env.close(); BEAST_EXPECT(!inOwnerDir(*env.current(), alice, tid)); } + + // 0 amount and destination + { + Json::Value tx = mint(alice, uri); + tx[jss::Destination] = bob.human(); + tx[jss::Amount] = XRP(0).value().getJson(JsonOptions::none); + // mint + env(tx, txflags(tfBurnable), ter(tesSUCCESS)); + env.close(); + BEAST_EXPECT(inOwnerDir(*env.current(), alice, tid)); + // buy + env(buy(bob, hexid, XRP(0))); + env.close(); + BEAST_EXPECT(inOwnerDir(*env.current(), bob, tid)); + // cleanup + env(burn(bob, hexid)); + env.close(); + BEAST_EXPECT(!inOwnerDir(*env.current(), bob, tid)); + } + // has amount and destination { Json::Value tx = mint(alice, uri); @@ -761,6 +778,24 @@ struct URIToken_test : public beast::unit_test::suite env.close(); BEAST_EXPECT(!inOwnerDir(*env.current(), bob, tid)); } + + // has amount and no destination + { + Json::Value tx = mint(alice, uri); + tx[jss::Amount] = XRP(10).value().getJson(JsonOptions::none); + // mint + env(tx, txflags(tfBurnable), ter(tesSUCCESS)); + env.close(); + BEAST_EXPECT(inOwnerDir(*env.current(), alice, tid)); + // buy + env(buy(bob, hexid, XRP(10))); + env.close(); + BEAST_EXPECT(inOwnerDir(*env.current(), bob, tid)); + // cleanup + env(burn(bob, hexid)); + env.close(); + BEAST_EXPECT(!inOwnerDir(*env.current(), bob, tid)); + } } void