Skip to content

Commit

Permalink
Merge pull request lcompilers#42 from Smit-create/test_1
Browse files Browse the repository at this point in the history
Add tests
  • Loading branch information
certik committed Jan 19, 2022
2 parents 05b0868 + a035963 commit 0f3c870
Show file tree
Hide file tree
Showing 67 changed files with 608 additions and 6 deletions.
5 changes: 5 additions & 0 deletions tests/assert1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test_assert():
a: i32
a = 5
assert a == 5
assert a != 10
13 changes: 13 additions & 0 deletions tests/assign1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def test_augassign():
r: i32
s: i32
r = 0
r += 4
s = 5
r *= s
r -= 2
s = 10
r /= s
a: str
a = ""
a += "test"
7 changes: 7 additions & 0 deletions tests/constants1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ def test_boz():
b = oct(56)
b = hex(42)
b = hex(12648430)


def test_ord_chr():
s: str
a: i32
a = ord('5')
s = chr(43)
8 changes: 8 additions & 0 deletions tests/expr2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def test_boolOp():
a: bool
b: bool
a = False
b = True
a = a and b
b = a or True
a = a or b
11 changes: 11 additions & 0 deletions tests/expr3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def test_cast():
a: i32
b: f32
a = 2
b = 4.2
a *= b
b += 1
a = 5
a -= 3.9
a /= b
b = 3/4
6 changes: 6 additions & 0 deletions tests/expr4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def test_del():
a: i32
b: i32
a = 4
b = 20
del a, b
7 changes: 7 additions & 0 deletions tests/expr5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def test_strOP():
s: str
s = 'a' * 2
s = 4 * 'bb'
s = 3 * 'a' * 3
s = '3' + '4'
s += 'test'
5 changes: 5 additions & 0 deletions tests/expr6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test_ifexp():
a: i32
a = 2
b: i32
b = 6 if a == 2 else 8
9 changes: 9 additions & 0 deletions tests/expr7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def test_pow():
a: i32
a = pow(2, 2)


def test_pow_1(a: i32, b: i32) -> i32:
res: i32
res = pow(a, b)
return res
18 changes: 18 additions & 0 deletions tests/loop1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def test_factorial_1(x: i32) -> i32:
if x < 0:
return 0
result: i32
result = 1
while x > 0:
result = result * x
x -= 1
return result


