mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 01:06:48 +00:00
Match unit tests on start of test name (#4634)
* For example, without this change, to run the TxQ tests, must specify `--unittest=TxQ1,TxQ2` on the command line. With this change, can use `--unittest=TxQ`, and both will be run. * An exact match will prevent any further partial matching. * This could have some side effects for different tests with a common name beginning. For example, NFToken, NFTokenBurn, NFTokenDir. This might be useful. If not, the shorter-named test(s) can be renamed. For example, NFToken to NFTokens. * Split the NFToken, NFTokenBurn, and Offer test classes. Potentially speeds up parallel tests by a factor of 5.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class NFTokenBurn_test : public beast::unit_test::suite
|
||||
class NFTokenBurn0_test : public beast::unit_test::suite
|
||||
{
|
||||
// Helper function that returns the owner count of an account root.
|
||||
static std::uint32_t
|
||||
@@ -786,22 +786,68 @@ class NFTokenBurn_test : public beast::unit_test::suite
|
||||
testBurnTooManyOffers(features);
|
||||
}
|
||||
|
||||
protected:
|
||||
void
|
||||
run(std::uint32_t instance, bool last = false)
|
||||
{
|
||||
using namespace test::jtx;
|
||||
static FeatureBitset const all{supported_amendments()};
|
||||
static FeatureBitset const fixNFTDir{fixNFTokenDirV1};
|
||||
|
||||
static std::array<FeatureBitset, 4> const feats{
|
||||
all - fixNonFungibleTokensV1_2 - fixNFTDir - fixNFTokenRemint,
|
||||
all - fixNonFungibleTokensV1_2 - fixNFTokenRemint,
|
||||
all - fixNFTokenRemint,
|
||||
all};
|
||||
|
||||
if (BEAST_EXPECT(instance < feats.size()))
|
||||
{
|
||||
testWithFeats(feats[instance]);
|
||||
}
|
||||
BEAST_EXPECT(!last || instance == feats.size() - 1);
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
using namespace test::jtx;
|
||||
FeatureBitset const all{supported_amendments()};
|
||||
FeatureBitset const fixNFTDir{fixNFTokenDirV1};
|
||||
|
||||
testWithFeats(
|
||||
all - fixNonFungibleTokensV1_2 - fixNFTDir - fixNFTokenRemint);
|
||||
testWithFeats(all - fixNonFungibleTokensV1_2 - fixNFTokenRemint);
|
||||
testWithFeats(all - fixNFTokenRemint);
|
||||
testWithFeats(all);
|
||||
run(0);
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBurn, tx, ripple, 3);
|
||||
class NFTokenBurn1_test : public NFTokenBurn0_test
|
||||
{
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
NFTokenBurn0_test::run(1);
|
||||
}
|
||||
};
|
||||
|
||||
class NFTokenBurn2_test : public NFTokenBurn0_test
|
||||
{
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
NFTokenBurn0_test::run(2);
|
||||
}
|
||||
};
|
||||
|
||||
class NFTokenBurn3_test : public NFTokenBurn0_test
|
||||
{
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
NFTokenBurn0_test::run(3, true);
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBurn0, tx, ripple, 3);
|
||||
BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBurn1, tx, ripple, 3);
|
||||
BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBurn2, tx, ripple, 3);
|
||||
BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBurn3, tx, ripple, 3);
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
Reference in New Issue
Block a user