Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions integration_tests/test_builtin_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ def test_bin():
assert bin(i) == "-0b1000010110"
assert bin(64) == "0b1000000"
assert bin(-534) == "-0b1000010110"

test_bin()
4 changes: 4 additions & 0 deletions integration_tests/test_builtin_bool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from ltypes import i32

def test_bool():
a: i32
a = 34
Expand All @@ -6,3 +8,5 @@ def test_bool():
assert bool(a) == False
assert bool(-1) == True
assert bool(0) == False

test_bool()
9 changes: 7 additions & 2 deletions integration_tests/test_builtin_float.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from ltypes import i32

def test_float():
# TODO: the commented tests should also work
i: i32
i = 34
assert float(i) == 34.0
assert float(34) == 34.0
# assert float(i) == 34.0
i = -4235
assert float(i) == -4235.0
assert float(-4235) == -4235.0
assert float(34) == 34.0
assert float(-4235) == -4235.0


test_float()
9 changes: 7 additions & 2 deletions integration_tests/test_builtin_int.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from ltypes import f64

def test_int():
# TODO: the commented tests should also work
f: f64
f = 5.678
assert int(f) == 5
assert int(5.678) == 5
# assert int(f) == 5
f = -183745.23
assert int(f) == -183745
assert int(-183745.23) == -183745
# assert int(f) == -183745
assert int(5.5) == 5
assert int(-5.5) == -5

test_int()
21 changes: 13 additions & 8 deletions integration_tests/test_builtin_pow.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from ltypes import i32
from ltypes import i32, f64

def test_pow():
# TODO: the commented tests should also work
a: i32
b: i32
eps: f64
eps = 1e-12
a = 2
b = 5
assert pow(a, b) == 32
Expand All @@ -14,12 +17,14 @@ def test_pow():
assert pow(a, b) == 1
a = 2
b = -1
assert pow(a, b) == 0.5
assert abs(pow(2, -1) - 0.5) < eps
# assert abs(pow(a, b) - 0.5) < eps
a = 6
b = -4
assert pow(a, b) == 0.0007716049382716049
a = -3
b = -5
assert pow(a, b) == -0.00411522633744856
assert pow(0, 0) == 1
assert pow(6, -4) == 0.0007716049382716049
assert abs(pow(6, -4) - 0.0007716049382716049) < eps
# assert abs(pow(a, b) - 0.0007716049382716049) < eps
assert abs(pow(-3, -5) + 0.00411522633744856) < eps
assert abs(pow(6, -4) - 0.0007716049382716049) < eps


test_pow()
2 changes: 2 additions & 0 deletions integration_tests/test_builtin_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ def test_str_int():
assert s == "-567"
assert str(4) == "4"
assert str(-5) == "-5"

test_str_int()
4 changes: 2 additions & 2 deletions src/runtime/lpython_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def len(s: str) -> i32:
pass


def pow(x: i32, y: i32) -> i32:
def pow(x: i32, y: i32) -> f64:
"""
Returns x**y.
"""
return x**y
return 1.0*x**y


def int(f: f64) -> i32:
Expand Down
8 changes: 4 additions & 4 deletions tests/expr7.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
def test_pow():
a: i32
a: f64
a = pow(2, 2)


def test_pow_1(a: i32, b: i32) -> i32:
res: i32
def test_pow_1(a: i32, b: i32) -> f64:
res: f64
res = pow(a, b)
return res

def main0():
test_pow()
c: i32
c: f64
c = test_pow_1(1, 2)

