From f0c82fd8fcffaae4f148c1879d251fedfe825c34 Mon Sep 17 00:00:00 2001 From: Yutaka HARA Date: Wed, 9 Oct 2024 22:28:13 +0900 Subject: [PATCH] Add tests/new_runtime --- tests/new_runtime/arg_ref.expected_out | 2 ++ tests/new_runtime/arg_ref.sk | 18 ++++++++++++++++++ tests/new_runtime/async.expected_out | 2 ++ tests/new_runtime/async.sk | 8 ++++++++ tests/new_runtime/async_if.expected_out | 1 + tests/new_runtime/async_if.sk | 11 +++++++++++ tests/new_runtime/async_lvar.expected_out | 2 ++ tests/new_runtime/async_lvar.sk | 10 ++++++++++ tests/new_runtime/async_valued_if.expected_out | 1 + tests/new_runtime/async_valued_if.sk | 13 +++++++++++++ tests/new_runtime/countdown.expected_out | 4 ++++ tests/new_runtime/countdown.sk | 15 +++++++++++++++ tests/new_runtime/early_return.expected_out | 1 + tests/new_runtime/early_return.sk | 11 +++++++++++ tests/new_runtime/if.expected_out | 1 + tests/new_runtime/if.sk | 10 ++++++++++ .../new_runtime/if_return_return.expected_out | 1 + tests/new_runtime/if_return_return.sk | 13 +++++++++++++ tests/new_runtime/sync.expected_out | 1 + tests/new_runtime/sync.sk | 6 ++++++ tests/new_runtime/valued_if.expected_out | 1 + tests/new_runtime/valued_if.sk | 12 ++++++++++++ 22 files changed, 144 insertions(+) create mode 100644 tests/new_runtime/arg_ref.expected_out create mode 100644 tests/new_runtime/arg_ref.sk create mode 100644 tests/new_runtime/async.expected_out create mode 100644 tests/new_runtime/async.sk create mode 100644 tests/new_runtime/async_if.expected_out create mode 100644 tests/new_runtime/async_if.sk create mode 100644 tests/new_runtime/async_lvar.expected_out create mode 100644 tests/new_runtime/async_lvar.sk create mode 100644 tests/new_runtime/async_valued_if.expected_out create mode 100644 tests/new_runtime/async_valued_if.sk create mode 100644 tests/new_runtime/countdown.expected_out create mode 100644 tests/new_runtime/countdown.sk create mode 100644 tests/new_runtime/early_return.expected_out create mode 100644 tests/new_runtime/early_return.sk create mode 100644 tests/new_runtime/if.expected_out create mode 100644 tests/new_runtime/if.sk create mode 100644 tests/new_runtime/if_return_return.expected_out create mode 100644 tests/new_runtime/if_return_return.sk create mode 100644 tests/new_runtime/sync.expected_out create mode 100644 tests/new_runtime/sync.sk create mode 100644 tests/new_runtime/valued_if.expected_out create mode 100644 tests/new_runtime/valued_if.sk diff --git a/tests/new_runtime/arg_ref.expected_out b/tests/new_runtime/arg_ref.expected_out new file mode 100644 index 00000000..a5c88062 --- /dev/null +++ b/tests/new_runtime/arg_ref.expected_out @@ -0,0 +1,2 @@ +3 +3 diff --git a/tests/new_runtime/arg_ref.sk b/tests/new_runtime/arg_ref.sk new file mode 100644 index 00000000..481d35e1 --- /dev/null +++ b/tests/new_runtime/arg_ref.sk @@ -0,0 +1,18 @@ +class Main + def self.foo(a: Int, b: Int) -> Int + if a < b + print(a + b) + sleep_sec(0) + return a + b + else + print(a + b) + sleep_sec(0) + return a + b + end + end + + def self.chiika_main() -> Int + print(foo(1, 2)) + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/async.expected_out b/tests/new_runtime/async.expected_out new file mode 100644 index 00000000..ce8c77db --- /dev/null +++ b/tests/new_runtime/async.expected_out @@ -0,0 +1,2 @@ +123 +456 diff --git a/tests/new_runtime/async.sk b/tests/new_runtime/async.sk new file mode 100644 index 00000000..e586d3c5 --- /dev/null +++ b/tests/new_runtime/async.sk @@ -0,0 +1,8 @@ +class Main + def self.chiika_main() -> Int + print(123) + sleep_sec(1) + print(456) + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/async_if.expected_out b/tests/new_runtime/async_if.expected_out new file mode 100644 index 00000000..8d38505c --- /dev/null +++ b/tests/new_runtime/async_if.expected_out @@ -0,0 +1 @@ +456 diff --git a/tests/new_runtime/async_if.sk b/tests/new_runtime/async_if.sk new file mode 100644 index 00000000..00258de0 --- /dev/null +++ b/tests/new_runtime/async_if.sk @@ -0,0 +1,11 @@ +class Main + def self.chiika_main() -> Int + if true + sleep_sec(1) + print(456) + else + print(789) + end + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/async_lvar.expected_out b/tests/new_runtime/async_lvar.expected_out new file mode 100644 index 00000000..a5c88062 --- /dev/null +++ b/tests/new_runtime/async_lvar.expected_out @@ -0,0 +1,2 @@ +3 +3 diff --git a/tests/new_runtime/async_lvar.sk b/tests/new_runtime/async_lvar.sk new file mode 100644 index 00000000..5209956f --- /dev/null +++ b/tests/new_runtime/async_lvar.sk @@ -0,0 +1,10 @@ +class Main + def self.chiika_main() -> Int + alloc x + x = 3 + print(x) + sleep_sec(1) + print(x) + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/async_valued_if.expected_out b/tests/new_runtime/async_valued_if.expected_out new file mode 100644 index 00000000..8d38505c --- /dev/null +++ b/tests/new_runtime/async_valued_if.expected_out @@ -0,0 +1 @@ +456 diff --git a/tests/new_runtime/async_valued_if.sk b/tests/new_runtime/async_valued_if.sk new file mode 100644 index 00000000..c629a4bb --- /dev/null +++ b/tests/new_runtime/async_valued_if.sk @@ -0,0 +1,13 @@ +class Main + def self.chiika_main() -> Int + print( + if true + sleep_sec(1) + 456 + else + 789 + end + ) + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/countdown.expected_out b/tests/new_runtime/countdown.expected_out new file mode 100644 index 00000000..4cc9dc3e --- /dev/null +++ b/tests/new_runtime/countdown.expected_out @@ -0,0 +1,4 @@ +3 +2 +1 +0 diff --git a/tests/new_runtime/countdown.sk b/tests/new_runtime/countdown.sk new file mode 100644 index 00000000..43f65c07 --- /dev/null +++ b/tests/new_runtime/countdown.sk @@ -0,0 +1,15 @@ +class Main + def self.countdown(i: Int) -> Null + print(i) + sleep_sec(0) + if i == 0 + return null + end + return countdown(i - 1) + end + + def self.chiika_main() -> Int + countdown(3) + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/early_return.expected_out b/tests/new_runtime/early_return.expected_out new file mode 100644 index 00000000..190a1803 --- /dev/null +++ b/tests/new_runtime/early_return.expected_out @@ -0,0 +1 @@ +123 diff --git a/tests/new_runtime/early_return.sk b/tests/new_runtime/early_return.sk new file mode 100644 index 00000000..5f97a6a0 --- /dev/null +++ b/tests/new_runtime/early_return.sk @@ -0,0 +1,11 @@ +class Main + def self.chiika_main() -> Int + if true + sleep_sec(1) + print(123) + return 0 + end + print(456) + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/if.expected_out b/tests/new_runtime/if.expected_out new file mode 100644 index 00000000..8d38505c --- /dev/null +++ b/tests/new_runtime/if.expected_out @@ -0,0 +1 @@ +456 diff --git a/tests/new_runtime/if.sk b/tests/new_runtime/if.sk new file mode 100644 index 00000000..1c23def0 --- /dev/null +++ b/tests/new_runtime/if.sk @@ -0,0 +1,10 @@ +class Main + def self.chiika_main() -> Int + if true + print(456) + else + print(789) + end + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/if_return_return.expected_out b/tests/new_runtime/if_return_return.expected_out new file mode 100644 index 00000000..190a1803 --- /dev/null +++ b/tests/new_runtime/if_return_return.expected_out @@ -0,0 +1 @@ +123 diff --git a/tests/new_runtime/if_return_return.sk b/tests/new_runtime/if_return_return.sk new file mode 100644 index 00000000..294f6676 --- /dev/null +++ b/tests/new_runtime/if_return_return.sk @@ -0,0 +1,13 @@ +class Main + def self.chiika_main() -> Int + if true + sleep_sec(1) + print(123) + return 0 + else + print(456) + return 0 + end + end + +end \ No newline at end of file diff --git a/tests/new_runtime/sync.expected_out b/tests/new_runtime/sync.expected_out new file mode 100644 index 00000000..190a1803 --- /dev/null +++ b/tests/new_runtime/sync.expected_out @@ -0,0 +1 @@ +123 diff --git a/tests/new_runtime/sync.sk b/tests/new_runtime/sync.sk new file mode 100644 index 00000000..93e467c1 --- /dev/null +++ b/tests/new_runtime/sync.sk @@ -0,0 +1,6 @@ +class Main + def self.chiika_main() -> Int + print(123) + return 0 + end +end \ No newline at end of file diff --git a/tests/new_runtime/valued_if.expected_out b/tests/new_runtime/valued_if.expected_out new file mode 100644 index 00000000..8d38505c --- /dev/null +++ b/tests/new_runtime/valued_if.expected_out @@ -0,0 +1 @@ +456 diff --git a/tests/new_runtime/valued_if.sk b/tests/new_runtime/valued_if.sk new file mode 100644 index 00000000..3b2a006d --- /dev/null +++ b/tests/new_runtime/valued_if.sk @@ -0,0 +1,12 @@ +class Main + def self.chiika_main() -> Int + print( + if true + 456 + else + 789 + end + ) + return 0 + end +end \ No newline at end of file