| |
| import sys |
| import os |
|
|
| |
| sys.path.append(os.getcwd()) |
|
|
| from proof_graph import ProofStep, ProofGraph, validate_pedagogical_legality |
| import curriculum_engine |
|
|
| def test_grade_7_violation(): |
| print("🧪 Testing Grade 7 Violation (Equation Systems)...") |
| |
| |
| rules = curriculum_engine.get_allowed_math_operators("7", "4") |
| print(f"📋 Rules for Grade 7: Forbidden={rules['forbidden']}") |
| |
| |
| |
| bad_steps = [ |
| ProofStep(1, "x+y=10, x-y=2", "Original System"), |
| ProofStep(2, "x=6, y=4", "Solved System", operator_used="SYSTEM_OF_EQUATIONS") |
| ] |
| bad_graph = ProofGraph(bad_steps) |
| |
| |
| is_legal, reason = validate_pedagogical_legality(bad_graph, rules) |
| |
| if not is_legal: |
| print(f"✅ Success: Pedagogy Guard correctly REJECTED Grade 7 system solver. Reason: {reason}") |
| else: |
| print("❌ Failure: Pedagogy Guard ALLOWED forbidden operator.") |
|
|
| def test_grade_8_allowed(): |
| print("\n🧪 Testing Grade 8 Allowed (Equation Systems)...") |
| |
| |
| rules = curriculum_engine.get_allowed_math_operators("8", "4") |
| print(f"📋 Rules for Grade 8: Forbidden={rules['forbidden']}") |
| |
| |
| steps = [ |
| ProofStep(1, "x+y=10, x-y=2", "Original System"), |
| ProofStep(2, "x=6, y=4", "Solved System", operator_used="SYSTEM_OF_EQUATIONS") |
| ] |
| graph = ProofGraph(steps) |
| |
| |
| is_legal, reason = validate_pedagogical_legality(graph, rules) |
| |
| if is_legal: |
| print(f"✅ Success: Pedagogy Guard correctly ALLOWED Grade 8 system solver.") |
| else: |
| print(f"❌ Failure: Pedagogy Guard REJECTED allowed operator. Reason: {reason}") |
|
|
| def test_grade_11_calculus_whitelist(): |
| print("\n🧪 Testing Grade 11 Calculus (Derivative Allowed)...") |
| |
| |
| rules = curriculum_engine.get_allowed_math_operators("11", "5") |
| |
| steps = [ |
| ProofStep(1, "f(x)=x^2", "Function"), |
| ProofStep(2, "f'(x)=2x", "Derivative", operator_used="DERIVATIVE") |
| ] |
| graph = ProofGraph(steps) |
| |
| is_legal, reason = validate_pedagogical_legality(graph, rules) |
| |
| if is_legal: |
| print("✅ Success: Grade 11 correctly allows DERIVATIVE.") |
| else: |
| print(f"❌ Failure: Grade 11 rejected allowed DERIVATIVE. {reason}") |
|
|
| if __name__ == "__main__": |
| try: |
| test_grade_7_violation() |
| test_grade_8_allowed() |
| test_grade_11_calculus_whitelist() |
| print("\n✨ All isolated pedagogical tests PASSED!") |
| except Exception as e: |
| print(f"\n💥 Test Execution Failed: {e}") |
| sys.exit(1) |
|
|