mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
[tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections
This commit is contained in:
parent
005ad26649
commit
5e3cbe020d
@ -544,7 +544,8 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
|
||||
const char* argv_both[] = {"cmd", "-testnet", "-regtest"};
|
||||
|
||||
// equivalent to "-testnet"
|
||||
const char* testnetconf = "testnet=1\nregtest=0\n";
|
||||
// regtest in testnet section is ignored
|
||||
const char* testnetconf = "testnet=1\nregtest=0\n[test]\nregtest=1";
|
||||
|
||||
test_args.ParseParameters(0, (char**)argv_testnet);
|
||||
BOOST_CHECK_EQUAL(test_args.GetChainName(), "main");
|
||||
@ -580,6 +581,30 @@ BOOST_AUTO_TEST_CASE(util_GetChainName)
|
||||
test_args.ParseParameters(3, (char**)argv_both);
|
||||
test_args.ReadConfigString(testnetconf);
|
||||
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
|
||||
|
||||
// check setting the network to test (and thus making
|
||||
// [test] regtest=1 potentially relevent) doesn't break things
|
||||
test_args.SelectConfigNetwork("test");
|
||||
|
||||
test_args.ParseParameters(0, (char**)argv_testnet);
|
||||
test_args.ReadConfigString(testnetconf);
|
||||
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
|
||||
|
||||
test_args.ParseParameters(2, (char**)argv_testnet);
|
||||
test_args.ReadConfigString(testnetconf);
|
||||
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
|
||||
|
||||
test_args.ParseParameters(2, (char**)argv_regtest);
|
||||
test_args.ReadConfigString(testnetconf);
|
||||
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
|
||||
|
||||
test_args.ParseParameters(2, (char**)argv_test_no_reg);
|
||||
test_args.ReadConfigString(testnetconf);
|
||||
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
|
||||
|
||||
test_args.ParseParameters(3, (char**)argv_both);
|
||||
test_args.ReadConfigString(testnetconf);
|
||||
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(util_FormatMoney)
|
||||
|
Loading…
Reference in New Issue
Block a user