修复了大量存在的问题,增加了假鸭子类型等等机制
This commit is contained in:
@@ -155,7 +155,7 @@ def TestClassWithBitFields():
|
||||
|
||||
def TestIntArray():
|
||||
stdio.printf("=== Test Int Array ===\n")
|
||||
arr: list[t.CInt, 5] = list[t.CInt, 5]()
|
||||
arr: t.CArray[t.CInt, 5] = t.CArray[t.CInt, 5]()
|
||||
i: t.CInt = 0
|
||||
while i < 5:
|
||||
arr[i] = i * 10
|
||||
@@ -168,7 +168,7 @@ def TestIntArray():
|
||||
|
||||
def TestFloatArray():
|
||||
stdio.printf("=== Test Float Array ===\n")
|
||||
farr: list[t.CFloat, 4] = list[t.CFloat, 4]()
|
||||
farr: t.CArray[t.CFloat, 4] = t.CArray[t.CFloat, 4]()
|
||||
farr[0] = 1.5
|
||||
farr[1] = 2.5
|
||||
farr[2] = 3.5
|
||||
@@ -181,7 +181,7 @@ def TestFloatArray():
|
||||
|
||||
def TestCharArray():
|
||||
stdio.printf("=== Test Char Array (String) ===\n")
|
||||
str_arr: list[t.CChar, 32] = list[t.CChar, 32]()
|
||||
str_arr: t.CArray[t.CChar, 32] = t.CArray[t.CChar, 32]()
|
||||
str_arr[0] = 'H'
|
||||
str_arr[1] = 'e'
|
||||
str_arr[2] = 'l'
|
||||
@@ -193,8 +193,8 @@ def TestCharArray():
|
||||
|
||||
def TestNestedArray():
|
||||
stdio.printf("=== Test Nested Array (Array of Arrays) ===\n")
|
||||
row0: list[t.CInt, 3] = list[t.CInt, 3]()
|
||||
row1: list[t.CInt, 3] = list[t.CInt, 3]()
|
||||
row0: t.CArray[t.CInt, 3] = t.CArray[t.CInt, 3]()
|
||||
row1: t.CArray[t.CInt, 3] = t.CArray[t.CInt, 3]()
|
||||
row0[0] = 0
|
||||
row0[1] = 1
|
||||
row0[2] = 2
|
||||
@@ -215,7 +215,7 @@ def TestNestedArray():
|
||||
|
||||
def TestArrayWithStruct():
|
||||
stdio.printf("=== Test Array with Struct ===\n")
|
||||
points: list[SimpleData, 3] = list[SimpleData, 3]()
|
||||
points: t.CArray[SimpleData, 3] = t.CArray[SimpleData, 3]()
|
||||
i: t.CInt = 0
|
||||
while i < 3:
|
||||
points[i].x = i * 10
|
||||
@@ -229,7 +229,7 @@ def TestArrayWithStruct():
|
||||
|
||||
def TestArrayPointer():
|
||||
stdio.printf("=== Test Array Pointer ===\n")
|
||||
data: list[t.CInt, 8] = list[t.CInt, 8]()
|
||||
data: t.CArray[t.CInt, 8] = t.CArray[t.CInt, 8]()
|
||||
data[0] = 100
|
||||
data[1] = 200
|
||||
data[2] = 300
|
||||
|
||||
Reference in New Issue
Block a user