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

@@ -151,6 +151,37 @@ supported_features_except (uint256 const& key, Args const&... args)
std::array<uint256, 1 + sizeof...(args)>{{key, args...}});
}
/**
* @brief create collection of features to pass to Env ctor
*
* The resulting collection will contain *all supported amendments* plus
* the features passed as arguments.
*
* @param keys features to include in the resulting collection
*/
template<class Col>
FeatureBitset
supported_features_plus (Col const& keys)
{
return supported_amendments() | makeFeatureBitset(keys);
}
/**
*
* @brief create collection of features to pass to Env ctor
* The resulting collection will contain *all supported amendments* plus
* the features passed as arguments.
*
* @param key+args features to include in the resulting collection
*/
template <class... Args>
FeatureBitset
supported_features_plus (uint256 const& key, Args const&... args)
{
return supported_features_plus(
std::array<uint256, 1 + sizeof...(args)>{{key, args...}});
}
class SuiteSink : public beast::Journal::Sink
{
std::string partition_;

View File

@@ -355,7 +355,7 @@ public:
{
using namespace jtx;
Env env(*this, with_only_features(featureMultiSign));
Env env(*this);
env.fund(XRP(10000), "alice");
env(signers("alice", 1,
{ { "alice", 1 }, { "bob", 2 } }), ter(temBAD_SIGNER));
@@ -384,7 +384,7 @@ public:
ticket::create("alice", 60, "bob");
{
Env env(*this, with_only_features(featureTickets));
Env env(*this, supported_features_plus (featureTickets));
env.fund(XRP(10000), "alice");
env(noop("alice"), require(owners("alice", 0), tickets("alice", 0)));
env(ticket::create("alice"), require(owners("alice", 1), tickets("alice", 1)));