diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-02-08 18:47:56 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-02-08 18:52:00 +0000 |
commit | a333c42cdeab4675c22df25255313752d81a2d4e (patch) | |
tree | 97abd7cc6a0a06375979eebfdc72913b7940bef8 /tests/core_tests/chaingen.h | |
parent | core_tests: allow setting miner tx max_outs when creating a block (diff) | |
download | monero-a333c42cdeab4675c22df25255313752d81a2d4e.tar.xz |
core_tests: add tests for hard fork behaviors (MRL-0004)
We also replace the --fakechain option with an optional structure
containing details about configuration for the core/blockchain,
for test purposes. This seems more future friendly.
Diffstat (limited to 'tests/core_tests/chaingen.h')
-rw-r--r-- | tests/core_tests/chaingen.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index a5e93390d..f2bbb7346 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -471,6 +471,14 @@ inline bool replay_events_through_core(cryptonote::core& cr, const std::vector<t } //-------------------------------------------------------------------------- template<class t_test_class> +struct get_test_options { + const std::pair<uint8_t, uint64_t> hard_forks[1] = {std::make_pair(1, 0)}; + const cryptonote::test_options test_options = { + hard_forks + }; +}; +//-------------------------------------------------------------------------- +template<class t_test_class> inline bool do_replay_events(std::vector<test_event_entry>& events) { boost::program_options::options_description desc("Allowed options"); @@ -485,15 +493,12 @@ inline bool do_replay_events(std::vector<test_event_entry>& events) if (!r) return false; - // hardcode a --fakechain option for tests - static const char * const fakechain[] = {"", "--fakechain"}; - boost::program_options::store(boost::program_options::parse_command_line(2, fakechain, desc), vm); - cryptonote::cryptonote_protocol_stub pr; //TODO: stub only for this kind of test, make real validation of relayed objects cryptonote::core c(&pr); // FIXME: make sure that vm has arg_testnet_on set to true or false if // this test needs for it to be so. - if (!c.init(vm)) + const get_test_options<t_test_class> gto; + if (!c.init(vm, >o.test_options)) { std::cout << concolor::magenta << "Failed to init core" << concolor::normal << std::endl; return false; |