19 lines
1.3 KiB
Python
19 lines
1.3 KiB
Python
"""Source identity and saved original Goddard facing observations."""
|
|
from pathlib import Path
|
|
import hashlib,json,sys,unittest
|
|
ROOT=Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0,str(ROOT/'tools/binary'))
|
|
from goddard_leveling import collect
|
|
class GoddardLevelingEvidence(unittest.TestCase):
|
|
def test_source_ranges_and_original_offsets(self):
|
|
source=collect(ROOT.parent/'Original');fixture=json.loads((ROOT/'tests/GamePort.ScooterTests/original-leveling-reference.json').read_text())
|
|
self.assertEqual(source['source_sha256'],fixture['source_sha256']);self.assertEqual(source['ranges'],fixture['ranges'])
|
|
for span in source['ranges']:self.assertEqual(int(span['file_offset'],16),int(span['va'],16)-0x400000)
|
|
def test_probe_source_provenance_and_gates(self):
|
|
fixture=json.loads((ROOT/'tests/GamePort.ScooterTests/original-leveling-reference.json').read_text());self.assertEqual(len(fixture['cases']),11)
|
|
for file,hash_ in fixture['files'].items():
|
|
if file.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),hash_)
|
|
for case in fixture['cases']:
|
|
if case['name'] in ('clean','disabled'):self.assertEqual(case['observed'],case['input'][:3])
|
|
if __name__=='__main__':unittest.main()
|