mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
add features parameters to paychan tests
This commit is contained in:
@@ -2136,12 +2136,12 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICSimple()
|
testICSimple(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("ic simple");
|
testcase("ic simple");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
// <- setup tests
|
// <- setup tests
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
@@ -2308,7 +2308,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICCancelAfter()
|
testICCancelAfter(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("ic cancel after");
|
testcase("ic cancel after");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
@@ -2321,7 +2321,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
{
|
{
|
||||||
// If dst claims after cancel after, channel closes
|
// If dst claims after cancel after, channel closes
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
env.fund(XRP(10000), alice, bob, gw);
|
env.fund(XRP(10000), alice, bob, gw);
|
||||||
env.trust(USD(100000), alice, bob);
|
env.trust(USD(100000), alice, bob);
|
||||||
env(pay(gw, alice, USD(10000)));
|
env(pay(gw, alice, USD(10000)));
|
||||||
@@ -2364,7 +2364,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
// Third party can close after cancel after
|
// Third party can close after cancel after
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
env.fund(XRP(10000), alice, bob, carol, gw);
|
env.fund(XRP(10000), alice, bob, carol, gw);
|
||||||
env.trust(USD(100000), alice, bob, carol);
|
env.trust(USD(100000), alice, bob, carol);
|
||||||
env(pay(gw, alice, USD(10000)));
|
env(pay(gw, alice, USD(10000)));
|
||||||
@@ -2389,12 +2389,12 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICExpiration()
|
testICExpiration(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("ic expiration");
|
testcase("ic expiration");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
auto const carol = Account("carol");
|
auto const carol = Account("carol");
|
||||||
@@ -2463,12 +2463,12 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICSettleDelay()
|
testICSettleDelay(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("ic settle delay");
|
testcase("ic settle delay");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
auto const gw = Account{"gateway"};
|
auto const gw = Account{"gateway"};
|
||||||
@@ -2531,12 +2531,12 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICCloseDry()
|
testICCloseDry(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("ic close dry");
|
testcase("ic close dry");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
auto const gw = Account{"gateway"};
|
auto const gw = Account{"gateway"};
|
||||||
@@ -2573,13 +2573,13 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICDefaultAmount()
|
testICDefaultAmount(FeatureBitset features)
|
||||||
{
|
{
|
||||||
// auth amount defaults to balance if not present
|
// auth amount defaults to balance if not present
|
||||||
testcase("ic default amount");
|
testcase("ic default amount");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
auto const gw = Account{"gateway"};
|
auto const gw = Account{"gateway"};
|
||||||
@@ -2637,7 +2637,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICDisallowXRP()
|
testICDisallowXRP(FeatureBitset features)
|
||||||
{
|
{
|
||||||
// auth amount defaults to balance if not present
|
// auth amount defaults to balance if not present
|
||||||
testcase("Disallow XRP");
|
testcase("Disallow XRP");
|
||||||
@@ -2659,7 +2659,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
{
|
{
|
||||||
// Create a channel where dst disallows XRP. Ignore that flag,
|
// Create a channel where dst disallows XRP. Ignore that flag,
|
||||||
// since it's just advisory.
|
// since it's just advisory.
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
env.fund(XRP(10000), alice, bob);
|
env.fund(XRP(10000), alice, bob);
|
||||||
env(fset(bob, asfDisallowXRP));
|
env(fset(bob, asfDisallowXRP));
|
||||||
auto const chan = channel(alice, bob, env.seq(alice));
|
auto const chan = channel(alice, bob, env.seq(alice));
|
||||||
@@ -2684,7 +2684,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
// Claim to a channel where dst disallows XRP (channel is
|
// Claim to a channel where dst disallows XRP (channel is
|
||||||
// created before disallow xrp is set). Ignore that flag
|
// created before disallow xrp is set). Ignore that flag
|
||||||
// since it is just advisory.
|
// since it is just advisory.
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
env.fund(XRP(10000), alice, bob);
|
env.fund(XRP(10000), alice, bob);
|
||||||
auto const chan = channel(alice, bob, env.seq(alice));
|
auto const chan = channel(alice, bob, env.seq(alice));
|
||||||
env(create(alice, bob, XRP(1000), 3600s, alice.pk()));
|
env(create(alice, bob, XRP(1000), 3600s, alice.pk()));
|
||||||
@@ -2697,14 +2697,14 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICDstTag()
|
testICDstTag(FeatureBitset features)
|
||||||
{
|
{
|
||||||
// auth amount defaults to balance if not present
|
// auth amount defaults to balance if not present
|
||||||
testcase("Dst Tag");
|
testcase("Dst Tag");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
// Create a channel where dst disallows XRP
|
// Create a channel where dst disallows XRP
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
env.fund(XRP(10000), alice, bob);
|
env.fund(XRP(10000), alice, bob);
|
||||||
@@ -2727,7 +2727,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICDepositAuth()
|
testICDepositAuth(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("Deposit Authorization");
|
testcase("Deposit Authorization");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
@@ -2737,7 +2737,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
auto const carol = Account("carol");
|
auto const carol = Account("carol");
|
||||||
{
|
{
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
env.fund(XRP(10000), alice, bob, carol);
|
env.fund(XRP(10000), alice, bob, carol);
|
||||||
|
|
||||||
env(fset(bob, asfDepositAuth));
|
env(fset(bob, asfDepositAuth));
|
||||||
@@ -2850,13 +2850,13 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICMultiple()
|
testICMultiple(FeatureBitset features)
|
||||||
{
|
{
|
||||||
// auth amount defaults to balance if not present
|
// auth amount defaults to balance if not present
|
||||||
testcase("Multiple channels to the same account");
|
testcase("Multiple channels to the same account");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
env.fund(XRP(10000), alice, bob);
|
env.fund(XRP(10000), alice, bob);
|
||||||
@@ -2873,13 +2873,13 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICAccountChannelsRPC()
|
testICAccountChannelsRPC(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("AccountChannels RPC");
|
testcase("AccountChannels RPC");
|
||||||
|
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
auto const charlie = Account("charlie", KeyType::ed25519);
|
auto const charlie = Account("charlie", KeyType::ed25519);
|
||||||
@@ -2928,7 +2928,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICAccountChannelsRPCMarkers()
|
testICAccountChannelsRPCMarkers(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("Account channels RPC markers");
|
testcase("Account channels RPC markers");
|
||||||
|
|
||||||
@@ -2947,7 +2947,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
return r;
|
return r;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
env.fund(XRP(10000), alice);
|
env.fund(XRP(10000), alice);
|
||||||
for (auto const& a : bobs)
|
for (auto const& a : bobs)
|
||||||
{
|
{
|
||||||
@@ -3044,7 +3044,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICAccountChannelsRPCSenderOnly()
|
testICAccountChannelsRPCSenderOnly(FeatureBitset features)
|
||||||
{
|
{
|
||||||
// Check that the account_channels command only returns channels owned
|
// Check that the account_channels command only returns channels owned
|
||||||
// by the account
|
// by the account
|
||||||
@@ -3055,7 +3055,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
env.fund(XRP(10000), alice, bob);
|
env.fund(XRP(10000), alice, bob);
|
||||||
|
|
||||||
// Create a channel from alice to bob and from bob to alice
|
// Create a channel from alice to bob and from bob to alice
|
||||||
@@ -3081,12 +3081,12 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICAuthVerifyRPC()
|
testICAuthVerifyRPC(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("PayChan Auth/Verify RPC");
|
testcase("PayChan Auth/Verify RPC");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
auto const charlie = Account("charlie", KeyType::ed25519);
|
auto const charlie = Account("charlie", KeyType::ed25519);
|
||||||
@@ -3421,12 +3421,12 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICOptionalFields()
|
testICOptionalFields(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("Optional Fields");
|
testcase("Optional Fields");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
auto const carol = Account("carol");
|
auto const carol = Account("carol");
|
||||||
@@ -3472,12 +3472,12 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICMalformedPK()
|
testICMalformedPK(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("malformed pk");
|
testcase("malformed pk");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
env.fund(XRP(10000), alice, bob);
|
env.fund(XRP(10000), alice, bob);
|
||||||
@@ -3541,7 +3541,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICMetaAndOwnership()
|
testICMetaAndOwnership(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("Metadata & Ownership");
|
testcase("Metadata & Ownership");
|
||||||
|
|
||||||
@@ -3592,7 +3592,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Test with adding the paychan to the recipient's owner directory
|
// Test with adding the paychan to the recipient's owner directory
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
env.fund(XRP(10000), alice, bob);
|
env.fund(XRP(10000), alice, bob);
|
||||||
env(create(alice, bob, XRP(1000), settleDelay, pk));
|
env(create(alice, bob, XRP(1000), settleDelay, pk));
|
||||||
env.close();
|
env.close();
|
||||||
@@ -3649,7 +3649,7 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICAccountDelete()
|
testICAccountDelete(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("Account Delete");
|
testcase("Account Delete");
|
||||||
using namespace test::jtx;
|
using namespace test::jtx;
|
||||||
@@ -3883,12 +3883,12 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testICUsingTickets()
|
testICUsingTickets(FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase("using tickets");
|
testcase("using tickets");
|
||||||
using namespace jtx;
|
using namespace jtx;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
Env env(*this);
|
Env env(*this, features);
|
||||||
auto const alice = Account("alice");
|
auto const alice = Account("alice");
|
||||||
auto const bob = Account("bob");
|
auto const bob = Account("bob");
|
||||||
env.fund(XRP(10000), alice, bob);
|
env.fund(XRP(10000), alice, bob);
|
||||||
@@ -4043,48 +4043,57 @@ struct PayChan_test : public beast::unit_test::suite
|
|||||||
BEAST_EXPECT(env.seq(bob) == bobSeq);
|
BEAST_EXPECT(env.seq(bob) == bobSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testWithFeats(FeatureBitset features)
|
||||||
|
{
|
||||||
|
testSimple(features);
|
||||||
|
testCancelAfter(features);
|
||||||
|
testSettleDelay(features);
|
||||||
|
testExpiration(features);
|
||||||
|
testCloseDry(features);
|
||||||
|
testDefaultAmount(features);
|
||||||
|
testDisallowXRP(features);
|
||||||
|
testDstTag(features);
|
||||||
|
testDepositAuth(features);
|
||||||
|
testMultiple(features);
|
||||||
|
testAccountChannelsRPC(features);
|
||||||
|
testAccountChannelsRPCMarkers(features);
|
||||||
|
testAccountChannelsRPCSenderOnly(features);
|
||||||
|
testAuthVerifyRPC(features);
|
||||||
|
testOptionalFields(features);
|
||||||
|
testMalformedPK(features);
|
||||||
|
testMetaAndOwnership(features);
|
||||||
|
testAccountDelete(features);
|
||||||
|
testUsingTickets(features);
|
||||||
|
|
||||||
|
// testICSimple(FeatureBitset features);
|
||||||
|
// testICCancelAfter(FeatureBitset features);
|
||||||
|
// testICSettleDelay(FeatureBitset features);
|
||||||
|
// testICExpiration(FeatureBitset features);
|
||||||
|
// testICCloseDry(FeatureBitset features);
|
||||||
|
// testICDefaultAmount(FeatureBitset features);
|
||||||
|
// testICDisallowXRP(FeatureBitset features);
|
||||||
|
// testICDstTag(FeatureBitset features);
|
||||||
|
// testICDepositAuth(FeatureBitset features);
|
||||||
|
// testICMultiple(FeatureBitset features);
|
||||||
|
// testICAccountChannelsRPC(FeatureBitset features);
|
||||||
|
// testICAccountChannelsRPCMarkers(FeatureBitset features);
|
||||||
|
// testICAccountChannelsRPCSenderOnly(FeatureBitset features);
|
||||||
|
// testICAuthVerifyRPC(FeatureBitset features);
|
||||||
|
// testICOptionalFields(FeatureBitset features);
|
||||||
|
// testICMalformedPK(FeatureBitset features);
|
||||||
|
// testICMetaAndOwnership(FeatureBitset features);
|
||||||
|
// testICAccountDelete(FeatureBitset features);
|
||||||
|
// testICUsingTickets(FeatureBitset features);
|
||||||
|
}
|
||||||
|
public:
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
testSimple();
|
using namespace test::jtx;
|
||||||
testCancelAfter();
|
FeatureBitset const all{supported_amendments()};
|
||||||
testSettleDelay();
|
testWithFeats(all - disallowIncoming);
|
||||||
testExpiration();
|
testWithFeats(all);
|
||||||
testCloseDry();
|
|
||||||
testDefaultAmount();
|
|
||||||
testDisallowXRP();
|
|
||||||
testDstTag();
|
|
||||||
testDepositAuth();
|
|
||||||
testMultiple();
|
|
||||||
testAccountChannelsRPC();
|
|
||||||
testAccountChannelsRPCMarkers();
|
|
||||||
testAccountChannelsRPCSenderOnly();
|
|
||||||
testAuthVerifyRPC();
|
|
||||||
testOptionalFields();
|
|
||||||
testMalformedPK();
|
|
||||||
testMetaAndOwnership();
|
|
||||||
testAccountDelete();
|
|
||||||
testUsingTickets();
|
|
||||||
|
|
||||||
// testICSimple();
|
|
||||||
// testICCancelAfter();
|
|
||||||
// testICSettleDelay();
|
|
||||||
// testICExpiration();
|
|
||||||
// testICCloseDry();
|
|
||||||
// testICDefaultAmount();
|
|
||||||
// testICDisallowXRP();
|
|
||||||
// testICDstTag();
|
|
||||||
// testICDepositAuth();
|
|
||||||
// testICMultiple();
|
|
||||||
// testICAccountChannelsRPC();
|
|
||||||
// testICAccountChannelsRPCMarkers();
|
|
||||||
// testICAccountChannelsRPCSenderOnly();
|
|
||||||
// testICAuthVerifyRPC();
|
|
||||||
// testICOptionalFields();
|
|
||||||
// testICMalformedPK();
|
|
||||||
// testICMetaAndOwnership();
|
|
||||||
// testICAccountDelete();
|
|
||||||
// testICUsingTickets();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user