snapshot before regression test
This commit is contained in:
26
TransPyV/Test/App/ptr_only_test.py
Normal file
26
TransPyV/Test/App/ptr_only_test.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import stdio
|
||||
import t, c
|
||||
|
||||
|
||||
def ptr_only_test() -> int:
|
||||
s: str = "hello"
|
||||
sp: str = s
|
||||
slen: int = 0
|
||||
while c.Deref(sp) != 0:
|
||||
slen = slen + 1
|
||||
sp = sp + 1
|
||||
stdio.printf("ptr: len(hello)=%d\n", slen)
|
||||
|
||||
x: int = 65
|
||||
px: str = c.Addr(x)
|
||||
c.DerefAs(px, 88)
|
||||
stdio.printf("ptr: after DerefAs x=%d\n", x)
|
||||
|
||||
p2: str = "ABC"
|
||||
total_ch: int = 0
|
||||
while c.Deref(p2) != 0:
|
||||
total_ch = total_ch + c.Deref(p2)
|
||||
p2 = p2 + 1
|
||||
stdio.printf("ptr: sum(A,B,C)=%d\n", total_ch)
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user