Minimize use of jtx::with_only_features (RIPD-1515):

In order to automatically run unit tests with newly created
amendments, prefer to start with jtx::supported_features() and
then subtract unwanted features.

These changes identified a few bugs that were hiding in
amendments.  One of those bugs, in FlowCross, is not yet fixed.
By uncommenting the test in CrossingLimits_test.cpp you can see
failures relating to that bug.  Since FlowCross is not yet
enabled on the network we can fix the bug at our convenience.
This commit is contained in:
Scott Schurr
2017-08-16 18:30:55 -07:00
committed by seelabs
parent aa76632bb3
commit 3523cee63d
30 changed files with 826 additions and 658 deletions

View File

@@ -29,7 +29,7 @@ class DeliverMin_test : public beast::unit_test::suite
{
public:
void
test_convert_all_of_an_asset(std::initializer_list<uint256> fs)
test_convert_all_of_an_asset(FeatureBitset features)
{
testcase("Convert all of an asset using DeliverMin");
@@ -38,7 +38,7 @@ public:
auto const USD = gw["USD"];
{
Env env(*this, with_only_features(fs));
Env env(*this, features);
env.fund(XRP(10000), "alice", "bob", "carol", gw);
env.trust(USD(100), "alice", "bob", "carol");
env(pay("alice", "bob", USD(10)), delivermin(USD(10)), ter(temBAD_AMOUNT));
@@ -61,7 +61,7 @@ public:
}
{
Env env(*this, with_only_features(fs));
Env env(*this, features);
env.fund(XRP(10000), "alice", "bob", gw);
env.trust(USD(1000), "alice", "bob");
env(pay(gw, "bob", USD(100)));
@@ -73,7 +73,7 @@ public:
}
{
Env env(*this, with_only_features(fs));
Env env(*this, features);
env.fund(XRP(10000), "alice", "bob", "carol", gw);
env.trust(USD(1000), "bob", "carol");
env(pay(gw, "bob", USD(200)));
@@ -91,7 +91,7 @@ public:
}
{
Env env(*this, with_only_features(fs));
Env env(*this, features);
env.fund(XRP(10000), "alice", "bob", "carol", "dan", gw);
env.trust(USD(1000), "bob", "carol", "dan");
env(pay(gw, "bob", USD(100)));
@@ -111,11 +111,14 @@ public:
void
run()
{
test_convert_all_of_an_asset({});
test_convert_all_of_an_asset({featureFlow});
test_convert_all_of_an_asset({featureFlow, fix1373});
using namespace jtx;
test_convert_all_of_an_asset(
{featureFlow, fix1373, featureFlowCross});
supported_features_except (featureFlow, fix1373, featureFlowCross));
test_convert_all_of_an_asset(
supported_features_except ( fix1373, featureFlowCross));
test_convert_all_of_an_asset(
supported_features_except ( featureFlowCross));
test_convert_all_of_an_asset(supported_amendments());
}
};