FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add test for comparison · Smit-create/lpython@ab70fe6 · GitHub

Commit ab70fe6

Browse files
committed
Add test for comparison
1 parent f63383d commit ab70fe6

6 files changed

Lines changed: 42 additions & 0 deletions

File tree

‎tests/expr13.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def test_Compare():
2+
a: bool
3+
a = 5 > 4
4+
a = 5 <= 4
5+
a = 5 < 4
6+
a = 5.6 >= 5.59999
7+
a = 3.3 == 3.3
8+
a = 3.3 != 3.4
9+
a = complex(3, 4) == complex(3., 4.)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-expr13-81bdb5a",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/expr13.py",
5+
"infile_hash": "56a0c42089555c236b20fd1c1435908875178987c5f7f4c10ef9179a",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": "asr-expr13-81bdb5a.stdout",
9+
"stdout_hash": "644ecdcd79450726950d68d4d71e1803614d7bb8c94d706e676279fb",
10+
"stderr": null,
11+
"stderr_hash": null,
12+
"returncode": 0
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(TranslationUnit (SymbolTable 1 {main_program: (Program (SymbolTable 3 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Integer 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) LtE (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Integer 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Lt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Integer 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 5.600000 (Real 8 [])) GtE (ConstantReal 5.599990 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Real 8 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) Eq (ConstantReal 3.300000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Real 8 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) NotEq (ConstantReal 3.400000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Real 8 [])) ()) ()) (= (Var 2 a) (Compare (ConstantComplex 3.000000 4.000000 (Complex 8 [])) Eq (ConstantComplex 3.000000 4.000000 (Complex 8 [])) (Logical 4 []) (ConstantLogical .true. (Complex 8 [])) ()) ())] Source Public Implementation () .false. .false.)}) [])
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "ast-expr13-c35ace1",
3+
"cmd": "lpython --show-ast --no-color {infile} -o {outfile}",
4+
"infile": "tests/expr13.py",
5+
"infile_hash": "56a0c42089555c236b20fd1c1435908875178987c5f7f4c10ef9179a",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": "ast-expr13-c35ace1.stdout",
9+
"stdout_hash": "d3c77a603d55d96c78e421989abdb49b3ed2b8f52e660496bf76ca22",
10+
"stderr": null,
11+
"stderr_hash": null,
12+
"returncode": 0
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(Module [(FunctionDef test_Compare ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) Gt [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) LtE [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) Lt [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 5.600000 ()) GtE [(ConstantFloat 5.599990 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 3.300000 ()) Eq [(ConstantFloat 3.300000 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 3.300000 ()) NotEq [(ConstantFloat 3.400000 ())]) ()) (Assign [(Name a Store)] (Compare (Call (Name complex Load) [(ConstantInt 3 ()) (ConstantInt 4 ())] []) Eq [(Call (Name complex Load) [(ConstantFloat 3.000000 ()) (ConstantFloat 4.000000 ())] [])]) ())] [] () ())] [])

‎tests/tests.toml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ ast = true
107107
asr = true
108108
cpp = true
109109

110+
[[test]]
111+
filename = "expr13.py"
112+
ast = true
113+
asr = true
114+
110115
[[test]]
111116
filename = "expr_01.py"
112117
ast = true

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL