Implement timed Invisible gadget and shared energy warnings
This commit is contained in:
1 parent
3527d33810
commit
1897dd2b90
44 files changed
+2466
-39
No files matched your search
@@ -0,0 +1,36 @@
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT/'tools/binary'))
|
||||
from player_energy import collect
|
||||
|
||||
|
||||
class PlayerEnergySourceTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.report = collect(ROOT.parent/'Original')
|
||||
|
||||
def test_exact_shared_body_and_warning_constants(self):
|
||||
self.assertEqual(self.report['body']['size'], 0xF3)
|
||||
self.assertEqual(self.report['constants'], dict(zero=0, maximum=100, low=19, rearm=20))
|
||||
|
||||
def test_sound_and_scalar_order_have_guarded_sites(self):
|
||||
sites = {site['name']: int(site['va'], 16) for site in self.report['sites']}
|
||||
self.assertLess(sites['empty_sound_before_scalar'], sites['scalar_store_before_extended_upper_test'])
|
||||
self.assertLess(sites['low_sound_before_latch'], sites['strict_rearm'])
|
||||
self.assertEqual(self.report['globals']['warning'], '0x4f83dc')
|
||||
|
||||
def test_constructor_and_both_new_consumers_are_bound(self):
|
||||
sites = {site['name'] for site in self.report['sites']}
|
||||
self.assertTrue({'ctor_zero_register', 'ctor_clear_warning', 'ray_adjust_caller',
|
||||
'invisible_adjust_caller'}.issubset(sites))
|
||||
|
||||
def test_every_site_has_pe_mapped_offset(self):
|
||||
for site in self.report['sites']:
|
||||
self.assertEqual(int(site['file_offset'], 16), int(site['va'], 16)-0x400000)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user