2023-10-03 17:24:02 +08:00
|
|
|
@extern
|
|
|
|
def output_bool(x: bool):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-10-03 17:24:02 +08:00
|
|
|
|
2023-09-21 15:30:03 +08:00
|
|
|
@extern
|
|
|
|
def output_int32(x: int32):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
@extern
|
|
|
|
def output_int64(x: int64):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
@extern
|
|
|
|
def output_uint32(x: uint32):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
@extern
|
|
|
|
def output_uint64(x: uint64):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-09-21 15:30:03 +08:00
|
|
|
|
2023-09-29 15:06:56 +08:00
|
|
|
@extern
|
|
|
|
def output_float64(x: float):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-09-29 15:06:56 +08:00
|
|
|
|
2023-09-21 15:30:03 +08:00
|
|
|
@extern
|
|
|
|
def output_int32_list(x: list[int32]):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
@extern
|
|
|
|
def output_asciiart(x: int32):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
@extern
|
|
|
|
def output_str(x: str):
|
2023-10-30 17:19:18 +08:00
|
|
|
...
|
2023-09-21 15:30:03 +08:00
|
|
|
|
2023-10-03 17:24:02 +08:00
|
|
|
def test_output_bool():
|
2023-10-30 17:19:18 +08:00
|
|
|
output_bool(True)
|
|
|
|
output_bool(False)
|
2023-10-03 17:24:02 +08:00
|
|
|
|
2023-09-21 15:30:03 +08:00
|
|
|
def test_output_int32():
|
2023-10-30 17:19:18 +08:00
|
|
|
output_int32(-128)
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
def test_output_int64():
|
2023-10-30 17:19:18 +08:00
|
|
|
output_int64(int64(-256))
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
def test_output_uint32():
|
2023-10-30 17:19:18 +08:00
|
|
|
output_uint32(uint32(128))
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
def test_output_uint64():
|
2023-10-30 17:19:18 +08:00
|
|
|
output_uint64(uint64(256))
|
2023-09-21 15:30:03 +08:00
|
|
|
|
2023-09-29 15:06:56 +08:00
|
|
|
def test_output_float64():
|
2023-10-30 17:19:18 +08:00
|
|
|
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)
|
2023-09-29 15:06:56 +08:00
|
|
|
|
2023-09-21 15:30:03 +08:00
|
|
|
def test_output_asciiart():
|
2023-10-30 17:19:18 +08:00
|
|
|
for i in range(17):
|
|
|
|
output_asciiart(i)
|
|
|
|
output_asciiart(0)
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
def test_output_int32_list():
|
2023-10-30 17:19:18 +08:00
|
|
|
output_int32_list([0, 1, 3, 5, 10])
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
def test_output_str_family():
|
2023-10-30 17:19:18 +08:00
|
|
|
output_str("hello world")
|
2023-09-21 15:30:03 +08:00
|
|
|
|
|
|
|
def run() -> int32:
|
2023-10-30 17:19:18 +08:00
|
|
|
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
|