|
| 1 | +// Copyright (c) 2011-2014 The Bitcoin Core developers |
| 2 | +// Distributed under the MIT/X11 software license, see the accompanying |
| 3 | +// file COPYING or http://www.opensource.org/licenses/mit-license.php. |
| 4 | + |
| 5 | +#include "chainparams.h" |
| 6 | +#include "uint256.h" |
| 7 | +#include "utilstrencodings.h" |
| 8 | + |
| 9 | +#include <boost/test/unit_test.hpp> |
| 10 | + |
| 11 | +BOOST_AUTO_TEST_SUITE(genesis_tests) |
| 12 | + |
| 13 | +// Goal: check that the standard mainnet genesis block is computed correctly |
| 14 | +BOOST_AUTO_TEST_CASE(genesis_mainnet) |
| 15 | +{ |
| 16 | + SelectParams(CBaseChainParams::MAIN); |
| 17 | + const CChainParams *params = &Params(); |
| 18 | + BOOST_CHECK_EQUAL(params->HashGenesisBlock().GetHex(), |
| 19 | + "b811a5eeaf27432278c032a0b520f829be2b92fafff9789efe2755fff8ef547b"); |
| 20 | + // Check that unittest genesis hash is same as the mainnet one |
| 21 | + const CChainParams *params2 = &Params(); |
| 22 | + BOOST_CHECK_EQUAL(params2->HashGenesisBlock().GetHex(), |
| 23 | + "b811a5eeaf27432278c032a0b520f829be2b92fafff9789efe2755fff8ef547b"); |
| 24 | +} |
| 25 | + |
| 26 | +// Goal: check that the standard testnet genesis block is computed correctly |
| 27 | +BOOST_AUTO_TEST_CASE(genesis_testnet) |
| 28 | +{ |
| 29 | + SelectParams(CBaseChainParams::TESTNET); |
| 30 | + const CChainParams *params = &Params(); |
| 31 | + BOOST_CHECK_EQUAL(params->HashGenesisBlock().GetHex(), |
| 32 | + "f7f0ca371b1003dc7346bab766b4a131f9e3a5d68820a364d70921cb15b95eaa"); |
| 33 | + // Return params to base case for other tests |
| 34 | + SelectParams(CBaseChainParams::UNITTEST); |
| 35 | +} |
| 36 | + |
| 37 | +// Goal: check that the default regtest genesis block is computed correctly |
| 38 | +BOOST_AUTO_TEST_CASE(genesis_regtest) |
| 39 | +{ |
| 40 | + SelectParams(CBaseChainParams::REGTEST); |
| 41 | + const CChainParams *params1 = &Params(); |
| 42 | + BOOST_CHECK_EQUAL(params1->HashGenesisBlock().GetHex(), |
| 43 | + "b41d03dc310957765223df2bf2f4b3609c79b8b6ac0a0764b20754f972d48b6c"); |
| 44 | + // Return params to base case for other tests |
| 45 | + SelectParams(CBaseChainParams::UNITTEST); |
| 46 | +} |
| 47 | + |
| 48 | +BOOST_AUTO_TEST_SUITE_END() |
| 49 | + |
0 commit comments