mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
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:
@@ -59,7 +59,7 @@ public:
|
||||
void testSignerLists()
|
||||
{
|
||||
using namespace jtx;
|
||||
Env env(*this, with_features(featureMultiSign));
|
||||
Env env(*this, with_only_features(featureMultiSign));
|
||||
Account const alice {"alice"};
|
||||
env.fund(XRP(1000), alice);
|
||||
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
void testSignerListsV2()
|
||||
{
|
||||
using namespace jtx;
|
||||
Env env(*this, with_features(featureMultiSign));
|
||||
Env env(*this, with_only_features(featureMultiSign));
|
||||
Account const alice {"alice"};
|
||||
env.fund(XRP(1000), alice);
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
|
||||
{
|
||||
testcase ("Setting transfer rate (without fix1201)");
|
||||
doTests (all_features_except(fix1201),
|
||||
doTests (supported_features_except(fix1201),
|
||||
{
|
||||
{ 1.0, tesSUCCESS, 1.0 },
|
||||
{ 1.1, tesSUCCESS, 1.1 },
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
|
||||
{
|
||||
testcase ("Setting transfer rate (with fix1201)");
|
||||
doTests (all_amendments(),
|
||||
doTests (supported_amendments(),
|
||||
{
|
||||
{ 1.0, tesSUCCESS, 1.0 },
|
||||
{ 1.1, tesSUCCESS, 1.1 },
|
||||
@@ -290,16 +290,16 @@ public:
|
||||
};
|
||||
|
||||
// Test gateway with allowed transfer rates
|
||||
runTest (Env{*this, all_features_except(fix1201)}, 1.02);
|
||||
runTest (Env{*this, all_features_except(fix1201)}, 1);
|
||||
runTest (Env{*this, all_features_except(fix1201)}, 2);
|
||||
runTest (Env{*this, all_features_except(fix1201)}, 2.1);
|
||||
runTest (Env{*this, all_amendments()}, 1.02);
|
||||
runTest (Env{*this, all_amendments()}, 2);
|
||||
runTest (Env{*this, supported_features_except(fix1201)}, 1.02);
|
||||
runTest (Env{*this, supported_features_except(fix1201)}, 1);
|
||||
runTest (Env{*this, supported_features_except(fix1201)}, 2);
|
||||
runTest (Env{*this, supported_features_except(fix1201)}, 2.1);
|
||||
runTest (Env{*this, supported_amendments()}, 1.02);
|
||||
runTest (Env{*this, supported_amendments()}, 2);
|
||||
|
||||
// Test gateway when amendment is set after transfer rate
|
||||
{
|
||||
Env env (*this, all_features_except(fix1201));
|
||||
Env env (*this, supported_features_except(fix1201));
|
||||
Account const alice ("alice");
|
||||
Account const bob ("bob");
|
||||
Account const gw ("gateway");
|
||||
@@ -371,7 +371,7 @@ public:
|
||||
void testRequireAuthWithDir()
|
||||
{
|
||||
using namespace test::jtx;
|
||||
Env env(*this, with_features(featureMultiSign));
|
||||
Env env(*this, with_only_features(featureMultiSign));
|
||||
Account const alice ("alice");
|
||||
Account const bob ("bob");
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class Feature_test : public beast::unit_test::suite
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env {*this,
|
||||
with_features(featureEscrow, featureCryptoConditions)};
|
||||
with_only_features(featureEscrow, featureCryptoConditions)};
|
||||
// The amendment table has to be modified
|
||||
// since that is what feature RPC actually checks
|
||||
env.app().getAmendmentTable().enable(featureEscrow);
|
||||
@@ -220,7 +220,7 @@ class Feature_test : public beast::unit_test::suite
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env {*this,
|
||||
with_features(featureCryptoConditions)};
|
||||
with_only_features(featureCryptoConditions)};
|
||||
// The amendment table has to be modified
|
||||
// since that is what feature RPC actually checks
|
||||
env.app().getAmendmentTable().enable(featureCryptoConditions);
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
using namespace jtx;
|
||||
Env env(*this, with_features(fs));
|
||||
Env env(*this, with_only_features(fs));
|
||||
|
||||
// Gateway account and assets
|
||||
Account const alice {"alice"};
|
||||
|
||||
@@ -2254,7 +2254,8 @@ public:
|
||||
// "b" (not in the ledger) is rDg53Haik2475DJx8bjMDSDPj4VX7htaMd.
|
||||
// "c" (phantom signer) is rPcNzota6B8YBokhYtcTNqQVCngtbnWfux.
|
||||
|
||||
test::jtx::Env env(*this, test::jtx::with_features(featureMultiSign));
|
||||
test::jtx::Env env(*this,
|
||||
test::jtx::with_only_features(featureMultiSign));
|
||||
env.fund(test::jtx::XRP(100000), a, ed, g);
|
||||
env.close();
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ public:
|
||||
using namespace test::jtx;
|
||||
using namespace std::chrono;
|
||||
Env env { *this, envconfig(validator, ""),
|
||||
with_features(featureMultiSign, featureTickets,
|
||||
with_only_features(featureMultiSign, featureTickets,
|
||||
featureEscrow, featurePayChan) };
|
||||
Account const gw { "gateway" };
|
||||
auto const USD = gw["USD"];
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
testcase("Set noripple on a line with negative balance");
|
||||
|
||||
using namespace jtx;
|
||||
Env env(*this, with_features(fs));
|
||||
Env env(*this, with_only_features(fs));
|
||||
|
||||
auto const gw = Account("gateway");
|
||||
auto const alice = Account("alice");
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
testcase("pairwise NoRipple");
|
||||
|
||||
using namespace jtx;
|
||||
Env env(*this, with_features(fs));
|
||||
Env env(*this, with_only_features(fs));
|
||||
|
||||
auto const alice = Account("alice");
|
||||
auto const bob = Account("bob");
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
testcase("Set default ripple on an account and check new trustlines");
|
||||
|
||||
using namespace jtx;
|
||||
Env env(*this, with_features(fs));
|
||||
Env env(*this, with_only_features(fs));
|
||||
|
||||
auto const gw = Account("gateway");
|
||||
auto const alice = Account("alice");
|
||||
|
||||
Reference in New Issue
Block a user