diff options
| author | Ross Nicoll <[email protected]> | 2018-09-30 15:38:37 +0100 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2019-04-03 05:16:26 +0000 |
| commit | 8ef665d5e4765366b1c47a2ce7054d783ccca9d0 (patch) | |
| tree | eb4deddbdbf40cc6e328dc88d3ae21d76332da9a /src/test/main_tests.cpp | |
| parent | Add Dogecoin block subsidy calculations. (diff) | |
| download | discoin-8ef665d5e4765366b1c47a2ce7054d783ccca9d0.tar.xz discoin-8ef665d5e4765366b1c47a2ce7054d783ccca9d0.zip | |
Replace test data with Dogecoin values
Replace test data with Dogecoin equivalents in the folowing tests:
* base58
* bip32
* keys
* miner
* pow
* wallet
Replace RPC and deterministic signatures in unit tests with Dogecoin values. While
conventionally I'd use an alternative implementation for these, as RFC 6979
compliant signature generation isn't terribly common, and there's no reason
to suspect we've modified this code, I'm going to assert that it's good enough
to test that the code doesn't provide different values.
Disabled Bitcoin PoW tests, but left code in place to simplify later merges. These are
replaced by the Dogecoin PoW tests.
Diffstat (limited to 'src/test/main_tests.cpp')
| -rw-r--r-- | src/test/main_tests.cpp | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index 5b3f2bc57..93456298f 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -15,47 +15,51 @@ BOOST_FIXTURE_TEST_SUITE(main_tests, TestingSetup) static void TestBlockSubsidyHalvings(const Consensus::Params& consensusParams) { - int maxHalvings = 64; - CAmount nInitialSubsidy = 50 * COIN; + // tested in dogecoin_tests.cpp + //int maxHalvings = 64; + //CAmount nInitialSubsidy = 50 * COIN; - CAmount nPreviousSubsidy = nInitialSubsidy * 2; // for height == 0 - BOOST_CHECK_EQUAL(nPreviousSubsidy, nInitialSubsidy * 2); - for (int nHalvings = 0; nHalvings < maxHalvings; nHalvings++) { - int nHeight = nHalvings * consensusParams.nSubsidyHalvingInterval; - CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams); - BOOST_CHECK(nSubsidy <= nInitialSubsidy); - BOOST_CHECK_EQUAL(nSubsidy, nPreviousSubsidy / 2); - nPreviousSubsidy = nSubsidy; - } - BOOST_CHECK_EQUAL(GetBlockSubsidy(maxHalvings * consensusParams.nSubsidyHalvingInterval, consensusParams), 0); + //CAmount nPreviousSubsidy = nInitialSubsidy * 2; // for height == 0 + //BOOST_CHECK_EQUAL(nPreviousSubsidy, nInitialSubsidy * 2); + //for (int nHalvings = 0; nHalvings < maxHalvings; nHalvings++) { + // int nHeight = nHalvings * consensusParams.nSubsidyHalvingInterval; + // CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams); + // BOOST_CHECK(nSubsidy <= nInitialSubsidy); + // BOOST_CHECK_EQUAL(nSubsidy, nPreviousSubsidy / 2); + // nPreviousSubsidy = nSubsidy; + //} + //BOOST_CHECK_EQUAL(GetBlockSubsidy(maxHalvings * consensusParams.nSubsidyHalvingInterval, consensusParams), 0); } static void TestBlockSubsidyHalvings(int nSubsidyHalvingInterval) { - Consensus::Params consensusParams; - consensusParams.nSubsidyHalvingInterval = nSubsidyHalvingInterval; - TestBlockSubsidyHalvings(consensusParams); + // tested in dogecoin_tests.cpp + //Consensus::Params consensusParams; + //consensusParams.nSubsidyHalvingInterval = nSubsidyHalvingInterval; + //TestBlockSubsidyHalvings(consensusParams); } BOOST_AUTO_TEST_CASE(block_subsidy_test) { - const auto chainParams = CreateChainParams(CBaseChainParams::MAIN); - TestBlockSubsidyHalvings(chainParams->GetConsensus()); // As in main - TestBlockSubsidyHalvings(150); // As in regtest - TestBlockSubsidyHalvings(1000); // Just another interval + // tested in dogecoin_tests.cpp + //const auto chainParams = CreateChainParams(CBaseChainParams::MAIN); + //TestBlockSubsidyHalvings(chainParams->GetConsensus()); // As in main + //TestBlockSubsidyHalvings(150); // As in regtest + //TestBlockSubsidyHalvings(1000); // Just another interval } BOOST_AUTO_TEST_CASE(subsidy_limit_test) { - const auto chainParams = CreateChainParams(CBaseChainParams::MAIN); - CAmount nSum = 0; - for (int nHeight = 0; nHeight < 14000000; nHeight += 1000) { - CAmount nSubsidy = GetBlockSubsidy(nHeight, chainParams->GetConsensus()); - BOOST_CHECK(nSubsidy <= 50 * COIN); - nSum += nSubsidy * 1000; - BOOST_CHECK(MoneyRange(nSum)); - } - BOOST_CHECK_EQUAL(nSum, CAmount{2099999997690000}); + // tested in dogecoin_tests.cpp + //const auto chainParams = CreateChainParams(CBaseChainParams::MAIN); + //CAmount nSum = 0; + //for (int nHeight = 0; nHeight < 14000000; nHeight += 1000) { + // CAmount nSubsidy = GetBlockSubsidy(nHeight, chainParams->GetConsensus()); + // BOOST_CHECK(nSubsidy <= 50 * COIN); + // nSum += nSubsidy * 1000; + // BOOST_CHECK(MoneyRange(nSum)); + //} + //BOOST_CHECK_EQUAL(nSum, CAmount{2099999997690000}); } static bool ReturnFalse() { return false; } |