From f9a084dba96d090752af663c5f7d0ee155369f50 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Thu, 4 Aug 2022 14:16:27 +0000 Subject: [PATCH] `test.py`: add halving calculator test --- test/test_py_d/ts_regtest.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/test_py_d/ts_regtest.py b/test/test_py_d/ts_regtest.py index a6836be..4fb3eec 100755 --- a/test/test_py_d/ts_regtest.py +++ b/test/test_py_d/ts_regtest.py @@ -42,11 +42,21 @@ class TestSuiteRegtest(TestSuiteBase): deterministic = False cmd_group_in = ( ('setup', 'regtest mode setup'), + ('subgroup.halving_calculator', []), ('subgroup.fund_addrbal', []), ('subgroup.addrbal', ['fund_addrbal']), ('stop', 'stopping regtest daemon'), ) cmd_subgroups = { + 'halving_calculator': ( + "'mmnode-halving-calculator' script", + ('halving_calculator1', "halving calculator (--help)"), + ('halving_calculator2', "halving calculator"), + ('halving_calculator3', "halving calculator (--list)"), + ('halving_calculator4', "halving calculator (--mined)"), + ('halving_calculator5', "halving calculator (--mined --bdr-proj=5)"), + ('halving_calculator6', "halving calculator (--mined --sample-size=20)"), + ), 'fund_addrbal': ( "funding addresses for 'addrbal' subgroup", ('sendto1', 'sending funds to address #1 (1)'), @@ -91,6 +101,29 @@ class TestSuiteRegtest(TestSuiteBase): t.expect(s) return t + def halving_calculator(self,add_args,expect_list): + t = self.spawn('mmnode-halving-calculator',args1+add_args) + t.match_expect_list(expect_list) + return t + + def halving_calculator1(self): + return self.halving_calculator(['--help'],['USAGE:']) + + def halving_calculator2(self): + return self.halving_calculator([],['Current block: 393',f'Current block subsidy: 12.5 {g.coin}']) + + def halving_calculator3(self): + return self.halving_calculator(['--list'],['33 4950','0']) + + def halving_calculator4(self): + return self.halving_calculator(['--mined'],['0 0.0000015 14949.9999835']) + + def halving_calculator5(self): + return self.halving_calculator(['--mined','--bdr-proj=5'],['5.00000 0 0.0000015 14949.9999835']) + + def halving_calculator6(self): + return self.halving_calculator(['--mined','--sample-size=20'],['33 4950','0 0.0000015 14949.9999835']) + def sendto(self,addr,amt): return self.spawn('mmgen-regtest',['send',addr,amt])