File tree Expand file tree Collapse file tree 8 files changed +35
-20
lines changed
Expand file tree Collapse file tree 8 files changed +35
-20
lines changed Original file line number Diff line number Diff line change 55#include " test/librust/sapling_test_fixture.h"
66#include " sapling/sapling_util.h"
77
8- SaplingTestingSetup::SaplingTestingSetup () : TestingSetup()
8+ SaplingTestingSetup::SaplingTestingSetup (const std::string& chainName ) : TestingSetup(chainName )
99{
1010 initZKSNARKS (); // init zk-snarks lib
1111}
Original file line number Diff line number Diff line change 1010/* *
1111 * Testing setup that configures a complete environment for Sapling testing.
1212 */
13- struct SaplingTestingSetup : public TestingSetup {
14- SaplingTestingSetup ();
13+ struct SaplingTestingSetup : public TestingSetup
14+ {
15+ SaplingTestingSetup (const std::string& chainName = CBaseChainParams::MAIN);
1516 ~SaplingTestingSetup ();
1617};
1718
Original file line number Diff line number Diff line change 1717
1818#include < boost/test/unit_test.hpp>
1919
20- BOOST_FIXTURE_TEST_SUITE (miner_tests, WalletTestingSetup)
20+ // future: this should be MAINNET.
21+ BOOST_FIXTURE_TEST_SUITE (miner_tests, WalletRegTestingSetup)
2122
2223// BOOST_CHECK_EXCEPTION predicates to check the specific validation error
2324class HasReason {
@@ -73,7 +74,6 @@ struct {
7374BOOST_AUTO_TEST_CASE (CreateNewBlock_validity)
7475{
7576 // Note that by default, these tests run with size accounting enabled.
76- SelectParams (CBaseChainParams::REGTEST); // future: this should be MAINNET.
7777 const CChainParams& chainparams = Params ();
7878 CScript scriptPubKey = CScript () << OP_DUP << OP_HASH160 << ParseHex (" 8d5b4f83212214d6ef693e02e6d71969fddad976" ) << OP_EQUALVERIFY << OP_CHECKSIG;
7979
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ struct BasicTestingSetup {
4545 * and wallet (if enabled) setup.
4646 */
4747class CConnman ;
48- struct TestingSetup : public BasicTestingSetup {
48+ struct TestingSetup : public BasicTestingSetup
49+ {
4950 CCoinsViewDB *pcoinsdbview;
5051 fs::path pathTemp;
5152 boost::thread_group threadGroup;
@@ -56,6 +57,11 @@ struct TestingSetup: public BasicTestingSetup {
5657 ~TestingSetup ();
5758};
5859
60+ struct RegTestingSetup : public TestingSetup
61+ {
62+ RegTestingSetup () : TestingSetup(CBaseChainParams::REGTEST) {}
63+ };
64+
5965class CBlock ;
6066struct CMutableTransaction ;
6167class CScript ;
@@ -78,13 +84,15 @@ struct TestChainSetup : public TestingSetup
7884};
7985
8086// Testing fixture that pre-creates a 100-block REGTEST-mode blockchain
81- struct TestChain100Setup : public TestChainSetup {
87+ struct TestChain100Setup : public TestChainSetup
88+ {
8289 TestChain100Setup () : TestChainSetup(100 ) {}
8390};
8491
8592// Testing fixture that pre-creates a 400-block REGTEST-mode blockchain
8693// all 400 blocks are PoW. PoS starts at height 500
87- struct TestChain400Setup : public TestChainSetup {
94+ struct TestChain400Setup : public TestChainSetup
95+ {
8896 TestChain400Setup () : TestChainSetup(400 ) {}
8997};
9098
Original file line number Diff line number Diff line change 1414#include " validation.h"
1515#include " validationinterface.h"
1616
17+
1718#define ASSERT_WITH_MSG (cond, msg ) if (!cond) { BOOST_ERROR (msg); }
1819
19- struct RegtestingSetup : public TestingSetup {
20- RegtestingSetup () : TestingSetup(CBaseChainParams::REGTEST) {}
21- };
2220
23- BOOST_FIXTURE_TEST_SUITE (validation_block_tests, RegtestingSetup )
21+ BOOST_FIXTURE_TEST_SUITE (validation_block_tests, RegTestingSetup )
2422
2523struct TestSubscriber : public CValidationInterface {
2624 uint256 m_expected_tip;
Original file line number Diff line number Diff line change 1111
1212#include < boost/test/unit_test.hpp>
1313
14- BOOST_FIXTURE_TEST_SUITE (validation_tests, TestingSetup )
14+ BOOST_AUTO_TEST_SUITE (validation_tests)
1515
16- BOOST_AUTO_TEST_CASE (test_simple_shielded_invalid)
16+ BOOST_FIXTURE_TEST_CASE (test_simple_shielded_invalid, TestingSetup )
1717{
1818 CMutableTransaction tx;
1919 tx.nVersion = CTransaction::TxVersion::SAPLING;
@@ -113,10 +113,11 @@ void CheckMempoolZcRejection(CMutableTransaction& mtx)
113113 BOOST_CHECK_EQUAL (state.GetRejectReason (), " bad-tx-with-zc" );
114114}
115115
116- BOOST_AUTO_TEST_CASE (zerocoin_rejection_tests)
116+ /*
117+ * Running on regtest to have v5 upgrade enforced at block 1 and test in-block zc rejection
118+ */
119+ BOOST_FIXTURE_TEST_CASE (zerocoin_rejection_tests, RegTestingSetup)
117120{
118- // !TODO: fix me
119- SelectParams (CBaseChainParams::REGTEST);
120121 UpdateNetworkUpgradeParameters (Consensus::UPGRADE_V5_0, Consensus::NetworkUpgrade::ALWAYS_ACTIVE);
121122 const CChainParams& chainparams = Params ();
122123
Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ void clean()
1919 bitdb.Reset ();
2020}
2121
22- WalletTestingSetup::WalletTestingSetup (): SaplingTestingSetup()
22+ WalletTestingSetup::WalletTestingSetup (const std::string& chainName):
23+ SaplingTestingSetup(chainName)
2324{
2425 clean (); // todo: research why we have an initialized bitdb here.
2526 bitdb.MakeMock ();
Original file line number Diff line number Diff line change 99
1010/* * Testing setup and teardown for wallet.
1111 */
12- struct WalletTestingSetup : public SaplingTestingSetup {
13- WalletTestingSetup ();
12+ struct WalletTestingSetup : public SaplingTestingSetup
13+ {
14+ WalletTestingSetup (const std::string& chainName = CBaseChainParams::MAIN);
1415 ~WalletTestingSetup ();
1516};
1617
18+ struct WalletRegTestingSetup : public WalletTestingSetup
19+ {
20+ WalletRegTestingSetup () : WalletTestingSetup(CBaseChainParams::REGTEST) {}
21+ };
22+
1723#endif
1824
You can’t perform that action at this time.
0 commit comments