Rehabilitate redistribution unit

This commit is contained in:
lash
2023-02-10 06:21:32 +00:00
parent 555b0b1724
commit 34af3b1b30
7 changed files with 38 additions and 26 deletions

View File

@@ -114,6 +114,17 @@ class TestDemurrage(EthTesterCase):
logg.debug('contract address {} start block {} start time {}'.format(self.address, self.start_block, self.start_time))
def assert_within(self, v, target, tolerance_ppm):
lower_target = target - (target * (tolerance_ppm / 1000000))
higher_target = target + (target * (tolerance_ppm / 1000000))
#self.assertGreaterEqual(v, lower_target)
#self.assertLessEqual(v, higher_target)
if v >= lower_target and v <= higher_target:
logg.debug('asserted within {} <= {} <= {}'.format(lower_target, v, higher_target))
return
raise AssertionError('{} not within lower {} and higher {}'.format(v, lower_target, higher_target))
def assert_within_lower(self, v, target, tolerance_ppm):
lower_target = target - (target * (tolerance_ppm / 1000000))
self.assertGreaterEqual(v, lower_target)