Unit tests don't enable Tickets or SHAMapV2 by default:

Both Tickets and SHAMapV2 have been around for a while and don't
look like they will be enabled on the network soon.  So they are
removed from the supportedAmendments list.  This prevents Env
from automatically testing with Tickets or SHAMapV2 enabled,
although testing with those features can still be explicitly
specified.

Drive-by cleanups:

o supportedAmendments() returns a const reference rather than
  a fresh vector on each call.

o supportedAmendments() implementation moved from Amendments.cpp
  to Feature.cpp.  Amendments.cpp deleted.

o supportedAmendments() declared in Feature.h.  All other
  declarations deleted.

o preEnabledAmendments() removed, since it was empty and only
  used in one place.  It will be easy to re-add when it is needed.

o jtx::all_features_except() renamed to
  jtx::supported_features_except(), which is more descriptive.

o jtx::all_amendments() renamed to jxt::supported_amendments()

o jtx::with_features() renamed to with_only_features()

o Env_test.cpp adjusted since featureTickets is no longer
  automatically enabled for unit tests.
This commit is contained in:
Scott Schurr
2017-08-03 16:26:40 -07:00
committed by seelabs
parent 07e3f81b76
commit feb7582aca
34 changed files with 282 additions and 345 deletions

View File

@@ -215,7 +215,7 @@ struct Escrow_test : public beast::unit_test::suite
}
{ // Escrow enabled
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
env.fund(XRP(5000), "alice", "bob");
env(lockup("alice", "bob", XRP(1000), env.now() + 1s));
env.close();
@@ -237,7 +237,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::chrono;
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
auto const alice = Account("alice");
env.fund(XRP(5000), alice, "bob");
@@ -261,7 +261,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::chrono;
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
env.fund(XRP(5000), "alice", "bob");
env.close();
@@ -364,7 +364,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace std::chrono;
{ // Unconditional
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
env.fund(XRP(5000), "alice", "bob");
auto const seq = env.seq("alice");
env(lockup("alice", "alice", XRP(1000), env.now() + 1s));
@@ -379,7 +379,7 @@ struct Escrow_test : public beast::unit_test::suite
}
{ // Conditional
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_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));
@@ -412,7 +412,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test cryptoconditions
Env env(*this,
with_features(featureEscrow));
with_only_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -460,7 +460,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test cancel when condition is present
Env env(*this,
with_features(featureEscrow));
with_only_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -477,7 +477,7 @@ struct Escrow_test : public beast::unit_test::suite
}
{
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -497,7 +497,7 @@ struct Escrow_test : public beast::unit_test::suite
}
{ // Test long & short conditions during creation
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -538,7 +538,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test long and short conditions & fulfillments during finish
Env env(*this,
with_features(featureEscrow));
with_only_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -623,7 +623,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test empty condition during creation and
// empty condition & fulfillment during finish
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -663,7 +663,7 @@ struct Escrow_test : public beast::unit_test::suite
{ // Test a condition other than PreimageSha256, which
// would require a separate amendment
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
auto T = [&env](NetClock::duration const& d)
{ return env.now() + d; };
env.fund(XRP(5000), "alice", "bob", "carol");
@@ -696,7 +696,7 @@ struct Escrow_test : public beast::unit_test::suite
{
testcase ("Metadata & Ownership (without fix1523)");
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
env.fund(XRP(5000), alice, bruce, carol);
auto const seq = env.seq(alice);
@@ -718,7 +718,7 @@ struct Escrow_test : public beast::unit_test::suite
{
testcase ("Metadata (with fix1523, to self)");
Env env(*this, with_features(featureEscrow, fix1523));
Env env(*this, with_only_features(featureEscrow, fix1523));
env.fund(XRP(5000), alice, bruce, carol);
auto const aseq = env.seq(alice);
auto const bseq = env.seq(bruce);
@@ -777,7 +777,7 @@ struct Escrow_test : public beast::unit_test::suite
{
testcase ("Metadata (with fix1523, to other)");
Env env(*this, with_features(featureEscrow, fix1523));
Env env(*this, with_only_features(featureEscrow, fix1523));
env.fund(XRP(5000), alice, bruce, carol);
auto const aseq = env.seq(alice);
auto const bseq = env.seq(bruce);
@@ -856,7 +856,7 @@ struct Escrow_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::chrono;
Env env(*this, with_features(featureEscrow));
Env env(*this, with_only_features(featureEscrow));
env.memoize("alice");
env.memoize("bob");