mirror of
https://github.com/allaunthefox/SilverSight.git
synced 2026-07-30 17:16:16 +00:00
Includes: - n-dimensional generic modules (BraidStateN, MatrixN, SpectralN, ClassifyN, FisherRigidityN, FixedPointBridge) - Feasible Set Theorem proofs + QUBO relaxation - Anti-smuggle protocol (seedlock, mutation testing, cross_validate, qc_flag, symbol verification) - Q16_16 bridge with quad matrix representation - Infrastructure scripts (entry gate, determinism checks) - Test suites for Lean modules, scripts, and QUBO pipeline - FixedPoint migration and HachimojiN8 updates - Documentation updates (ARCHITECTURE, GLOSSARY, DOCUMENT_SETS) - QUBO conflict sweep and FSR validation - GitHub Actions anti-smuggle workflow Build: 3307 jobs, 0 errors
83 lines
2.9 KiB
Python
83 lines
2.9 KiB
Python
"""test_lean_modules.py — Verify Lean modules compile and #eval witnesses match.
|
|
|
|
Each test runs lake build on a specific Lean target and checks the exit code.
|
|
For modules with #eval witnesses, it parses the expected output from comments.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
def lake_build(target: str, timeout_s: int = 120) -> tuple[int, str]:
|
|
try:
|
|
r = subprocess.run(
|
|
["lake", "build", target],
|
|
cwd=REPO_ROOT, capture_output=True, text=True, timeout=timeout_s,
|
|
)
|
|
return r.returncode, r.stdout + r.stderr
|
|
except subprocess.TimeoutExpired:
|
|
return -1, "TIMEOUT"
|
|
except FileNotFoundError:
|
|
return -2, "lake not found"
|
|
|
|
|
|
class TestFeasibleSet(unittest.TestCase):
|
|
"""Feasible-Set Theorem and QUBO Relaxation."""
|
|
|
|
def test_theorem_compiles(self):
|
|
"""FeasibleSet.Theorem must compile (114 jobs)."""
|
|
rc, out = lake_build("SilverSight.FeasibleSet.Theorem", timeout=60)
|
|
self.assertEqual(rc, 0, f"Build failed:\n{out[-300:]}")
|
|
|
|
def test_qubo_relaxation_compiles(self):
|
|
"""QUBORelaxation must compile."""
|
|
rc, out = lake_build("SilverSight.FeasibleSet.QUBORelaxation", timeout=60)
|
|
self.assertEqual(rc, 0, f"Build failed:\n{out[-300:]}")
|
|
|
|
def test_cost_transparency_compiles(self):
|
|
"""CostTransparency must compile."""
|
|
rc, out = lake_build("SilverSight.CollectiveIntelligence.CostTransparency", timeout=60)
|
|
self.assertEqual(rc, 0, f"Build failed:\n{out[-300:]}")
|
|
|
|
|
|
class TestRrcEmit(unittest.TestCase):
|
|
"""RRC Emit alignment gate."""
|
|
|
|
def test_emit_compiles(self):
|
|
"""RRC.Emit must compile."""
|
|
rc, out = lake_build("SilverSight.RRC.Emit", timeout=120)
|
|
self.assertEqual(rc, 0, f"Build failed:\n{out[-300:]}")
|
|
|
|
def test_q16_manifold_compiles(self):
|
|
"""Q16_16Manifold corpus must compile."""
|
|
rc, out = lake_build("SilverSight.RRC.Q16_16Manifold", timeout=120)
|
|
self.assertEqual(rc, 0, f"Build failed:\n{out[-300:]}")
|
|
|
|
|
|
class TestCoreFormalism(unittest.TestCase):
|
|
"""CoreFormalism modules."""
|
|
|
|
def test_fixedpoint_compiles(self):
|
|
"""FixedPoint must compile."""
|
|
rc, out = lake_build("CoreFormalism.FixedPoint", timeout=60)
|
|
self.assertEqual(rc, 0, f"Build failed:\n{out[-300:]}")
|
|
|
|
def test_sidon_sets(self):
|
|
"""SidonSets must compile."""
|
|
rc, out = lake_build("CoreFormalism.SidonSets", timeout=60)
|
|
self.assertEqual(rc, 0, f"Build failed:\n{out[-300:]}")
|
|
|
|
def test_interaction_graph_sidon(self):
|
|
"""InteractionGraphSidon must compile."""
|
|
rc, out = lake_build("CoreFormalism.InteractionGraphSidon", timeout=60)
|
|
self.assertEqual(rc, 0, f"Build failed:\n{out[-300:]}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|