Change features default behavior in Env (RIPD-1460):

Enable all supported amendments in Env by default. Rename `features()`
to `with_features()` and add `all_features_except()` to support feature
subsets in Env. Refactor internal feature handling based on a bitset.
This commit is contained in:
Mike Ellery
2017-05-01 16:03:44 -07:00
committed by seelabs
parent 3dfb4a13f1
commit 56946e8128
36 changed files with 749 additions and 367 deletions

View File

@@ -193,7 +193,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace std::chrono;
{ // Escrow not enabled
Env env(*this);
Env env(*this, no_features);
env.fund(XRP(5000), "alice", "bob");
env(lockup("alice", "bob", XRP(1000), env.now() + 1s), ter(temDISABLED));
env(finish("bob", "alice", 1), ter(temDISABLED));
@@ -201,7 +201,7 @@ struct Escrow_test : public beast::unit_test::suite
}
{ // Escrow enabled
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
env.fund(XRP(5000), "alice", "bob");
env(lockup("alice", "bob", XRP(1000), env.now() + 1s));
env.close();
@@ -223,7 +223,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::chrono;
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
auto const alice = Account("alice");
env.fund(XRP(5000), alice, "bob");
@@ -247,7 +247,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::chrono;
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
env.fund(XRP(5000), "alice", "bob");
env.close();
@@ -350,7 +350,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace std::chrono;
{ // Unconditional
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
env.fund(XRP(5000), "alice", "bob");
auto const seq = env.seq("alice");
env(lockup("alice", "alice", XRP(1000), env.now() + 1s));
@@ -365,7 +365,7 @@ struct Escrow_test : public beast::unit_test::suite
}
{ // Conditional
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
env.fund(XRP(5000), "alice", "bob");
auto const seq = env.seq("alice");
env(lockup("alice", "alice", XRP(1000), makeSlice(cb2), env.now() + 1s));
@@ -398,7 +398,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test cryptoconditions
Env env(*this,
features(featureEscrow));
with_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -446,7 +446,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test cancel when condition is present
Env env(*this,
features(featureEscrow));
with_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -463,7 +463,7 @@ struct Escrow_test : public beast::unit_test::suite
}
{
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -483,7 +483,7 @@ struct Escrow_test : public beast::unit_test::suite
}
{ // Test long & short conditions during creation
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -524,7 +524,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test long and short conditions & fulfillments during finish
Env env(*this,
features(featureEscrow));
with_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -609,7 +609,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test empty condition during creation and
// empty condition & fulfillment during finish
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -649,7 +649,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test a condition other than PreimageSha256, which
// would require a separate amendment
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -677,7 +677,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::chrono;
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
env.fund(XRP(5000), "alice", "bob", "carol");
env(condpay("alice", "carol", XRP(1000), makeSlice(cb1), env.now() + 1s));
@@ -691,7 +691,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::chrono;
Env env(*this, features(featureEscrow));
Env env(*this, with_features(featureEscrow));
env.memoize("alice");
env.memoize("bob");