Document architecture checkpoint and restore original task callback order
This commit is contained in:
1 parent
69d0187a21
commit
531883aaac
45 files changed
+2935
-43
No files matched your search
@@ -0,0 +1,32 @@
|
||||
"""Immutable PE contract and bounded recovered camera algebra checks."""
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / 'tools' / 'binary'))
|
||||
spec = importlib.util.spec_from_file_location('checkpoint_camera_audio_ui',
|
||||
ROOT / 'tools' / 'binary' / 'checkpoint_camera_audio_ui.py')
|
||||
checkpoint = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(checkpoint)
|
||||
|
||||
|
||||
class CameraAudioUiCheckpointTests(unittest.TestCase):
|
||||
def test_original_contract_and_offsets(self):
|
||||
result = checkpoint.recover(ROOT.parent / 'Original')
|
||||
self.assertEqual(len(checkpoint.ANCHORS), len(result['anchors']))
|
||||
self.assertEqual(len(checkpoint.CONSTANTS), len(result['constants']))
|
||||
for entry in result['anchors'] + result['constants']:
|
||||
self.assertEqual(int(entry['va'], 16) - 0x400000, int(entry['file_offset'], 16))
|
||||
self.assertTrue(all(g['file_offset'] is None for g in result['globals']))
|
||||
|
||||
def test_ray_adjustment_toward_look_point(self):
|
||||
self.assertEqual((0, 25, 75), checkpoint.obstructed_eye((0, 100, 0), (0, 0, 100)))
|
||||
self.assertEqual((5, -4, 3), checkpoint.obstructed_eye((5, -4, 3), (5, -4, 3)))
|
||||
# Translation must not affect the weighting; this guards point vs direction confusion.
|
||||
self.assertEqual((100, 125, 175), checkpoint.obstructed_eye((100, 200, 100), (100, 100, 200)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user