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

@@ -53,12 +53,12 @@ class Freeze_test : public beast::unit_test::suite
return val.isArray() && val.size() == size;
}
void testRippleState(std::initializer_list<uint256> fs)
void testRippleState(FeatureBitset features)
{
testcase("RippleState Freeze");
using namespace test::jtx;
Env env(*this, with_only_features(fs));
Env env(*this, features);
Account G1 {"G1"};
Account alice {"alice"};
@@ -207,12 +207,12 @@ class Freeze_test : public beast::unit_test::suite
}
void
testGlobalFreeze(std::initializer_list<uint256> fs)
testGlobalFreeze(FeatureBitset features)
{
testcase("Global Freeze");
using namespace test::jtx;
Env env(*this, with_only_features(fs));
Env env(*this, features);
Account G1 {"G1"};
Account A1 {"A1"};
@@ -365,12 +365,12 @@ class Freeze_test : public beast::unit_test::suite
}
void
testNoFreeze(std::initializer_list<uint256> fs)
testNoFreeze(FeatureBitset features)
{
testcase("No Freeze");
using namespace test::jtx;
Env env(*this, with_only_features(fs));
Env env(*this, features);
Account G1 {"G1"};
Account A1 {"A1"};
@@ -419,12 +419,12 @@ class Freeze_test : public beast::unit_test::suite
}
void
testOffersWhenFrozen(std::initializer_list<uint256> fs)
testOffersWhenFrozen(FeatureBitset features)
{
testcase("Offers for Frozen Trust Lines");
using namespace test::jtx;
Env env(*this, with_only_features(fs));
Env env(*this, features);
Account G1 {"G1"};
Account A2 {"A2"};
@@ -523,21 +523,23 @@ public:
void run()
{
auto testAll = [this](std::initializer_list<uint256> fs)
auto testAll = [this](FeatureBitset features)
{
testRippleState(fs);
testGlobalFreeze(fs);
testNoFreeze(fs);
testOffersWhenFrozen(fs);
testRippleState(features);
testGlobalFreeze(features);
testNoFreeze(features);
testOffersWhenFrozen(features);
};
testAll({});
testAll({featureFlow});
testAll({featureFlow, fix1373});
testAll({featureFlow, fix1373, featureFlowCross});
using namespace test::jtx;
testAll(
supported_features_except (featureFlow, fix1373, featureFlowCross));
testAll(
supported_features_except ( fix1373, featureFlowCross));
testAll(
supported_features_except ( featureFlowCross));
testAll(supported_amendments());
}
};
BEAST_DEFINE_TESTSUITE(Freeze, app, ripple);
} // ripple