| from __future__ import annotations | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| def sha256_file(path: Path, chunk_size: int = 1024 * 1024) -> str: | |
| digest = hashlib.sha256() | |
| with path.open("rb") as f: | |
| while True: | |
| chunk = f.read(chunk_size) | |
| if not chunk: | |
| break | |
| digest.update(chunk) | |
| return digest.hexdigest() | |
| def main() -> None: | |
| root = Path(__file__).resolve().parents[1] | |
| registry = json.loads((root / "benchmark" / "scene_registry.json").read_text(encoding="utf-8")) | |
| tasks = json.loads((root / "benchmark" / "tasks.json").read_text(encoding="utf-8")) | |
| split = json.loads((root / "benchmark" / "split_v1.json").read_text(encoding="utf-8")) | |
| manifest = json.loads((root / "metadata" / "resource_manifest.json").read_text(encoding="utf-8")) | |
| assert len(registry["scenes"]) == 47, len(registry["scenes"]) | |
| assert len(tasks["tasks"]) == 141, len(tasks["tasks"]) | |
| assert len(split["dev_scene_ids"]) + len(split["test_scene_ids"]) == 47 | |
| for item in manifest["items"]: | |
| path = root / item["package_path"] | |
| if not path.exists(): | |
| raise FileNotFoundError(path) | |
| if path.stat().st_size != item["bytes"]: | |
| raise RuntimeError(f"Size mismatch: {path}") | |
| digest = sha256_file(path) | |
| if digest != item["sha256"]: | |
| raise RuntimeError(f"SHA256 mismatch: {path}") | |
| print("OK: 47 scenes, 141 tasks, all checksums match.") | |
| if __name__ == "__main__": | |
| main() | |