-
Notifications
You must be signed in to change notification settings - Fork 5
test: add some testcases #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
48be388
new file, added testcases
ce1b598
updated list
c775e5d
added relational and logical operators
a4cf820
added arithmetic-, unary operators, advanced elements and keywords
41cfc78
add new test files to the input directory
a94aece
sorting testcases into files
50094d5
turned off str optimizer and some other things
f627d64
added more testcases, flag bugs
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,108 @@ | ||
| 1 if True else 0 | ||
| #expect:1 | ||
|
|
||
| 1 if False else 0 | ||
| #expect:0 | ||
|
|
||
| "a" if True else "b" | ||
| #expect:"a" | ||
|
|
||
| "a" if False else "b" | ||
| #expect:"b" | ||
|
|
||
| ################################## | ||
|
|
||
| [x for x in range(5)] | ||
| #expect:[0, 1, 2, 3, 4] | ||
|
|
||
| [x for x in range(5) if x % 2 == 0] | ||
| #expect:[0, 2, 4] | ||
|
|
||
| [x*2 for x in range(3)] | ||
| #expect:[0, 2, 4] | ||
|
|
||
| [x for x in [1, 2, 3] if x > 1] | ||
| #expect:[2, 3] | ||
|
|
||
| #bug: AssertionError | ||
| #[x for x in "abc"] | ||
| ##expect:["a", "b", "c"] | ||
|
|
||
| #bug: LogicsParseException | ||
| #[x.upper() for x in "abc"] | ||
| ##expect:["A", "B", "C"] | ||
|
|
||
| ################################## | ||
|
|
||
| #bug: AssertionError: assert '2' == '[1, 2]' | ||
| #[1, 2, 3, 4][:2] | ||
| ##expect:[1, 2] | ||
|
|
||
| #bug: AssertionError: assert '3' == '[2, 3]' | ||
| #[1, 2, 3, 4][1:3] | ||
| ##expect:[2, 3] | ||
|
|
||
| #bug: AssertionError | ||
| #"abcdef"[:3] | ||
| ##expect:"abc" | ||
|
|
||
| #bug: AssertionError | ||
| #'abcdef'[2:] | ||
| ##expect:'cdef' | ||
|
|
||
| #bug: AssertionError | ||
| #'abcdef'[::2] | ||
| ##expect:'ace' | ||
|
|
||
| #bug: AssertionError | ||
| #[1, 2, 3, 4][::-1] | ||
| ##expect:[4, 3, 2, 1] | ||
|
|
||
| ################################## | ||
|
|
||
| [1, 2, 3][1] | ||
| #expect:2 | ||
|
|
||
| "abc"[1] | ||
| #expect:"b" | ||
|
|
||
| (1, 2, 3)[2] | ||
| #expect:3 | ||
|
|
||
| #bug: logics.parser.LogicsParseException: Line 1, column 1: Parse error, expecting 'Identifier', 'Number', 'String', 'not', '+', '-', '~', '(', '[', 'True', 'False', 'None', '$' | ||
| #{"a": 1, "b": 2}["b"] | ||
| ##expect:2 | ||
|
|
||
| #bug: logics.parser.LogicsParseException: Line 1, column 2: Parse error, expecting 'Identifier', 'Number', 'String', 'not', '+', '-', '~', '(', '[', 'True', 'False', 'None', '$' | ||
| #[{"a": 1}, {"b": 2}][1]["b"] | ||
| ##expect:2 | ||
|
|
||
| #bug: logics.parser.LogicsParseException | ||
| #{'key': 'value'}['key'] | ||
| ##expect:'value' | ||
|
|
||
| ################################## | ||
|
|
||
| #bug: AssertionError: assert '2' == '[1, 2]' | ||
| #[1, 2, 3, 4][:2] | ||
| ##expect:[1, 2] | ||
|
|
||
| #bug: AssertionError... | ||
| #[1, 2, 3, 4][1:3] | ||
| ##expect:[2, 3] | ||
|
|
||
| #bug: AssertionError... | ||
| #'abcdef'[:3] | ||
| ##expect:'abc' | ||
|
|
||
| #bug: AssertionError... | ||
| #'abcdef'[2:] | ||
| ##expect:'cdef' | ||
|
|
||
| #bug: AssertionError... | ||
| #'abcdef'[::2] | ||
| ##expect:'ace' | ||
|
|
||
| #bug: AssertionError... | ||
| #[1, 2, 3, 4][::-1] | ||
| ##expect:[4, 3, 2, 1] |
This file contains hidden or 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,123 @@ | ||
| 5 + 3 | ||
| #expect:8 | ||
|
|
||
| "a" + "b" | ||
| #expect:"ab" | ||
|
|
||
| 1 + "b" | ||
| #expect:"1b" | ||
|
|
||
| 1 + 2 + 3 + 4 | ||
| #expect:10 | ||
|
|
||
| 5 + 0 | ||
| #expect:5 | ||
|
|
||
| 0 + 0 | ||
| #expect:0 | ||
|
|
||
| ################################## | ||
|
|
||
| 5 - 3 | ||
| #expect:2 | ||
|
|
||
| 5 - 0 | ||
| #expect:5 | ||
|
|
||
| 0 - 5 | ||
| #expect:-5 | ||
|
|
||
| -5 - 5 | ||
| #expect:-10 | ||
|
|
||
| 0 - 0 | ||
| #expect:0 | ||
|
|
||
| "ab" - "b" | ||
| #expect:0 | ||
|
|
||
| ################################## | ||
|
|
||
| 5 * 3 | ||
| #expect:15 | ||
|
|
||
| 5 * 0 | ||
| #expect:0 | ||
|
|
||
| 0 * 0 | ||
| #expect:0 | ||
|
|
||
| 3 * "HelloWorld" | ||
| #EXPECT:"HelloWorldHelloWorldHelloWorld" | ||
|
|
||
| #bug: TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list' | ||
| #[1, 2] * 2 | ||
| ##expect:[1, 2, 1, 2] | ||
|
|
||
| ################################## | ||
|
|
||
| 6 / 3 | ||
| #expect:2 | ||
|
|
||
| 5 / 2 | ||
| #expect:2.5 | ||
|
|
||
| 5 / 1 | ||
| #expect:5 | ||
|
|
||
| 0 / 5 | ||
| #expect:0 | ||
|
|
||
| 5 / 0 | ||
| #expect:"#ERR:division by zero" | ||
|
|
||
| ################################## | ||
|
|
||
| 6 // 3 | ||
| #expect:2 | ||
|
|
||
| 5 // 2 | ||
| #expect:2 | ||
|
|
||
| 5 // 1 | ||
| #expect:5 | ||
|
|
||
| 0 // 5 | ||
| #expect:0 | ||
|
|
||
| 5 // 0 | ||
| #expect:"#ERR:division by zero" | ||
|
|
||
| ################################## | ||
|
|
||
| 5 % 3 | ||
| #expect:2 | ||
|
|
||
| 5 % 2 | ||
| #expect:1 | ||
|
|
||
| 5 % 1 | ||
| #expect:0 | ||
|
|
||
| 0 % 5 | ||
| #expect:0 | ||
|
|
||
| 5 % 0 | ||
| #expect:"#ERR:modulo by zero" | ||
|
|
||
| ################################## | ||
|
|
||
| 2 ** 3 | ||
| #expect:8 | ||
|
|
||
| 5 ** 2 | ||
| #expect:25 | ||
|
|
||
| 5 ** 1 | ||
| #expect:5 | ||
|
|
||
| 5 ** 0 | ||
| #expect:1 | ||
|
|
||
| 0 ** 5 | ||
| #expect:0 |
This file contains hidden or 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,104 @@ | ||
| int("5") | ||
| #expect:5 | ||
|
|
||
| int(5.5) | ||
| #expect:5 | ||
|
|
||
| int("0") | ||
| #expect:0 | ||
|
|
||
| int(False) | ||
| #expect:0 | ||
|
|
||
| #bug: AssertionError | ||
| #int("10", 2) | ||
| ##expect:2 | ||
|
|
||
| #bug: AssertionError | ||
| #int(True) | ||
| ##expect:1 | ||
|
|
||
| #set:numbers:(1,2,3, 53.2) | ||
|
|
||
| 3 in numbers | ||
| #expect:True | ||
|
|
||
| 4 in numbers | ||
| #expect:False | ||
|
|
||
| 4 not in numbers | ||
| #expect:True | ||
|
|
||
| "a" in numbers | ||
| #expect:False | ||
|
|
||
| ################################## | ||
|
|
||
| float("5.5") | ||
| #expect:5.5 | ||
|
|
||
| #bug: AssertionError | ||
| #float(5) | ||
| ##expect:5.0 | ||
|
|
||
| #bug: AssertionError | ||
| #float("0") | ||
| ##expect:0.0 | ||
|
|
||
| #bug: AssertionError | ||
| #float(True) | ||
| ##expect:1.0 | ||
|
|
||
| #bug: AssertionError | ||
| #float(False) | ||
| ##expect:0.0 | ||
|
|
||
| #bug: AssertionError | ||
| #float("nan") | ||
| ##expect:float("nan") | ||
|
|
||
| ################################## | ||
|
|
||
| str(True) | ||
| #expect:"True" | ||
|
|
||
| str(False) | ||
| #expect:"False" | ||
|
|
||
| str(None) | ||
| #expect:"None" | ||
|
|
||
| str([1, 2, 3]) | ||
| #expect:"[1, 2, 3]" | ||
|
|
||
| #bug: AssertionError | ||
| #str(5) | ||
| ##expect:5 | ||
|
|
||
| str(5) | ||
| #expect:"5" | ||
|
|
||
| str(5.5) | ||
| #expect:"5.5" | ||
|
|
||
| #set:strings:("a","b","c") | ||
|
|
||
| "a" in strings | ||
| #expect:True | ||
|
|
||
| "aa" in strings | ||
| #expect:False | ||
|
|
||
| "x" not in strings | ||
| #expect:True | ||
|
|
||
| #set:string:"Hello World" | ||
|
|
||
| "World" in string | ||
| #expect:True | ||
|
|
||
| "Earth" in string | ||
| #expect:False | ||
|
|
||
| "Earth" not in string | ||
| #expect:True |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| foo() | ||
| #EXPECT:"#ERR:Call to unknown function foo()" | ||
| #expect:"#ERR:Call to unknown function foo()" | ||
|
|
||
| upper() | ||
| #EXPECT:"#ERR:Invalid call to upper()" | ||
| #expect:"#ERR:Invalid call to upper()" |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,25 @@ | ||
| "yes" if 2 + 3 == 5 else "no" | ||
| #expect:"yes" | ||
|
|
||
| "yes" if False else "no" | ||
| #expect:"no" | ||
|
|
||
| 1 if True else 0 | ||
| #expect:1 | ||
|
|
||
| 1 if False else 0 | ||
| #expect:0 | ||
|
|
||
| 1 if 1 else 0 | ||
| #expect:1 | ||
|
|
||
| 1 if 0 else 0 | ||
| #expect:0 | ||
|
|
||
| 1 if None else 0 | ||
| #expect:0 | ||
|
|
||
| 1 if not None else 0 | ||
| #expect:1 | ||
|
|
||
| ################################## |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.