mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Merge #13457: tests: Drop variadic macro
faf52f953b47aac6a39892b037eaa3f08d46b655 tests: Drop variadic macro (MarcoFalke) Pull request description: The C++11 constructor of `std::vector` that takes an initializer list, is not `explicit`. Thus, the macro is not required and can be dropped. Hopefully fixes #13456 Tree-SHA512: 4095ed205f88138a7cd5b14790cc426899966f622a924a9b3f7de646a0d801a48ffb8921da760f1f93d5481298477c8a64dbec291381bb9aa77b075bdd2659f2
This commit is contained in:
parent
2615ebca43
commit
c1a84f6d59
@ -588,9 +588,6 @@ inline CTransactionRef make_tx(std::vector<CAmount>&& output_values, std::vector
|
|||||||
return MakeTransactionRef(tx);
|
return MakeTransactionRef(tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MK_OUTPUTS(amounts...) std::vector<CAmount>{amounts}
|
|
||||||
#define MK_INPUTS(txs...) std::vector<CTransactionRef>{txs}
|
|
||||||
#define MK_INPUT_IDX(idxes...) std::vector<uint32_t>{idxes}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
|
BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
|
||||||
{
|
{
|
||||||
@ -604,7 +601,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
|
|||||||
//
|
//
|
||||||
// [tx1]
|
// [tx1]
|
||||||
//
|
//
|
||||||
CTransactionRef tx1 = make_tx(MK_OUTPUTS(10 * COIN));
|
CTransactionRef tx1 = make_tx(/* output_values */ {10 * COIN});
|
||||||
pool.addUnchecked(tx1->GetHash(), entry.Fee(10000LL).FromTx(tx1));
|
pool.addUnchecked(tx1->GetHash(), entry.Fee(10000LL).FromTx(tx1));
|
||||||
|
|
||||||
// Ancestors / descendants should be 1 / 1 (itself / itself)
|
// Ancestors / descendants should be 1 / 1 (itself / itself)
|
||||||
@ -616,7 +613,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
|
|||||||
//
|
//
|
||||||
// [tx1].0 <- [tx2]
|
// [tx1].0 <- [tx2]
|
||||||
//
|
//
|
||||||
CTransactionRef tx2 = make_tx(MK_OUTPUTS(495 * CENT, 5 * COIN), MK_INPUTS(tx1));
|
CTransactionRef tx2 = make_tx(/* output_values */ {495 * CENT, 5 * COIN}, /* inputs */ {tx1});
|
||||||
pool.addUnchecked(tx2->GetHash(), entry.Fee(10000LL).FromTx(tx2));
|
pool.addUnchecked(tx2->GetHash(), entry.Fee(10000LL).FromTx(tx2));
|
||||||
|
|
||||||
// Ancestors / descendants should be:
|
// Ancestors / descendants should be:
|
||||||
@ -635,7 +632,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
|
|||||||
//
|
//
|
||||||
// [tx1].0 <- [tx2].0 <- [tx3]
|
// [tx1].0 <- [tx2].0 <- [tx3]
|
||||||
//
|
//
|
||||||
CTransactionRef tx3 = make_tx(MK_OUTPUTS(290 * CENT, 200 * CENT), MK_INPUTS(tx2));
|
CTransactionRef tx3 = make_tx(/* output_values */ {290 * CENT, 200 * CENT}, /* inputs */ {tx2});
|
||||||
pool.addUnchecked(tx3->GetHash(), entry.Fee(10000LL).FromTx(tx3));
|
pool.addUnchecked(tx3->GetHash(), entry.Fee(10000LL).FromTx(tx3));
|
||||||
|
|
||||||
// Ancestors / descendants should be:
|
// Ancestors / descendants should be:
|
||||||
@ -660,7 +657,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
|
|||||||
// |
|
// |
|
||||||
// \---1 <- [tx4]
|
// \---1 <- [tx4]
|
||||||
//
|
//
|
||||||
CTransactionRef tx4 = make_tx(MK_OUTPUTS(290 * CENT, 250 * CENT), MK_INPUTS(tx2), MK_INPUT_IDX(1));
|
CTransactionRef tx4 = make_tx(/* output_values */ {290 * CENT, 250 * CENT}, /* inputs */ {tx2}, /* input_indices */ {1});
|
||||||
pool.addUnchecked(tx4->GetHash(), entry.Fee(10000LL).FromTx(tx4));
|
pool.addUnchecked(tx4->GetHash(), entry.Fee(10000LL).FromTx(tx4));
|
||||||
|
|
||||||
// Ancestors / descendants should be:
|
// Ancestors / descendants should be:
|
||||||
@ -696,14 +693,14 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
|
|||||||
CAmount v = 5 * COIN;
|
CAmount v = 5 * COIN;
|
||||||
for (uint64_t i = 0; i < 5; i++) {
|
for (uint64_t i = 0; i < 5; i++) {
|
||||||
CTransactionRef& tyi = *ty[i];
|
CTransactionRef& tyi = *ty[i];
|
||||||
tyi = make_tx(MK_OUTPUTS(v), i > 0 ? MK_INPUTS(*ty[i-1]) : std::vector<CTransactionRef>());
|
tyi = make_tx(/* output_values */ {v}, /* inputs */ i > 0 ? std::vector<CTransactionRef>{*ty[i - 1]} : std::vector<CTransactionRef>{});
|
||||||
v -= 50 * CENT;
|
v -= 50 * CENT;
|
||||||
pool.addUnchecked(tyi->GetHash(), entry.Fee(10000LL).FromTx(tyi));
|
pool.addUnchecked(tyi->GetHash(), entry.Fee(10000LL).FromTx(tyi));
|
||||||
pool.GetTransactionAncestry(tyi->GetHash(), ancestors, descendants);
|
pool.GetTransactionAncestry(tyi->GetHash(), ancestors, descendants);
|
||||||
BOOST_CHECK_EQUAL(ancestors, i+1);
|
BOOST_CHECK_EQUAL(ancestors, i+1);
|
||||||
BOOST_CHECK_EQUAL(descendants, i+1);
|
BOOST_CHECK_EQUAL(descendants, i+1);
|
||||||
}
|
}
|
||||||
CTransactionRef ty6 = make_tx(MK_OUTPUTS(5 * COIN), MK_INPUTS(tx3, ty5));
|
CTransactionRef ty6 = make_tx(/* output_values */ {5 * COIN}, /* inputs */ {tx3, ty5});
|
||||||
pool.addUnchecked(ty6->GetHash(), entry.Fee(10000LL).FromTx(ty6));
|
pool.addUnchecked(ty6->GetHash(), entry.Fee(10000LL).FromTx(ty6));
|
||||||
|
|
||||||
// Ancestors / descendants should be:
|
// Ancestors / descendants should be:
|
||||||
|
Loading…
Reference in New Issue
Block a user