forked from M-Labs/nac3
standalone: Fix indentation of test files
This commit is contained in:
parent
9518d3fe14
commit
bb5147521f
|
@ -2,29 +2,29 @@
|
|||
# Tests whether all boolean variables (expressed as i8s) are lowered into i1s before used in branching instruction (`br`)
|
||||
|
||||
def bfunc(b: bool) -> bool:
|
||||
return not b
|
||||
return not b
|
||||
|
||||
def run() -> int32:
|
||||
b1 = True
|
||||
b2 = False
|
||||
b1 = True
|
||||
b2 = False
|
||||
|
||||
if b1:
|
||||
pass
|
||||
if b1:
|
||||
pass
|
||||
|
||||
if not b2:
|
||||
pass
|
||||
if not b2:
|
||||
pass
|
||||
|
||||
while b2:
|
||||
pass
|
||||
while b2:
|
||||
pass
|
||||
|
||||
l = [i for i in range(10) if b2]
|
||||
l = [i for i in range(10) if b2]
|
||||
|
||||
b_and = True and False
|
||||
b_or = True or False
|
||||
b_and = True and False
|
||||
b_or = True or False
|
||||
|
||||
b_and = b1 and b2
|
||||
b_or = b1 or b2
|
||||
b_and = b1 and b2
|
||||
b_or = b1 or b2
|
||||
|
||||
bfunc(b1)
|
||||
bfunc(b1)
|
||||
|
||||
return 0
|
||||
return 0
|
|
@ -1,8 +1,8 @@
|
|||
def f():
|
||||
return
|
||||
return
|
||||
return
|
||||
return
|
||||
|
||||
def run() -> int32:
|
||||
f()
|
||||
f()
|
||||
|
||||
return 0
|
||||
return 0
|
|
@ -1,83 +1,83 @@
|
|||
@extern
|
||||
def output_bool(x: bool):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_int32(x: int32):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_int64(x: int64):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_uint32(x: uint32):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_uint64(x: uint64):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_float64(x: float):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_int32_list(x: list[int32]):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_asciiart(x: int32):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_str(x: str):
|
||||
...
|
||||
...
|
||||
|
||||
def test_output_bool():
|
||||
output_bool(True)
|
||||
output_bool(False)
|
||||
output_bool(True)
|
||||
output_bool(False)
|
||||
|
||||
def test_output_int32():
|
||||
output_int32(-128)
|
||||
output_int32(-128)
|
||||
|
||||
def test_output_int64():
|
||||
output_int64(int64(-256))
|
||||
output_int64(int64(-256))
|
||||
|
||||
def test_output_uint32():
|
||||
output_uint32(uint32(128))
|
||||
output_uint32(uint32(128))
|
||||
|
||||
def test_output_uint64():
|
||||
output_uint64(uint64(256))
|
||||
output_uint64(uint64(256))
|
||||
|
||||
def test_output_float64():
|
||||
output_float64(0.0)
|
||||
output_float64(1.0)
|
||||
output_float64(-1.0)
|
||||
output_float64(128.0)
|
||||
output_float64(-128.0)
|
||||
output_float64(16.25)
|
||||
output_float64(-16.25)
|
||||
output_float64(0.0)
|
||||
output_float64(1.0)
|
||||
output_float64(-1.0)
|
||||
output_float64(128.0)
|
||||
output_float64(-128.0)
|
||||
output_float64(16.25)
|
||||
output_float64(-16.25)
|
||||
|
||||
def test_output_asciiart():
|
||||
for i in range(17):
|
||||
output_asciiart(i)
|
||||
output_asciiart(0)
|
||||
for i in range(17):
|
||||
output_asciiart(i)
|
||||
output_asciiart(0)
|
||||
|
||||
def test_output_int32_list():
|
||||
output_int32_list([0, 1, 3, 5, 10])
|
||||
output_int32_list([0, 1, 3, 5, 10])
|
||||
|
||||
def test_output_str_family():
|
||||
output_str("hello world")
|
||||
output_str("hello world")
|
||||
|
||||
def run() -> int32:
|
||||
test_output_bool()
|
||||
test_output_int32()
|
||||
test_output_int64()
|
||||
test_output_uint32()
|
||||
test_output_uint64()
|
||||
test_output_float64()
|
||||
test_output_asciiart()
|
||||
test_output_int32_list()
|
||||
test_output_str_family()
|
||||
return 0
|
||||
test_output_bool()
|
||||
test_output_int32()
|
||||
test_output_int64()
|
||||
test_output_uint32()
|
||||
test_output_uint64()
|
||||
test_output_float64()
|
||||
test_output_asciiart()
|
||||
test_output_int32_list()
|
||||
test_output_str_family()
|
||||
return 0
|
|
@ -1,17 +1,17 @@
|
|||
@extern
|
||||
def output_int32(x: int32):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_int32_list(x: list[int32]):
|
||||
...
|
||||
...
|
||||
|
||||
def run() -> int32:
|
||||
bl = [True, False]
|
||||
bl = [True, False]
|
||||
|
||||
bl1 = bl[:]
|
||||
bl1[1:] = [True]
|
||||
output_int32_list([int32(b) for b in bl1])
|
||||
output_int32_list([int32(b) for b in bl1])
|
||||
bl1 = bl[:]
|
||||
bl1[1:] = [True]
|
||||
output_int32_list([int32(b) for b in bl1])
|
||||
output_int32_list([int32(b) for b in bl1])
|
||||
|
||||
return 0
|
||||
return 0
|
||||
|
|
|
@ -3,31 +3,31 @@
|
|||
|
||||
@extern
|
||||
def output_int32(x: int32):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_float64(x: float):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def output_str(x: str):
|
||||
...
|
||||
...
|
||||
|
||||
def run() -> int32:
|
||||
for n in range(2, 10):
|
||||
for x in range(2, n):
|
||||
try:
|
||||
if n % x == 0:
|
||||
output_int32(n)
|
||||
output_str(" equals ")
|
||||
output_int32(x)
|
||||
output_str(" * ")
|
||||
output_float64(n / x)
|
||||
except: # Assume this is intended to catch x == 0
|
||||
break
|
||||
else:
|
||||
# loop fell through without finding a factor
|
||||
output_int32(n)
|
||||
output_str(" is a prime number")
|
||||
for n in range(2, 10):
|
||||
for x in range(2, n):
|
||||
try:
|
||||
if n % x == 0:
|
||||
output_int32(n)
|
||||
output_str(" equals ")
|
||||
output_int32(x)
|
||||
output_str(" * ")
|
||||
output_float64(n / x)
|
||||
except: # Assume this is intended to catch x == 0
|
||||
break
|
||||
else:
|
||||
# loop fell through without finding a factor
|
||||
output_int32(n)
|
||||
output_str(" is a prime number")
|
||||
|
||||
return 0
|
||||
return 0
|
|
@ -1,15 +1,15 @@
|
|||
@extern
|
||||
def output_bool(x: bool):
|
||||
...
|
||||
...
|
||||
|
||||
@extern
|
||||
def dbg_stack_address(x: str) -> uint64:
|
||||
...
|
||||
...
|
||||
|
||||
def run() -> int32:
|
||||
a = dbg_stack_address("a")
|
||||
b = dbg_stack_address("b")
|
||||
a = dbg_stack_address("a")
|
||||
b = dbg_stack_address("b")
|
||||
|
||||
output_bool(a == b)
|
||||
output_bool(a == b)
|
||||
|
||||
return 0
|
||||
return 0
|
Loading…
Reference in New Issue