去除 import t, c
This commit is contained in:
1 parent
579cf8d8e0
commit
e67b80c083
112 files changed
+1235
-1347
No files matched your search
@@ -1,6 +1,4 @@
|
||||
import t
|
||||
import stdio
|
||||
import c
|
||||
import testcheck
|
||||
|
||||
# ============================================================
|
||||
@@ -124,7 +122,7 @@ def test_generic_range():
|
||||
# ============================================================
|
||||
# Test 6: generic function summing a fixed-size array argument
|
||||
# ============================================================
|
||||
def array_sum(arr: t.CArray[int, 8], n: int) -> int:
|
||||
def array_sum(arr: [8]int, n: int) -> int:
|
||||
result: int = 0
|
||||
for i in range(n):
|
||||
result += arr[i]
|
||||
@@ -132,7 +130,7 @@ def array_sum(arr: t.CArray[int, 8], n: int) -> int:
|
||||
|
||||
def test_generic_array_sum():
|
||||
testcheck.section("Test 6: array sum")
|
||||
arr: t.CArray[int, 8] = [0]
|
||||
arr: [8]int = [0]
|
||||
for i in range(8):
|
||||
arr[i] = (i + 1) * 10
|
||||
s: int = array_sum(arr, 8)
|
||||
@@ -160,7 +158,7 @@ def test_generic_max_three():
|
||||
# Test 8: generic container class with methods
|
||||
# ============================================================
|
||||
class Container[T]():
|
||||
values: t.CArray[int, 8]
|
||||
values: [8]int
|
||||
size: int
|
||||
|
||||
def __init__(self):
|
||||
|
||||
Reference in new issue
Block a user