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

@@ -67,12 +67,12 @@ public:
}
}
void testNegativeBalance(std::initializer_list<uint256> fs)
void testNegativeBalance(FeatureBitset features)
{
testcase("Set noripple on a line with negative balance");
using namespace jtx;
Env env(*this, with_only_features(fs));
Env env(*this, features);
auto const gw = Account("gateway");
auto const alice = Account("alice");
@@ -113,12 +113,12 @@ public:
BEAST_EXPECT(!lines[0u].isMember(jss::no_ripple));
}
void testPairwise(std::initializer_list<uint256> fs)
void testPairwise(FeatureBitset features)
{
testcase("pairwise NoRipple");
using namespace jtx;
Env env(*this, with_only_features(fs));
Env env(*this, features);
auto const alice = Account("alice");
auto const bob = Account("bob");
@@ -150,12 +150,12 @@ public:
env(pay(alice, carol, bob["USD"](50)), ter(tecPATH_DRY));
}
void testDefaultRipple(std::initializer_list<uint256> fs)
void testDefaultRipple(FeatureBitset features)
{
testcase("Set default ripple on an account and check new trustlines");
using namespace jtx;
Env env(*this, with_only_features(fs));
Env env(*this, features);
auto const gw = Account("gateway");
auto const alice = Account("alice");
@@ -212,15 +212,19 @@ public:
{
testSetAndClear();
auto withFeatsTests = [this](std::initializer_list<uint256> fs) {
testNegativeBalance(fs);
testPairwise(fs);
testDefaultRipple(fs);
auto withFeatsTests = [this](FeatureBitset features) {
testNegativeBalance(features);
testPairwise(features);
testDefaultRipple(features);
};
withFeatsTests({});
withFeatsTests({featureFlow});
withFeatsTests({featureFlow, fix1373});
withFeatsTests({featureFlow, fix1373, featureFlowCross});
using namespace jtx;
withFeatsTests(
supported_features_except (featureFlow, fix1373, featureFlowCross));
withFeatsTests(
supported_features_except ( fix1373, featureFlowCross));
withFeatsTests(
supported_features_except ( featureFlowCross));
withFeatsTests(supported_amendments());
}
};