机械规则 R2/R3/R4/R6/R7/R8/R13 + R16 保守子集,共 86 文件 2127 行。R1(T | t.CPtr)与 R12(while 下标循环)未做,仍列为待办。全量 77/77 顺序回归通过。
137 lines
5.8 KiB
Plaintext
137 lines
5.8 KiB
Plaintext
import t, c
|
|
import config
|
|
import logic_test
|
|
import testcheck
|
|
|
|
|
|
def main() -> int:
|
|
testcheck.begin("LogicFlowTest: For/While/Match/控制流测试")
|
|
|
|
testcheck.section("For Range Basic Test (stop=5)")
|
|
logic_test.ForRangeBasicTest(5)
|
|
testcheck.ok("For Range Basic Test (5)")
|
|
|
|
testcheck.section("For Range With Start Stop Step (start=1, stop=10, step=2)")
|
|
logic_test.ForRangeWithStartStop(1, 10, 2)
|
|
testcheck.ok("For Range With Start Stop (1, 10, 2)")
|
|
|
|
testcheck.section("Nested For Range Test (rows=2, cols=3)")
|
|
logic_test.NestedForRangeTest(2, 3)
|
|
testcheck.ok("Nested For Range Test (2, 3)")
|
|
|
|
testcheck.section("For With If Break Test (size=8)")
|
|
logic_test.ForWithIfBreakTest(8)
|
|
testcheck.ok("For With If Break Test (8)")
|
|
|
|
testcheck.section("For With If Continue Test (n=10)")
|
|
logic_test.ForWithIfContinueTest(10)
|
|
testcheck.ok("For With If Continue Test (10)")
|
|
|
|
testcheck.section("For With Elif Branch Test (value=10)")
|
|
logic_test.ForWithElifBranchTest(10)
|
|
testcheck.ok("For With Elif Branch Test (10)")
|
|
|
|
testcheck.section("While With If Elif Else Test (iterations=7)")
|
|
logic_test.WhileWithIfElifElseTest(7)
|
|
testcheck.ok("While With If Elif Else Test (7)")
|
|
|
|
testcheck.section("While With Nested If Test (limit=4)")
|
|
logic_test.WhileWithNestedIfTest(4)
|
|
testcheck.ok("While With Nested If Test (4)")
|
|
|
|
testcheck.section("While With Match Case Test (value=2)")
|
|
logic_test.WhileWithMatchCaseTest(2)
|
|
testcheck.ok("While With Match Case Test (2)")
|
|
|
|
testcheck.section("While With Match Case Test (value=99)")
|
|
logic_test.WhileWithMatchCaseTest(99)
|
|
testcheck.ok("While With Match Case Test (99)")
|
|
|
|
testcheck.section("While With Match Case NoBreak Test (value=3)")
|
|
logic_test.WhileWithMatchCaseNoBreakTest(3)
|
|
testcheck.ok("While With Match Case NoBreak Test (3)")
|
|
|
|
testcheck.section("Complex For While Match Test (outer=3, inner=3)")
|
|
logic_test.ComplexForWhileMatchTest(3, 3)
|
|
testcheck.ok("Complex For While Match Test (3, 3)")
|
|
|
|
testcheck.section("For With Case And NoBreak Test (n=5)")
|
|
logic_test.ForWithCaseAndNoBreakTest(5)
|
|
testcheck.ok("For With Case And NoBreak Test (5)")
|
|
|
|
testcheck.section("While With Break Condition Test (limit=6)")
|
|
logic_test.WhileWithBreakConditionTest(6)
|
|
testcheck.ok("While With Break Condition Test (6)")
|
|
|
|
testcheck.section("Nested While With Multiple BreakPoints (depth=3, width=4)")
|
|
logic_test.NestedWhileWithMultipleBreakPoints(3, 4)
|
|
testcheck.ok("Nested While With Multiple BreakPoints (3, 4)")
|
|
|
|
testcheck.section("For With Match Case In Loop Test (iterations=9)")
|
|
logic_test.ForWithMatchCaseInLoopTest(9)
|
|
testcheck.ok("For With Match Case In Loop Test (9)")
|
|
|
|
testcheck.section("Complex Logic With Elif Chains (a=3, b=5, c=7)")
|
|
logic_test.ComplexLogicWithElifChains(3, 5, 7)
|
|
testcheck.ok("Complex Logic With Elif Chains (3, 5, 7)")
|
|
|
|
testcheck.section("For Range With Step And Condition (n=12, step=2)")
|
|
logic_test.ForRangeWithStepAndCondition(12, 2)
|
|
testcheck.ok("For Range With Step And Condition (12, 2)")
|
|
|
|
testcheck.section("Match Case With Guard Conditions (value=1)")
|
|
logic_test.MatchCaseWithGuardConditions(1)
|
|
testcheck.ok("Match Case With Guard Conditions (1)")
|
|
|
|
testcheck.section("While With Multiple Match Cases (iterations=12)")
|
|
logic_test.WhileWithMultipleMatchCases(12)
|
|
testcheck.ok("While With Multiple Match Cases (12)")
|
|
|
|
testcheck.section("For While Mix With Break And Continue (n=5)")
|
|
logic_test.ForWhileMixWithBreakAndContinue(5)
|
|
testcheck.ok("For While Mix With Break And Continue (5)")
|
|
|
|
testcheck.section("Complex Case Matching With Ranges (start=0, end=35)")
|
|
logic_test.ComplexCaseMatchingWithRanges(0, 35)
|
|
testcheck.ok("Complex Case Matching With Ranges (0, 35)")
|
|
|
|
testcheck.section("While With Elif In Elif Chain (limit=7)")
|
|
logic_test.WhileWithElifInElifChain(7)
|
|
testcheck.ok("While With Elif In Elif Chain (7)")
|
|
|
|
testcheck.section("For With Case NoBreak Nested (inner_limit=4)")
|
|
logic_test.ForWithCaseNoBreakNested(4)
|
|
testcheck.ok("For With Case NoBreak Nested (4)")
|
|
|
|
testcheck.section("Match Case Break = Exit Match (limit=5)")
|
|
testcheck.check(logic_test.MatchCaseBreakTest(5) == 117,
|
|
"match break exits match only (117)", "match break expect 117")
|
|
|
|
testcheck.section("Switch Case Fallthrough (value=1)")
|
|
testcheck.check(logic_test.SwitchCaseFallthroughTest(1) == 6,
|
|
"fallthrough 1 -> 6", "fallthrough 1 expect 6")
|
|
|
|
testcheck.section("Switch Case Fallthrough (value=2)")
|
|
testcheck.check(logic_test.SwitchCaseFallthroughTest(2) == 5,
|
|
"fallthrough 2 -> 5", "fallthrough 2 expect 5")
|
|
|
|
testcheck.section("Switch Case Fallthrough (value=3)")
|
|
testcheck.check(logic_test.SwitchCaseFallthroughTest(3) == 3,
|
|
"fallthrough 3 -> 3", "fallthrough 3 expect 3")
|
|
|
|
testcheck.section("Switch Case Fallthrough (value=9, default)")
|
|
testcheck.check(logic_test.SwitchCaseFallthroughTest(9) == 77,
|
|
"fallthrough default -> 77", "fallthrough default expect 77")
|
|
|
|
testcheck.section("Switch Case Break = Exit Switch (limit=5)")
|
|
testcheck.check(logic_test.SwitchCaseBreakTest(5) == 117,
|
|
"switch break exits switch only (117)", "switch break expect 117")
|
|
|
|
testcheck.section("Switch Multi-Value Case (1 | 2)")
|
|
testcheck.check(logic_test.SwitchMultiValueTest(1) == 10, "switch 1 -> 10", "switch 1 expect 10")
|
|
testcheck.check(logic_test.SwitchMultiValueTest(2) == 10, "switch 2 -> 10", "switch 2 expect 10")
|
|
testcheck.check(logic_test.SwitchMultiValueTest(3) == 30, "switch 3 -> 30", "switch 3 expect 30")
|
|
testcheck.check(logic_test.SwitchMultiValueTest(7) == 99, "switch 7 -> 99", "switch 7 expect 99")
|
|
|
|
return testcheck.end()
|