Skip to content

Commit

Permalink
Supplementing pow tests (lcompilers#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
Madhav2310 committed Jul 22, 2022
1 parent 49d31c5 commit e2f98b7
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/errors/test_pow1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def f():
x: str
x = "a"
print(pow(x,3))
10 changes: 10 additions & 0 deletions tests/errors/test_pow2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def f():
a: i64
b: i64
c: i64
d: i64
a = 1
b = 2
c = 3
d = 4
print(pow(a, b, c, d))
6 changes: 6 additions & 0 deletions tests/errors/test_pow3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def f():
x: list[i32]
x = [2,3]
a: i64
a = 3
print(pow(x,a))
8 changes: 8 additions & 0 deletions tests/errors/test_pow4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def f():
x: c32
x = 2+3j
a: i64
b: i64
a = 2
b = 3
print(pow(x, a, b))
13 changes: 13 additions & 0 deletions tests/reference/asr-test_pow1-581ef42.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-test_pow1-581ef42",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/errors/test_pow1.py",
"infile_hash": "a7ce7888e7e99bc753e16822749aaae4ee63641675990b3e2a34de10",
"outfile": null,
"outfile_hash": null,
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_pow1-581ef42.stderr",
"stderr_hash": "7f7cc07cf6f08f2d953d6e6c1f4892e6379faaf8aa668117234293d0",
"returncode": 2
}
11 changes: 11 additions & 0 deletions tests/reference/asr-test_pow1-581ef42.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style suggestion: Could have used '**' instead of 'pow'
--> tests/errors/test_pow1.py:4:11
|
4 | print(pow(x,3))
| ^^^^^^^^ '**' could be used instead

semantic error: Arguments do not match for any generic procedure, pow
--> tests/errors/test_pow1.py:4:11
|
4 | print(pow(x,3))
| ^^^^^^^^
13 changes: 13 additions & 0 deletions tests/reference/asr-test_pow2-0dcbd7d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-test_pow2-0dcbd7d",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/errors/test_pow2.py",
"infile_hash": "78e130dfe23fbeee525591c4aa0b66aee134febaa06d61f4b92d2346",
"outfile": null,
"outfile_hash": null,
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_pow2-0dcbd7d.stderr",
"stderr_hash": "cd334c21c259215eb4236d3c14f43ad51bfffeb20fd0b6764673e059",
"returncode": 2
}
11 changes: 11 additions & 0 deletions tests/reference/asr-test_pow2-0dcbd7d.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style suggestion: Could have used '**' instead of 'pow'
--> tests/errors/test_pow2.py:10:11
|
10 | print(pow(a, b, c, d))
| ^^^^^^^^^^^^^^^ '**' could be used instead

semantic error: Arguments do not match for any generic procedure, pow
--> tests/errors/test_pow2.py:10:11
|
10 | print(pow(a, b, c, d))
| ^^^^^^^^^^^^^^^
13 changes: 13 additions & 0 deletions tests/reference/asr-test_pow3-79749ed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-test_pow3-79749ed",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/errors/test_pow3.py",
"infile_hash": "1bc6f2980c730ce43909b01a55a513bd66e10203b146f81edffacfe5",
"outfile": null,
"outfile_hash": null,
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_pow3-79749ed.stderr",
"stderr_hash": "411d92743dcaaf1804201d0818957ca75447d8989b706abb3e4c353f",
"returncode": 2
}
11 changes: 11 additions & 0 deletions tests/reference/asr-test_pow3-79749ed.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style suggestion: Could have used '**' instead of 'pow'
--> tests/errors/test_pow3.py:6:11
|
6 | print(pow(x,a))
| ^^^^^^^^ '**' could be used instead

semantic error: Arguments do not match for any generic procedure, pow
--> tests/errors/test_pow3.py:6:11
|
6 | print(pow(x,a))
| ^^^^^^^^
13 changes: 13 additions & 0 deletions tests/reference/asr-test_pow4-ef60978.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-test_pow4-ef60978",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/errors/test_pow4.py",
"infile_hash": "5d2a4db7380af57fed3553c4f12bc7b65015aedaaca59d25f44c932c",
"outfile": null,
"outfile_hash": null,
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_pow4-ef60978.stderr",
"stderr_hash": "e59a89d136c0faf4459152f48798e0f71c1ed0901eeaea5ab21fcbeb",
"returncode": 2
}
11 changes: 11 additions & 0 deletions tests/reference/asr-test_pow4-ef60978.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style suggestion: Could have used '**' instead of 'pow'
--> tests/errors/test_pow4.py:8:11
|
8 | print(pow(x, a, b))
| ^^^^^^^^^^^^ '**' could be used instead

semantic error: Arguments do not match for any generic procedure, pow
--> tests/errors/test_pow4.py:8:11
|
8 | print(pow(x, a, b))
| ^^^^^^^^^^^^
17 changes: 17 additions & 0 deletions tests/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,23 @@ asr = true
filename = "errors/test_pow.py"
asr = true

[[test]]
filename = "errors/test_pow1.py"
asr = true

[[test]]
filename = "errors/test_pow2.py"
asr = true

[[test]]
filename = "errors/test_pow3.py"
asr = true


[[test]]
filename = "errors/test_pow4.py"
asr = true

[[test]]
filename = "errors/test_assign1.py"
asr = true
Expand Down

0 comments on commit e2f98b7

Please sign in to comment.