-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import assert | ||
|
||
as = assert.assert | ||
|
||
d = {1: "a", 2: true, 3: [1, 2, 3], [1, 2, 3]: [4, 5, 6], 5: {"a": "b"}} | ||
as("a", d[1]) | ||
as(true, d[2]) | ||
as([1, 2, 3], d[3]) | ||
as([4, 5, 6], d[[1, 2, 3]]) | ||
as([4, 5, 6], d[d[3]]) | ||
as("b", d[5]["a"]) | ||
|
||
print("dict test succeeded") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import assert | ||
|
||
as = assert.assert | ||
|
||
l = ["a", "b", "c", "d", "e"] | ||
|
||
idx = 0 | ||
for i, e in l { | ||
if idx == 0 { | ||
as(0, i) | ||
as("a", e) | ||
} elif idx == 1 { | ||
as(1, i) | ||
as("b", e) | ||
} elif idx == 2 { | ||
as(2, i) | ||
as("c", e) | ||
} elif idx == 3 { | ||
as(3, i) | ||
as("d", e) | ||
} elif idx == 4 { | ||
as(4, i) | ||
as("e", e) | ||
} else { | ||
print("must not come here") | ||
exit(1) | ||
} | ||
idx += 1 | ||
} | ||
|
||
as(5, idx) | ||
|
||
for i, e in [] { | ||
print("must not come here") | ||
exit(1) | ||
} | ||
|
||
idx = 0 | ||
for i, e in "abc" { | ||
if idx == 0 { | ||
as(0, i) | ||
as("a", e) | ||
} elif idx == 1 { | ||
as(1, i) | ||
as("b", e) | ||
} elif idx == 2 { | ||
as(2, i) | ||
as("c", e) | ||
} else { | ||
print("must not come here") | ||
exit(1) | ||
} | ||
idx += 1 | ||
} | ||
|
||
a = 0 | ||
for i, e in l { | ||
a = e | ||
if i == 2 { | ||
break | ||
} | ||
} | ||
as("c", a) | ||
|
||
for i, e in l { | ||
continue | ||
print("must not come here") | ||
exit(1) | ||
} | ||
|
||
print("for test succeeded") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import assert | ||
|
||
as = assert.assert | ||
|
||
a = 1 | ||
|
||
as(1, a) | ||
|
||
if true { | ||
a = 2 | ||
} | ||
|
||
as(2, a) | ||
|
||
if a == 2 { | ||
a = 3 | ||
} | ||
|
||
as(3, a) | ||
|
||
if a == 1 { | ||
a = 4 | ||
} elif a == 2 { | ||
a = 5 | ||
} elif a == 3 { | ||
a = 6 | ||
} | ||
|
||
as(6, a) | ||
|
||
if a == 1 { | ||
a = 7 | ||
} else { | ||
a = 8 | ||
} | ||
|
||
as(8, a) | ||
|
||
print("if test succeeded") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters