--- alwaysApply: true --- # 21. TESTING IS MANDATORY Every meaningful implementation change requires tests. At minimum test: ```text normal case failure case boundary case insufficient evidence ``` For semantic models, also test the boundaries between object types. For PCB analysis, explicitly test: ```text Pad Via Track Zone ``` as distinct semantic entities. --- # 22. TESTS MUST BE STRICT AND ABSOLUTE Periscope tests are not advisory. A test must define the exact expected behavior. Do not use vague assertions such as: ```text result is reasonable result is not empty analysis completed ``` when an exact result can be established. Prefer assertions such as: ```text expected object type == Via expected pad count == 24 expected finding count == 0 expected finding code == X expected severity == ERROR expected confidence == HIGH ``` Where deterministic exact values are available, test them exactly. Do not weaken tests merely to make an implementation pass. Do not modify expected results to accommodate incorrect implementation behavior. --- # 23. REGRESSION TEST FOR EVERY BUG Every fixed bug must become a regression test. Required sequence: ```text BUG ↓ REPRODUCE ↓ TEST FAILS ↓ FIX ↓ TEST PASSES ↓ FULL REGRESSION ``` A bug fix is not complete until the original failure is permanently represented by a test. --- # 24. TEST THE NEGATIVE CASE Do not test only: ```text valid → pass ``` Also test: ```text invalid → fail ``` and ensure that genuine errors remain detectable. For example, if fixing: ```text 24 datasheet pins 24 footprint pads N vias ``` verify that: ```text 24 datasheet pins 23 footprint pads ``` still produces a real mismatch. The fix must remove false positives without suppressing true positives. --- # 26. NO WEAKENING TESTS TO CLOSE A PHASE Do not: * delete failing tests; * weaken assertions; * skip tests; * mark tests expected-to-fail; * suppress failures; * change expected values without engineering justification; simply to make a macro-phase pass. If a test exposes a real implementation problem, fix the implementation. If the requirement itself is wrong, change the requirement explicitly and document why. ---