def test_factorial_2(x: i32) -> i32:
result: i32
result = 1
i: i32
for i in range(1, x + 1):
result = result * i
return result
7 changes: 7 additions & 0 deletions tests/loop2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def test_for():
i: i32
for i in range(0, 10):
if i == 0:
continue
if i > 5:
break
5 changes: 5 additions & 0 deletions tests/loop3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test_pass():
a: i32
a = 1
while a > 0:
pass
13 changes: 13 additions & 0 deletions tests/reference/asr-assert1-1ce92ea.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-assert1-1ce92ea",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/assert1.py",
"infile_hash": "f147a7c915580ec3722bd549a70fb9deda56527fe564c5c6f7228066",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-assert1-1ce92ea.stdout",
"stdout_hash": "ae1fa2a97a4a04a32a6b23b4ac4af4e984cbb1f283727212085e8f22",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-assert1-1ce92ea.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_assert: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.)}) test_assert [] [(= (Var 2 a) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (Var 2 a) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (Var 2 a) NotEq (ConstantInteger 10 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-assign1-886f049.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-assign1-886f049",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/assign1.py",
"infile_hash": "3b82a73e457bd65e85828b72d56596ca927e7c661e333691f154912b",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-assign1-886f049.stdout",
"stdout_hash": "2093d0bf986c2069ffb0b0785cd198349c92cc5fc4c96241c0641483",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-assign1-886f049.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_augassign: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Character 1 -2 () []) Source Public Required .false.), r: (Variable 2 r Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Integer 4 []) Source Public Required .false.)}) test_augassign [] [(= (Var 2 r) (ConstantInteger 0 (Integer 4 [])) ()) (= (Var 2 r) (BinOp (Var 2 r) Add (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) () ()) ()) (= (Var 2 s) (ConstantInteger 5 (Integer 4 [])) ()) (= (Var 2 r) (BinOp (Var 2 r) Mul (Var 2 s) (Integer 4 []) () ()) ()) (= (Var 2 r) (BinOp (Var 2 r) Sub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []) () ()) ()) (= (Var 2 s) (ConstantInteger 10 (Integer 4 [])) ()) (= (Var 2 r) (BinOp (ImplicitCast (Var 2 r) IntegerToReal (Real 8 []) ()) Div (ImplicitCast (Var 2 s) IntegerToReal (Real 8 []) ()) (Real 8 []) () ()) ()) (= (Var 2 a) (ConstantString "" (Character 1 0 () [])) ()) (= (Var 2 a) (StrOp (Var 2 a) Concat (ConstantString "test" (Character 1 4 () [])) (Character 1 -2 () []) ()) ())] Source Public Implementation () .false. .false.)}) [])
4 changes: 2 additions & 2 deletions tests/reference/asr-constants1-5828e8a.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "asr-constants1-5828e8a",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/constants1.py",
"infile_hash": "673145c1bcbf90af453feda6f0abfeaaae3c2f04a191b32500fa0217",
"infile_hash": "c5648d1d7f443b239f85aff60c596e54e57a93f7fe6db70bee361ebc",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-constants1-5828e8a.stdout",
"stdout_hash": "f4c61aa7b0774713ef08431e7e89d0f6fa451e95fb3774aaa242abf8",
"stdout_hash": "bfc4ff0ae50d14d5062d0cd3a899614f7a74da4c7caa355ee39062d7",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-constants1-5828e8a.stdout
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(TranslationUnit (SymbolTable 1 {test_boz: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_boz [] [(= (Var 2 b) (ConstantString "0b101" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0b1000000" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0o10" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0o70" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0x2a" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0xc0ffee" (Character 1 1 () [])) ())] Source Public Implementation () .false. .false.)}) [])
(TranslationUnit (SymbolTable 1 {test_boz: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_boz [] [(= (Var 2 b) (ConstantString "0b101" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0b1000000" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0o10" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0o70" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0x2a" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0xc0ffee" (Character 1 1 () [])) ())] Source Public Implementation () .false. .false.), test_ord_chr: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord_chr [] [(= (Var 3 a) (ConstantInteger 53 (Integer 4 [])) ()) (= (Var 3 s) (ConstantString "+" (Character 1 1 () [])) ())] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-expr2-2e78a12.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-expr2-2e78a12",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/expr2.py",
"infile_hash": "cded400dff0cf5559a8f8793a05743a98d813344a6a666799e98e994",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-expr2-2e78a12.stdout",
"stdout_hash": "3734e76d28a7a236562438ddb6e20143939a7b7e85246fa981aca8bf",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-expr2-2e78a12.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_boolOp: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.)}) test_boolOp [] [(= (Var 2 a) (ConstantLogical .false. (Logical 1 [])) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 2 a) (BoolOp (Var 2 a) And (Var 2 b) (Logical 1 []) ()) ()) (= (Var 2 b) (BoolOp (Var 2 a) Or (ConstantLogical .true. (Logical 1 [])) (Logical 1 []) ()) ()) (= (Var 2 a) (BoolOp (Var 2 a) Or (Var 2 b) (Logical 1 []) ()) ())] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-expr3-10eb0a4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-expr3-10eb0a4",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/expr3.py",
"infile_hash": "e480142391a42a92a9b87984232e7f7aaf3cfe146149597619e337e6",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-expr3-10eb0a4.stdout",
"stdout_hash": "b390039fa8bc8662b08d292bc7b9d28308a2a090d9fab2091e440151",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-expr3-10eb0a4.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_cast: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Real 4 []) Source Public Required .false.)}) test_cast [] [(= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantReal 4.200000 (Real 8 [])) ()) (= (Var 2 a) (BinOp (ImplicitCast (Var 2 a) IntegerToReal (Real 4 []) ()) Mul (Var 2 b) (Real 4 []) () ()) ()) (= (Var 2 b) (BinOp (Var 2 b) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 []) ()) (Real 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 5 (Integer 4 [])) ()) (= (Var 2 a) (BinOp (ImplicitCast (Var 2 a) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 3.900000 (Real 8 [])) (Real 8 []) () ()) ()) (= (Var 2 a) (BinOp (ImplicitCast (Var 2 a) IntegerToReal (Real 8 []) ()) Div (Var 2 b) (Real 8 []) () ()) ()) (= (Var 2 b) (BinOp (ImplicitCast (ConstantInteger 3 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Div (ImplicitCast (ConstantInteger 4 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Real 8 []) () ()) ())] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-expr4-cef6743.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-expr4-cef6743",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/expr4.py",
"infile_hash": "5cba7a5d589f54fc31463e48903d5b46604fb64e3e64ba215339047c",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-expr4-cef6743.stdout",
"stdout_hash": "5583d9fc67140d17b34b6274070c79ae86d8f77069d7142f15712f96",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-expr4-cef6743.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_del: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Integer 4 []) Source Public Required .false.)}) test_del [] [(= (Var 2 a) (ConstantInteger 4 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 20 (Integer 4 [])) ()) (ExplicitDeallocate [2 a 2 b])] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-expr5-645ffcc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-expr5-645ffcc",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/expr5.py",
"infile_hash": "07f99b669d2c4a308fbaf871751d58e8642bba8a44694d4ee0091af1",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-expr5-645ffcc.stdout",
"stdout_hash": "c607265fa6b01ba1b5ea13fab3721e5904c6ab51d45d86dea4f4eb26",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-expr5-645ffcc.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_strOP: (Subroutine (SymbolTable 2 {s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_strOP [] [(= (Var 2 s) (StrOp (ConstantString "a" (Character 1 1 () [])) Repeat (ConstantInteger 2 (Integer 4 [])) (Character 1 1 () []) ()) ()) (= (Var 2 s) (StrOp (ConstantInteger 4 (Integer 4 [])) Repeat (ConstantString "bb" (Character 1 2 () [])) (Character 1 2 () []) ()) ()) (= (Var 2 s) (StrOp (StrOp (ConstantInteger 3 (Integer 4 [])) Repeat (ConstantString "a" (Character 1 1 () [])) (Character 1 1 () []) ()) Repeat (ConstantInteger 3 (Integer 4 [])) (Character 1 1 () []) ()) ()) (= (Var 2 s) (StrOp (ConstantString "3" (Character 1 1 () [])) Concat (ConstantString "4" (Character 1 1 () [])) (Character 1 1 () []) ()) ()) (= (Var 2 s) (StrOp (Var 2 s) Concat (ConstantString "test" (Character 1 4 () [])) (Character 1 -2 () []) ()) ())] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-expr6-368e5ed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-expr6-368e5ed",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/expr6.py",
"infile_hash": "ccd80815d3d381662236e18e3e512367820c95ff3968061cbbab5cd9",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-expr6-368e5ed.stdout",
"stdout_hash": "fc356cbd04af62a67da22c0cd467f41c174960047f06997b33293ee9",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-expr6-368e5ed.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_ifexp: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Integer 4 []) Source Public Required .false.)}) test_ifexp [] [(= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (IfExp (Compare (Var 2 a) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 []) () ()) (ConstantInteger 6 (Integer 4 [])) (ConstantInteger 8 (Integer 4 [])) (Integer 4 [])) ())] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-expr7-480ba2f.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-expr7-480ba2f",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/expr7.py",
"infile_hash": "028150c053641a5eb79affc1224b5616a2639c9d5a4e2bd2624fc18e",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-expr7-480ba2f.stdout",
"stdout_hash": "c64379b5a8ed70894842b37c9c76b9c84a1859aea05b6c4da9b8fa7c",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-expr7-480ba2f.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 a) (BinOp (ConstantInteger 2 (Integer 4 [])) Pow (ConstantInteger 2 (Integer 4 [])) (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_pow_1: (Subroutine (SymbolTable 3 {a: (Variable 3 a In () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 3 b In () () Default (Integer 4 []) Source Public Required .false.), res: (Variable 3 res Local () () Default (Integer 4 []) Source Public Required .false.)}) test_pow_1 [(Var 3 a) (Var 3 b)] [(= (Var 3 res) (BinOp (Var 3 a) Pow (Var 3 b) (Integer 4 []) () ()) ()) (Return)] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-loop1-10d3109.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-loop1-10d3109",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/loop1.py",
"infile_hash": "74a4bee448a718086f59e717b68c1cd7bbcb50e5de72ec0b86e25c51",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-loop1-10d3109.stdout",
"stdout_hash": "d5aba71aced70a3037cab7b7ca2b52af2354e6af1e2a1f8e139b598c",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-loop1-10d3109.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_factorial_1: (Subroutine (SymbolTable 2 {result: (Variable 2 result Local () () Default (Integer 4 []) Source Public Required .false.), x: (Variable 2 x In () () Default (Integer 4 []) Source Public Required .false.)}) test_factorial_1 [(Var 2 x)] [(If (Compare (Var 2 x) Lt (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) [(Return)] []) (= (Var 2 result) (ConstantInteger 1 (Integer 4 [])) ()) (WhileLoop (Compare (Var 2 x) Gt (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) [(= (Var 2 result) (BinOp (Var 2 result) Mul (Var 2 x) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Var 2 x) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) () ()) ())]) (Return)] Source Public Implementation () .false. .false.), test_factorial_2: (Subroutine (SymbolTable 3 {i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), result: (Variable 3 result Local () () Default (Integer 4 []) Source Public Required .false.), x: (Variable 3 x In () () Default (Integer 4 []) Source Public Required .false.)}) test_factorial_2 [(Var 3 x)] [(= (Var 3 result) (ConstantInteger 1 (Integer 4 [])) ()) (DoLoop ((Var 3 i) (ConstantInteger 1 (Integer 4 [])) (BinOp (Var 3 x) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) () ()) (ConstantInteger 1 (Integer 4 []))) [(= (Var 3 result) (BinOp (Var 3 result) Mul (Var 3 i) (Integer 4 []) () ()) ())]) (Return)] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-loop2-e874469.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-loop2-e874469",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/loop2.py",
"infile_hash": "ca62d52ec7887e3a455cec87a0e49102e94e96db925f6c37edb792e7",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-loop2-e874469.stdout",
"stdout_hash": "03f169279ca3496703b5a91f94c46bb5f0b555329f9a4bf02b2939a2",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-loop2-e874469.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_for: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_for [] [(DoLoop ((Var 2 i) (ConstantInteger 0 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 1 (Integer 4 []))) [(If (Compare (Var 2 i) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) [(Cycle)] []) (If (Compare (Var 2 i) Gt (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) () ()) [(Exit)] [])])] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-loop3-a579196.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-loop3-a579196",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/loop3.py",
"infile_hash": "498c7c40ca352ed21dde33c128aff4d59d3c329e770e3a2ff3eb3fad",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-loop3-a579196.stdout",
"stdout_hash": "a7166e69aec2f4d924ccd850da945e18bd053e0e20fdf12c7af81094",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-loop3-a579196.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_pass: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.)}) test_pass [] [(= (Var 2 a) (ConstantInteger 1 (Integer 4 [])) ()) (WhileLoop (Compare (Var 2 a) Gt (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) [])] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/ast-assert1-b0154ee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "ast-assert1-b0154ee",
"cmd": "lpython --show-ast --no-color {infile} -o {outfile}",
"infile": "tests/assert1.py",
"infile_hash": "f147a7c915580ec3722bd549a70fb9deda56527fe564c5c6f7228066",
"outfile": null,
"outfile_hash": null,
"stdout": "ast-assert1-b0154ee.stdout",
"stdout_hash": "4a87bac65d736f8e6f2977af53c12b1f5584e2ad24c70ac40922d17b",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/ast-assert1-b0154ee.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(Module [(FunctionDef test_assert ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (ConstantInt 5 ()) ()) (Assert (Compare (Name a Load) Eq [(ConstantInt 5 ())]) ()) (Assert (Compare (Name a Load) NotEq [(ConstantInt 10 ())]) ())] [] () ())] [])
13 changes: 13 additions & 0 deletions tests/reference/ast-assign1-2a4c9ed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "ast-assign1-2a4c9ed",
"cmd": "lpython --show-ast --no-color {infile} -o {outfile}",
"infile": "tests/assign1.py",
"infile_hash": "3b82a73e457bd65e85828b72d56596ca927e7c661e333691f154912b",
"outfile": null,
"outfile_hash": null,
"stdout": "ast-assign1-2a4c9ed.stdout",
"stdout_hash": "19d9109b08fcd6ce10cf3f4290371653b686d1d70c702195c3337fad",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
Loading

0 comments on commit 0f3c870

Please sign in to comment.