补充
This commit is contained in:
116
Test/TestProject2/App/main.py
Normal file
116
Test/TestProject2/App/main.py
Normal file
@@ -0,0 +1,116 @@
|
||||
import stdio
|
||||
import stdint
|
||||
import zc.config as config
|
||||
import zc.test as test
|
||||
import zc.logic_test as logic
|
||||
import zc.class_test as class_test
|
||||
|
||||
|
||||
def main() -> stdint.INT:
|
||||
stdio.printf("=== Hello World! ===\n")
|
||||
stdio.printf("Cross-module macros:\n")
|
||||
stdio.printf(" POSMAX: %d\n", config.POSMAX)
|
||||
stdio.printf(" MATH_SCALE: %d\n", config.MATH_SCALE)
|
||||
stdio.printf(" THRESHOLD: %d\n", config.THRESHOLD)
|
||||
stdio.printf(" SHIFT_AMOUNT: %d\n", config.SHIFT_AMOUNT)
|
||||
stdio.printf(" MASK_VALUE: 0x%x\n", config.MASK_VALUE)
|
||||
stdio.printf("\n=== While Loop Test ===\n")
|
||||
test.AboutSizeTWhileTest(10)
|
||||
stdio.printf("\n=== Math Basic Test (20, 6) ===\n")
|
||||
test.MathBasicTest(20, 6)
|
||||
stdio.printf("\n=== Math Advanced Test (value=15) ===\n")
|
||||
test.MathAdvancedTest(15)
|
||||
stdio.printf("\n=== While with Elif-Else Test (-2 to 12) ===\n")
|
||||
test.WhileWithElifElseTest(-2, 12)
|
||||
stdio.printf("\n=== Nested While with Macros Test ===\n")
|
||||
test.NestedWhileWithMacrosTest(3, 4)
|
||||
stdio.printf("\n=== Complex Condition Test (1, 2, 3) ===\n")
|
||||
test.ComplexConditionTest(1, 2, 3)
|
||||
stdio.printf("\n=== Retry Loop Test (8) ===\n")
|
||||
test.RetryLoopTest(8)
|
||||
stdio.printf("\n=== Bitwise Operations Test (0b1101101) ===\n")
|
||||
test.BitwiseOperationsTest(109)
|
||||
stdio.printf("\n=== Compound Assignment Math Test (15, 4) ===\n")
|
||||
test.CompoundAssignmentMathTest(15, 4)
|
||||
stdio.printf("\n=== Power and Modulo Test (2, 8) ===\n")
|
||||
test.PowerAndModuloTest(2, 8)
|
||||
stdio.printf("\n=== Mixed Arithmetic Test (5, 3, 4) ===\n")
|
||||
test.MixedArithmeticTest(5, 3, 4)
|
||||
stdio.printf("\n=== Math with While Loop Test (start=1, count=5) ===\n")
|
||||
test.MathWithWhileLoopTest(1, 5)
|
||||
stdio.printf("\n=== Complex Nested Math Test (7, 3) ===\n")
|
||||
test.ComplexNestedMathTest(7, 3)
|
||||
stdio.printf("\n=== Conditional Math Chain Test (value=10) ===\n")
|
||||
test.ConditionalMathChainTest(10)
|
||||
stdio.printf("\n=== Bit Manipulation Math Test (0xABCD) ===\n")
|
||||
test.BitManipulationMathTest(0xABCD)
|
||||
stdio.printf("\n============== COMPLEX LOGIC TESTS ==============\n")
|
||||
stdio.printf("\n=== For Range Basic Test (stop=5) ===\n")
|
||||
logic.ForRangeBasicTest(5)
|
||||
stdio.printf("\n=== For Range With Start Stop Step (start=1, stop=10, step=2) ===\n")
|
||||
logic.ForRangeWithStartStop(1, 10, 2)
|
||||
stdio.printf("\n=== Nested For Range Test (rows=2, cols=3) ===\n")
|
||||
logic.NestedForRangeTest(2, 3)
|
||||
stdio.printf("\n=== For With If Break Test (size=8) ===\n")
|
||||
logic.ForWithIfBreakTest(8)
|
||||
stdio.printf("\n=== For With If Continue Test (n=10) ===\n")
|
||||
logic.ForWithIfContinueTest(10)
|
||||
stdio.printf("\n=== For With Elif Branch Test (value=10) ===\n")
|
||||
logic.ForWithElifBranchTest(10)
|
||||
stdio.printf("\n=== While With If Elif Else Test (iterations=7) ===\n")
|
||||
logic.WhileWithIfElifElseTest(7)
|
||||
stdio.printf("\n=== While With Nested If Test (limit=4) ===\n")
|
||||
logic.WhileWithNestedIfTest(4)
|
||||
stdio.printf("\n=== While With Match Case Test (value=2) ===\n")
|
||||
logic.WhileWithMatchCaseTest(2)
|
||||
stdio.printf("\n=== While With Match Case Test (value=99) ===\n")
|
||||
logic.WhileWithMatchCaseTest(99)
|
||||
stdio.printf("\n=== While With Match Case NoBreak Test (value=3) ===\n")
|
||||
logic.WhileWithMatchCaseNoBreakTest(3)
|
||||
stdio.printf("\n=== Complex For While Match Test (outer=3, inner=3) ===\n")
|
||||
logic.ComplexForWhileMatchTest(3, 3)
|
||||
stdio.printf("\n=== For With Case And NoBreak Test (n=5) ===\n")
|
||||
logic.ForWithCaseAndNoBreakTest(5)
|
||||
stdio.printf("\n=== While With Break Condition Test (limit=6) ===\n")
|
||||
logic.WhileWithBreakConditionTest(6)
|
||||
stdio.printf("\n=== Nested While With Multiple BreakPoints (depth=3, width=4) ===\n")
|
||||
logic.NestedWhileWithMultipleBreakPoints(3, 4)
|
||||
stdio.printf("\n=== For With Match Case In Loop Test (iterations=9) ===\n")
|
||||
logic.ForWithMatchCaseInLoopTest(9)
|
||||
stdio.printf("\n=== Complex Logic With Elif Chains (a=3, b=5, c=7) ===\n")
|
||||
logic.ComplexLogicWithElifChains(3, 5, 7)
|
||||
stdio.printf("\n=== For Range With Step And Condition (n=12, step=2) ===\n")
|
||||
logic.ForRangeWithStepAndCondition(12, 2)
|
||||
stdio.printf("\n=== Match Case With Guard Conditions (value=1) ===\n")
|
||||
logic.MatchCaseWithGuardConditions(1)
|
||||
stdio.printf("\n=== While With Multiple Match Cases (iterations=12) ===\n")
|
||||
logic.WhileWithMultipleMatchCases(12)
|
||||
stdio.printf("\n=== For While Mix With Break And Continue (n=5) ===\n")
|
||||
logic.ForWhileMixWithBreakAndContinue(5)
|
||||
stdio.printf("\n=== Complex Case Matching With Ranges (start=0, end=35) ===\n")
|
||||
logic.ComplexCaseMatchingWithRanges(0, 35)
|
||||
stdio.printf("\n=== While With Elif In Elif Chain (limit=7) ===\n")
|
||||
logic.WhileWithElifInElifChain(7)
|
||||
stdio.printf("\n=== For With Case NoBreak Nested (inner_limit=4) ===\n")
|
||||
logic.ForWithCaseNoBreakNested(4)
|
||||
stdio.printf("\n============== CLASS TESTS ==============\n")
|
||||
class_test.TestBasicDataClass()
|
||||
class_test.TestPoint3DClass()
|
||||
class_test.TestStudentClass()
|
||||
class_test.TestCounterClass()
|
||||
class_test.TestStackAllocation()
|
||||
class_test.TestHeapAllocation()
|
||||
class_test.TestHeapObjectWithInit()
|
||||
class_test.TestMultipleStackObjects()
|
||||
class_test.TestImplicitInitCall()
|
||||
class_test.TestClassWithBitFields()
|
||||
stdio.printf("\n============== ARRAY TESTS ==============\n")
|
||||
class_test.TestIntArray()
|
||||
class_test.TestFloatArray()
|
||||
class_test.TestCharArray()
|
||||
class_test.TestNestedArray()
|
||||
class_test.TestArrayWithStruct()
|
||||
class_test.TestArrayPointer()
|
||||
class_test.TestDynamicString()
|
||||
stdio.printf("\n============== All Tests Completed ==============\n")
|
||||
return 0
|
||||
Reference in New Issue
Block a user