main0()
4 changes: 2 additions & 2 deletions tests/reference/asr-expr7-480ba2f.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "asr-expr7-480ba2f",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/expr7.py",
"infile_hash": "a83bfe6c09445717f04aaf4e16cb462a75b64e2b68a93ab1d8721d1a",
"infile_hash": "fae3ed29e0e4f0db9ba4c72e0bf99afa832859b9a4e832a8e8b2f495",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-expr7-480ba2f.stdout",
"stdout_hash": "73eb6baf6de263f1404dfde6c129dd96208febba5f24afda6f7b6d9f",
"stdout_hash": "5baab06cd5a8fca7c353d4240bf1f01cadb5ce3856a0519733751f9e",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-expr7-480ba2f.stdout
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(TranslationUnit (SymbolTable 1 {_lfortran_main_program: (Subroutine (SymbolTable 21 {}) _lfortran_main_program [] [(SubroutineCall 1 main0 () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main0: (Subroutine (SymbolTable 4 {c: (Variable 4 c Local () () Default (Integer 4 []) Source Public Required .false.)}) main0 [] [(SubroutineCall 1 test_pow () [] ()) (= (Var 4 c) (FunctionCall 1 test_pow_1 () [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 20 {}) main_program [] [(SubroutineCall 1 _lfortran_main_program () [] ())]), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 6 pow lpython_builtin [] pow Private)}) test_pow [] [(= (Var 2 a) (FunctionCall 2 pow () [(ConstantInteger 2 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_pow_1: (Function (SymbolTable 3 {_lpython_return_variable: (Variable 3 _lpython_return_variable ReturnVar () () Default (Integer 4 []) Source Public Required .false.), a: (Variable 3 a In () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 3 b In () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 3 pow 6 pow lpython_builtin [] pow Private), res: (Variable 3 res Local () () Default (Integer 4 []) Source Public Required .false.)}) test_pow_1 [(Var 3 a) (Var 3 b)] [(= (Var 3 res) (FunctionCall 3 pow () [(Var 3 a) (Var 3 b)] [] (Integer 4 []) () ()) ()) (= (Var 3 _lpython_return_variable) (Var 3 res) ()) (Return)] (Var 3 _lpython_return_variable) Source Public Implementation ())}) [])
(TranslationUnit (SymbolTable 1 {_lfortran_main_program: (Subroutine (SymbolTable 21 {}) _lfortran_main_program [] [(SubroutineCall 1 main0 () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main0: (Subroutine (SymbolTable 4 {c: (Variable 4 c Local () () Default (Real 8 []) Source Public Required .false.)}) main0 [] [(SubroutineCall 1 test_pow () [] ()) (= (Var 4 c) (FunctionCall 1 test_pow_1 () [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Real 8 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 20 {}) main_program [] [(SubroutineCall 1 _lfortran_main_program () [] ())]), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Real 8 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 6 pow lpython_builtin [] pow Private)}) test_pow [] [(= (Var 2 a) (FunctionCall 2 pow () [(ConstantInteger 2 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Real 8 []) (ConstantInteger 4 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_pow_1: (Function (SymbolTable 3 {_lpython_return_variable: (Variable 3 _lpython_return_variable ReturnVar () () Default (Real 8 []) Source Public Required .false.), a: (Variable 3 a In () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 3 b In () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 3 pow 6 pow lpython_builtin [] pow Private), res: (Variable 3 res Local () () Default (Real 8 []) Source Public Required .false.)}) test_pow_1 [(Var 3 a) (Var 3 b)] [(= (Var 3 res) (FunctionCall 3 pow () [(Var 3 a) (Var 3 b)] [] (Real 8 []) () ()) ()) (= (Var 3 _lpython_return_variable) (Var 3 res) ()) (Return)] (Var 3 _lpython_return_variable) Source Public Implementation ())}) [])
4 changes: 2 additions & 2 deletions tests/reference/asr-test_builtin_bin-52ba9fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "asr-test_builtin_bin-52ba9fa",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/../integration_tests/test_builtin_bin.py",
"infile_hash": "2a1e3075df4fd5972b486cecd8f4dda8a5aa213c65923681e1cba6ae",
"infile_hash": "202a938e4c8c64b8c906fb99e1c68e0df609ff2e445cb9c90e415a82",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-test_builtin_bin-52ba9fa.stdout",
"stdout_hash": "2e72650fac268ba0176e9f858f58702af0d6aeb0ce9bb556cda52dc3",
"stdout_hash": "1e998364cd93ca8d727dafcaa21215866a5455d11fb956188a885a83",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-test_builtin_bin-52ba9fa.stdout
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 18 {}) main_program [] []), test_bin: (Subroutine (SymbolTable 2 {bin: (ExternalSymbol 2 bin 4 bin lpython_builtin [] bin Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_bin [] [(= (Var 2 i) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (ConstantInteger 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [(ConstantInteger 64 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [(UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) [])
(TranslationUnit (SymbolTable 1 {_lfortran_main_program: (Subroutine (SymbolTable 19 {}) _lfortran_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 18 {}) main_program [] [(SubroutineCall 1 _lfortran_main_program () [] ())]), test_bin: (Subroutine (SymbolTable 2 {bin: (ExternalSymbol 2 bin 4 bin lpython_builtin [] bin Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_bin [] [(= (Var 2 i) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (ConstantInteger 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [(ConstantInteger 64 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [(UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) [])
4 changes: 2 additions & 2 deletions tests/reference/asr-test_builtin_bool-330223a.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "asr-test_builtin_bool-330223a",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/../integration_tests/test_builtin_bool.py",
"infile_hash": "535d49e7c5f7b59129a0fcd9cea09d45cfb9d9ba4aad469bb6a61e4f",
"infile_hash": "dd1dc72661df287a59be2ae1869ec935c3f104d180c113ed93066a14",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-test_builtin_bool-330223a.stdout",
"stdout_hash": "54873cf84860fba38ab4c2ba91751412b56cc4dae765068ea63bfa72",
"stdout_hash": "a8568bc2cfb421e7560b39c2f18ba86c512847a81c4661428099cf19",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-test_builtin_bool-330223a.stdout
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 18 {}) main_program [] []), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bool () [(Var 2 a)] [] (Logical 1 []) () ()) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bool () [(Var 2 a)] [] (Logical 1 []) () ()) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bool () [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bool () [(ConstantInteger 0 (Integer 4 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) [])
(TranslationUnit (SymbolTable 1 {_lfortran_main_program: (Subroutine (SymbolTable 19 {}) _lfortran_main_program [] [(SubroutineCall 1 test_bool () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 18 {}) main_program [] [(SubroutineCall 1 _lfortran_main_program () [] ())]), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bool () [(Var 2 a)] [] (Logical 1 []) () ()) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bool () [(Var 2 a)] [] (Logical 1 []) () ()) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bool () [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bool () [(ConstantInteger 0 (Integer 4 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) [])
4 changes: 2 additions & 2 deletions tests/reference/asr-test_builtin_float-20601dd.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "asr-test_builtin_float-20601dd",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/../integration_tests/test_builtin_float.py",
"infile_hash": "5c163925cac63a25dd1e22ce565fcfd02f61aba23b51b9e70947303b",
"infile_hash": "e23f02607ca52c3f4e4d5d6cb6ae83d198902c82c9a94c1c113d4903",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-test_builtin_float-20601dd.stdout",
"stdout_hash": "16565a6f79135fe4b4817164006bf15c02263eba81a2b9e79a60284e",
"stdout_hash": "3a6407370c2b4a103dd12edc22f4e70778983a6c64f3c15f70e45ba3",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-test_builtin_float-20601dd.stdout
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 18 {}) main_program [] []), test_float: (Subroutine (SymbolTable 2 {float: (ExternalSymbol 2 float 4 float lpython_builtin [] float Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_float [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 float () [(Var 2 i)] [] (Real 8 []) () ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 float () [(Var 2 i)] [] (Real 8 []) () ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 float () [(ConstantInteger 34 (Integer 4 []))] [] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [(UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 [])))] [] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) [])
(TranslationUnit (SymbolTable 1 {_lfortran_main_program: (Subroutine (SymbolTable 19 {}) _lfortran_main_program [] [(SubroutineCall 1 test_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 18 {}) main_program [] [(SubroutineCall 1 _lfortran_main_program () [] ())]), test_float: (Subroutine (SymbolTable 2 {float: (ExternalSymbol 2 float 4 float lpython_builtin [] float Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_float [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 float () [(ConstantInteger 34 (Integer 4 []))] [] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 float () [(UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 [])))] [] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [(ConstantInteger 34 (Integer 4 []))] [] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [(UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 [])))] [] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) [])
4 changes: 2 additions & 2 deletions tests/reference/asr-test_builtin_int-8f88fdc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "asr-test_builtin_int-8f88fdc",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/../integration_tests/test_builtin_int.py",
"infile_hash": "799913a8a5455b15f7b29e7c5ebfe8e53170279f974c1ff83e2cd68d",
"infile_hash": "eb9db92b229665f9412a5233fcf892879890e7e34b3d1955a812c5b2",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-test_builtin_int-8f88fdc.stdout",
"stdout_hash": "1213d4f95e3bc21fd9a8ceb29f8e10aa8722a4b3c6a620a28853ad73",
"stdout_hash": "155cb50763bea99b4329f965e3a42ce5186c1b2de61f7688b545201f",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
Loading