Skip to content

Commit

Permalink
Add tests/new_runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
yhara committed Oct 9, 2024
1 parent 0ce4d34 commit f0c82fd
Show file tree
Hide file tree
Showing 22 changed files with 144 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/new_runtime/arg_ref.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
3
3
18 changes: 18 additions & 0 deletions tests/new_runtime/arg_ref.sk
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions tests/new_runtime/async.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
123
456
8 changes: 8 additions & 0 deletions tests/new_runtime/async.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Main
def self.chiika_main() -> Int
print(123)
sleep_sec(1)
print(456)
return 0
end
end
1 change: 1 addition & 0 deletions tests/new_runtime/async_if.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
456
11 changes: 11 additions & 0 deletions tests/new_runtime/async_if.sk
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions tests/new_runtime/async_lvar.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
3
3
10 changes: 10 additions & 0 deletions tests/new_runtime/async_lvar.sk
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/new_runtime/async_valued_if.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
456
13 changes: 13 additions & 0 deletions tests/new_runtime/async_valued_if.sk
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions tests/new_runtime/countdown.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3
2
1
0
15 changes: 15 additions & 0 deletions tests/new_runtime/countdown.sk
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/new_runtime/early_return.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
123
11 changes: 11 additions & 0 deletions tests/new_runtime/early_return.sk
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/new_runtime/if.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
456
10 changes: 10 additions & 0 deletions tests/new_runtime/if.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Main
def self.chiika_main() -> Int
if true
print(456)
else
print(789)
end
return 0
end
end
1 change: 1 addition & 0 deletions tests/new_runtime/if_return_return.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
123
13 changes: 13 additions & 0 deletions tests/new_runtime/if_return_return.sk
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/new_runtime/sync.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
123
6 changes: 6 additions & 0 deletions tests/new_runtime/sync.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Main
def self.chiika_main() -> Int
print(123)
return 0
end
end
1 change: 1 addition & 0 deletions tests/new_runtime/valued_if.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
456
12 changes: 12 additions & 0 deletions tests/new_runtime/valued_if.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Main
def self.chiika_main() -> Int
print(
if true
456
else
789
end
)
return 0
end
end

0 comments on commit f0c82fd

Please sign in to comment.