diff --git a/integration_tests/test_builtin_abs.py b/integration_tests/test_builtin_abs.py index 3c1e7b3a3f..0809a40d4a 100644 --- a/integration_tests/test_builtin_abs.py +++ b/integration_tests/test_builtin_abs.py @@ -1,4 +1,4 @@ -from ltypes import f64 +from ltypes import f32, f64, i32 def test_abs(): x: f64 @@ -9,5 +9,19 @@ def test_abs(): assert abs(5.5) == 5.5 assert abs(-5.5) == 5.5 + x2: f32 + x2 = -5.5 + assert abs(x2) == 5.5 + + i: i32 + i = -5 + assert abs(i) == 5 + assert abs(-1) == 1 + + b: bool + b = True + assert abs(b) == 1 + b = False + assert abs(b) == 0 test_abs() diff --git a/integration_tests/test_builtin_pow.py b/integration_tests/test_builtin_pow.py index 276f97dae1..bcc6137185 100644 --- a/integration_tests/test_builtin_pow.py +++ b/integration_tests/test_builtin_pow.py @@ -17,14 +17,39 @@ def test_pow(): assert pow(a, b) == 1 a = 2 b = -1 - assert abs(pow(2, -1) - 0.5) < eps - # assert abs(pow(a, b) - 0.5) < eps + print(pow(a, b)) a = 6 b = -4 + print(pow(a, b)) + + a1: f64 + a2: f64 + a1 = 4.5 + a2 = 2.3 + assert abs(pow(a1, a2) - 31.7971929089206) < eps + assert abs(pow(a2, a1) - 42.43998894277659) < eps + + x: i32 + x = 3 + y: f64 + y = 2.3 + assert abs(pow(x, y) - 12.513502532843182) < eps + assert abs(pow(y, x) - 12.166999999999998) < eps + assert abs(pow(x, 5.5) - 420.8883462392372) < eps + + assert abs(pow(2, -1) - 0.5) < eps 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 + assert abs(pow(4.5, 2.3) - 31.7971929089206) < eps + assert abs(pow(2.3, 0.0) - 1.0) < eps + assert abs(pow(2.3, -1.5) - 0.2866871623459944) < eps + assert abs(pow(2, 3.4) - 10.556063286183154) < eps + assert abs(pow(2, -3.4) - 0.09473228540689989) < eps + assert abs(pow(3.4, 9) - 60716.99276646398) < eps + assert abs(pow(0.0, 53) - 0.0) < eps + assert pow(4, 2) == 16 + assert abs(pow(-4235.0, 52) - 3.948003805985264e+188) < eps test_pow() diff --git a/integration_tests/test_builtin_round.py b/integration_tests/test_builtin_round.py index a6458ed15b..a425819385 100644 --- a/integration_tests/test_builtin_round.py +++ b/integration_tests/test_builtin_round.py @@ -1,4 +1,4 @@ -from ltypes import f64 +from ltypes import i32, f32, f64 def test_round(): f: f64 @@ -22,5 +22,16 @@ def test_round(): assert round(50.5) == 50 assert round(56.78) == 57 + i: i32 + i = -5 + assert round(i) == -5 + assert round(4) == 4 + + b: bool + b = True + assert round(b) == 1 + b = False + assert round(b) == 0 + assert round(False) == 0 test_round() diff --git a/src/lpython/semantics/python_comptime_eval.h b/src/lpython/semantics/python_comptime_eval.h index a8b3da49dc..2a1314423b 100644 --- a/src/lpython/semantics/python_comptime_eval.h +++ b/src/lpython/semantics/python_comptime_eval.h @@ -97,26 +97,32 @@ struct PythonIntrinsicProcedures { ) { LFORTRAN_ASSERT(ASRUtils::all_args_evaluated(args)); if (args.size() != 1) { - throw SemanticError("Intrinsic abs function accepts exactly 1 argument", loc); + throw SemanticError("abs() takes exactly one argument (" + + std::to_string(args.size()) + " given)", loc); } - ASR::expr_t* trig_arg = args[0]; + ASR::expr_t* arg = args[0]; ASR::ttype_t* t = ASRUtils::expr_type(args[0]); - if (ASR::is_a(*t)) { - double rv = ASR::down_cast(trig_arg)->m_r; + ASR::ttype_t *int_type = ASRUtils::TYPE(ASR::make_Integer_t(al, loc, 4, nullptr, 0)); + ASR::ttype_t *real_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8, nullptr, 0)); + if (ASRUtils::is_real(*t)) { + double rv = ASR::down_cast(arg)->m_r; double val = std::abs(rv); - return ASR::down_cast(ASR::make_ConstantReal_t(al, loc, val, t)); - } else if (ASR::is_a(*t)) { - int64_t rv = ASR::down_cast(trig_arg)->m_n; + return ASR::down_cast(ASR::make_ConstantReal_t(al, loc, val, real_type)); + } else if (ASRUtils::is_integer(*t)) { + int64_t rv = ASR::down_cast(arg)->m_n; int64_t val = std::abs(rv); - return ASR::down_cast(ASR::make_ConstantInteger_t(al, loc, val, t)); - } else if (ASR::is_a(*t)) { - double re = ASR::down_cast(trig_arg)->m_re; - double im = ASR::down_cast(trig_arg)->m_im; + return ASR::down_cast(ASR::make_ConstantInteger_t(al, loc, val, int_type)); + } else if (ASRUtils::is_logical(*t)) { + int8_t val = ASR::down_cast(arg)->m_value; + return ASR::down_cast(ASR::make_ConstantInteger_t(al, loc, val, int_type)); + } else if (ASRUtils::is_complex(*t)) { + double re = ASR::down_cast(arg)->m_re; + double im = ASR::down_cast(arg)->m_im; std::complex x(re, im); double result = std::abs(x); - return ASR::down_cast(ASR::make_ConstantReal_t(al, loc, result, t)); + return ASR::down_cast(ASR::make_ConstantReal_t(al, loc, result, real_type)); } else { - throw SemanticError("Argument of the abs function must be Integer, Real or Complex", loc); + throw SemanticError("Argument of the abs function must be Integer, Real, Logical or Complex", loc); } } @@ -249,15 +255,12 @@ struct PythonIntrinsicProcedures { static ASR::expr_t *eval_pow(Allocator &al, const Location &loc, Vec &args) { LFORTRAN_ASSERT(ASRUtils::all_args_evaluated(args)); - ASR::expr_t* arg1 = ASRUtils::expr_value(args[0]); - ASR::expr_t* arg2 = ASRUtils::expr_value(args[1]); + ASR::expr_t* arg1 = args[0]; + ASR::expr_t* arg2 = args[1]; ASR::ttype_t* arg1_type = ASRUtils::expr_type(arg1); ASR::ttype_t* arg2_type = ASRUtils::expr_type(arg2); ASR::ttype_t *int_type = ASRUtils::TYPE(ASR::make_Integer_t(al, loc, 4, nullptr, 0)); ASR::ttype_t *real_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8, nullptr, 0)); - if (!ASRUtils::check_equal_type(arg1_type, arg2_type)) { - throw SemanticError("The arguments to pow() must have the same type.", loc); - } if (ASRUtils::is_integer(*arg1_type) && ASRUtils::is_integer(*arg2_type)) { int64_t a = ASR::down_cast(arg1)->m_n; int64_t b = ASR::down_cast(arg2)->m_n; @@ -271,8 +274,35 @@ struct PythonIntrinsicProcedures { return ASR::down_cast(make_ConstantInteger_t(al, loc, (int64_t)pow(a, b), int_type)); + } else if (ASRUtils::is_real(*arg1_type) && ASRUtils::is_real(*arg2_type)) { + double a = ASR::down_cast(arg1)->m_r; + double b = ASR::down_cast(arg2)->m_r; + if (a == 0.0 && b < 0.0) { // Zero Division + throw SemanticError("0.0 cannot be raised to a negative power.", loc); + } + return ASR::down_cast(make_ConstantReal_t(al, loc, + pow(a, b), real_type)); + + } else if (ASRUtils::is_integer(*arg1_type) && ASRUtils::is_real(*arg2_type)) { + int64_t a = ASR::down_cast(arg1)->m_n; + double b = ASR::down_cast(arg2)->m_r; + if (a == 0 && b < 0.0) { // Zero Division + throw SemanticError("0.0 cannot be raised to a negative power.", loc); + } + return ASR::down_cast(make_ConstantReal_t(al, loc, + pow(a, b), real_type)); + + } else if (ASRUtils::is_real(*arg1_type) && ASRUtils::is_integer(*arg2_type)) { + double a = ASR::down_cast(arg1)->m_r; + int64_t b = ASR::down_cast(arg2)->m_n; + if (a == 0.0 && b < 0) { // Zero Division + throw SemanticError("0.0 cannot be raised to a negative power.", loc); + } + return ASR::down_cast(make_ConstantReal_t(al, loc, + pow(a, b), real_type)); + } else { - throw SemanticError("The arguments to pow() must be of type integers for now.", loc); + throw SemanticError("The two arguments to pow() must be of type integer or float.", loc); } } @@ -423,8 +453,14 @@ struct PythonIntrinsicProcedures { if (fabs(rv-rounded) == 0.5) rounded = 2.0*round(rv/2.0); return ASR::down_cast(make_ConstantInteger_t(al, loc, rounded, type)); + } else if (ASRUtils::is_integer(*t)) { + int64_t rv = ASR::down_cast(expr)->m_n; + return ASR::down_cast(make_ConstantInteger_t(al, loc, rv, type)); + } else if (ASRUtils::is_logical(*t)) { + int64_t rv = ASR::down_cast(expr)->m_value; + return ASR::down_cast(make_ConstantInteger_t(al, loc, rv, type)); } else { - throw SemanticError("round() argument must be float for now, not '" + + throw SemanticError("round() argument must be float, integer, or logical for now, not '" + ASRUtils::type_to_str(t) + "'", loc); } } diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index 26f4743d4b..3f083e986f 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -28,8 +28,10 @@ def chr(i: i32) -> str: # exit(1) -# This is an implementation for f64. -# TODO: implement abs() as a generic procedure, and implement for all types +#: abs() as a generic procedure. +#: supported types for argument: +#: i32, f32, f64, bool, c32, c64 +@overload def abs(x: f64) -> f64: """ Return the absolute value of `x`. @@ -39,6 +41,35 @@ def abs(x: f64) -> f64: else: return -x +@overload +def abs(x: f32) -> f32: + if x >= 0.0: + return x + else: + return -x + +@overload +def abs(x: i32) -> i64: + if x >= 0: + return x + else: + return -x + +@overload +def abs(b: bool) -> i32: + if b: + return 1 + else: + return 0 + +@overload +def abs(c: c32) -> f32: + pass + +@overload +def abs(c: c64) -> f64: + pass + def str(x: i32) -> str: """ @@ -115,12 +146,30 @@ def len(s: str) -> i32: """ pass +#: pow() as a generic procedure. +#: supported types for arguments: +#: (i32, i32), (f64, f64), (i32, f64), (f64, i32) +@overload +def pow(x: i32, y: i32) -> i32: + """ + Returns x**y. + """ + return x**y -def pow(x: i32, y: i32) -> f64: +@overload +def pow(x: f64, y: f64) -> f64: """ Returns x**y. """ - return 1.0*x**y + return x**y + +@overload +def pow(x: i32, y: f64) -> f64: + return x**y + +@overload +def pow(x: f64, y: i32) -> f64: + return x**y def int(f: f64) -> i32: @@ -206,7 +255,10 @@ def oct(n: i32) -> str: res += _values[remainder] return prep + res[::-1] - +#: round() as a generic procedure. +#: supported types for argument: +#: i32, f64, bool +@overload def round(value: f64) -> i32: """ Rounds a floating point number to the nearest integer. @@ -216,6 +268,14 @@ def round(value: f64) -> i32: else: return int(value) + 1 +@overload +def round(value: i32) -> i64: + return value + +@overload +def round(b: bool) -> i32: + return abs(b) + def complex(x: f64, y: f64) -> c64: pass diff --git a/tests/constants1.py b/tests/constants1.py index 4d0d40b9ff..6ac41cb585 100644 --- a/tests/constants1.py +++ b/tests/constants1.py @@ -19,15 +19,15 @@ def test_ord_chr(): def test_abs(): - # a: i32 - # a = abs(5) - # a = abs(-500) - # a = abs(False) - # a = abs(True) + a: i32 + a = abs(5) + a = abs(-500) + a = abs(False) + a = abs(True) b: f32 b = abs(3.45) b = abs(-5346.34) - # b = abs(complex(3.45, 5.6)) + b = abs(complex(3.45, 5.6)) def test_len(): diff --git a/tests/expr7.py b/tests/expr7.py index c8894346f5..ce0d6ecdf7 100644 --- a/tests/expr7.py +++ b/tests/expr7.py @@ -1,16 +1,15 @@ def test_pow(): - a: f64 + a: i32 a = pow(2, 2) - -def test_pow_1(a: i32, b: i32) -> f64: - res: f64 +def test_pow_1(a: i32, b: i32) -> i32: + res: i32 res = pow(a, b) return res def main0(): test_pow() - c: f64 + c: i32 c = test_pow_1(1, 2) main0() diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index de9388bd60..8806a9a15d 100644 --- a/tests/reference/asr-complex1-f26c460.json +++ b/tests/reference/asr-complex1-f26c460.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex1-f26c460.stdout", - "stdout_hash": "ad6d981d374283dd344f860604121d3777ad15fd84cf52982d400ef4", + "stdout_hash": "219fe9f1acbedd5d18e1ed0d17c82f9a616e4b2e2b7ec8618fe43b1b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout index 82a988a8a1..549d3fed41 100644 --- a/tests/reference/asr-complex1-f26c460.stdout +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 28 {}) main_program [] []), test: (Subroutine (SymbolTable 3 {x: (Variable 3 x Local () () Default (Complex 8 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Complex 8 []) Source Public Required .false.), z: (Variable 3 z Local () () Default (Complex 4 []) Source Public Required .false.)}) test [] [(= (Var 3 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Mul (Var 3 x) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.), test_complex: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 4 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 5 complex lpython_builtin [] complex Private)}) test_complex [] [(= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [] [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [(ConstantReal 3.400000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [(ConstantReal 5.000000 (Real 8 [])) (ConstantReal 4.300000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [(ConstantInteger 1 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 1.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (ImplicitCast (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (ImplicitCast (FunctionCall 2 complex () [(ConstantInteger 2 (Integer 4 [])) (ConstantReal 4.500000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 2 complex () [(ConstantReal 3.000000 (Real 8 [])) (ConstantReal 4.000000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (ImplicitCast (Var 2 c1) ComplexToComplex (Complex 8 []) ()) Eq (Var 2 c3) (Logical 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Add (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c2) Sub (Var 2 c1) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Mul (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 2 complex () [(ConstantReal 3.345340 (Real 8 [])) (ConstantReal 4.867868 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [(ConstantInteger 4 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 38 {}) main_program [] []), test: (Subroutine (SymbolTable 3 {x: (Variable 3 x Local () () Default (Complex 8 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Complex 8 []) Source Public Required .false.), z: (Variable 3 z Local () () Default (Complex 4 []) Source Public Required .false.)}) test [] [(= (Var 3 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Mul (Var 3 x) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.), test_complex: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 4 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 5 complex lpython_builtin [] complex Private)}) test_complex [] [(= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [] [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [(ConstantReal 3.400000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [(ConstantReal 5.000000 (Real 8 [])) (ConstantReal 4.300000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [(ConstantInteger 1 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 1.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (ImplicitCast (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (ImplicitCast (FunctionCall 2 complex () [(ConstantInteger 2 (Integer 4 [])) (ConstantReal 4.500000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 2 complex () [(ConstantReal 3.000000 (Real 8 [])) (ConstantReal 4.000000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (ImplicitCast (Var 2 c1) ComplexToComplex (Complex 8 []) ()) Eq (Var 2 c3) (Logical 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Add (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c2) Sub (Var 2 c1) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Mul (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 2 complex () [(ConstantReal 3.345340 (Real 8 [])) (ConstantReal 4.867868 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [(ConstantInteger 4 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index 42656071b6..17f42819d1 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -2,11 +2,11 @@ "basename": "asr-constants1-5828e8a", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/constants1.py", - "infile_hash": "488c771ec7195280a10fa5247d117ac339e0df7f39fa77dfd215619e", + "infile_hash": "9d9ec520168d754127cb16a43c1d99fbd3d20ab046a8ed7c41b3b5e3", "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "261dbdd5f4f4aa1d9311c1bac34878f48ff4753ed35640b8e98db7bd", + "stdout_hash": "01f6894afa0e55501952d043a4e885d5947a27e62eb9589489ac6d7c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index da73287e89..8b87b46303 100644 --- a/tests/reference/asr-constants1-5828e8a.stdout +++ b/tests/reference/asr-constants1-5828e8a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 13 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 13 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 13 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 13 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 36 {}) main_program [] []), test_abs: (Subroutine (SymbolTable 4 {abs: (ExternalSymbol 4 abs 13 abs lpython_builtin [] abs Private), b: (Variable 4 b Local () () Default (Real 4 []) Source Public Required .false.)}) test_abs [] [(= (Var 4 b) (ImplicitCast (FunctionCall 4 abs () [(ConstantReal 3.450000 (Real 8 []))] [] (Real 8 []) (ConstantReal 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 4 abs () [(UnaryOp USub (ConstantReal 5346.340000 (Real 8 [])) (Real 8 []) (ConstantReal -5346.340000 (Real 8 [])))] [] (Real 8 []) (ConstantReal 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ())] Source Public Implementation () .false. .false.), test_bool: (Subroutine (SymbolTable 6 {a: (Variable 6 a Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 6 bool 13 bool lpython_builtin [] bool Private), complex: (ExternalSymbol 6 complex 13 complex lpython_builtin [] complex Private)}) test_bool [] [(= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [(ConstantInteger 0 (Integer 4 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [(ConstantString "" (Character 1 0 () []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_7__bool 6 bool [(FunctionCall 6 complex () [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ())] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [(ConstantString "t" (Character 1 1 () []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_3__bool 6 bool [(ConstantReal 2.300000 (Real 8 []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_boz: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Character 1 -2 () []) Source Public Required .false.), bin: (ExternalSymbol 2 bin 13 bin lpython_builtin [] bin Private), hex: (ExternalSymbol 2 hex 13 hex lpython_builtin [] hex Private), oct: (ExternalSymbol 2 oct 13 oct lpython_builtin [] oct Private)}) test_boz [] [(= (Var 2 b) (FunctionCall 2 bin () [(ConstantInteger 5 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [(ConstantInteger 64 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [(UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [(ConstantInteger 8 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [(ConstantInteger 56 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [(UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [(ConstantInteger 42 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [(ConstantInteger 12648430 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [(UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0x216" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_callable: (Subroutine (SymbolTable 8 {a: (Variable 8 a Local () () Default (Logical 1 []) Source Public Required .false.), b: (Variable 8 b Local () () Default (Integer 4 []) Source Public Required .false.)}) test_callable [] [(= (Var 8 b) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 8 a) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_divmod: (Subroutine (SymbolTable 11 {a: (Variable 11 a Local () () Default (Tuple [(Integer 4 []) (Integer 4 [])]) Source Public Required .false.), divmod: (ExternalSymbol 11 divmod 13 divmod lpython_builtin [] divmod Private)}) test_divmod [] [(= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 9 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 9 (Integer 4 [])) (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 [])))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger -3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 4 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ())] Source Public Implementation () .false. .false.), test_float: (Subroutine (SymbolTable 10 {a: (Variable 10 a Local () () Default (Real 8 []) Source Public Required .false.), float: (ExternalSymbol 10 float 13 float lpython_builtin [] float Private)}) test_float [] [(= (Var 10 a) (FunctionCall 10 float () [] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantReal 4.560000 (Real 8 []))] [] (Real 8 []) (ConstantReal 4.560000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantInteger 5 (Integer 4 []))] [] (Real 8 []) (ConstantReal 5.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Real 8 []) (ConstantReal -1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantLogical .true. (Logical 1 []))] [] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantLogical .false. (Logical 1 []))] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantString "5346" (Character 1 4 () []))] [] (Real 8 []) (ConstantReal 5346.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantString "423.534" (Character 1 7 () []))] [] (Real 8 []) (ConstantReal 423.533997 (Real 8 [])) ()) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.), int: (ExternalSymbol 9 int 13 int lpython_builtin [] int Private)}) test_int [] [(= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantReal 4.560000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantInteger 5 (Integer 4 []))] [] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(UnaryOp USub (ConstantReal 5.000010 (Real 8 [])) (Real 8 []) (ConstantReal -5.000010 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantLogical .true. (Logical 1 []))] [] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantLogical .false. (Logical 1 []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantString "5346" (Character 1 4 () []))] [] (Integer 4 []) (ConstantInteger 5346 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ())] Source Public Implementation () .false. .false.), test_len: (Subroutine (SymbolTable 5 {a: (Variable 5 a Local () () Default (Integer 4 []) Source Public Required .false.), len: (ExternalSymbol 5 len 13 len lpython_builtin [] len Private)}) test_len [] [(= (Var 5 a) (FunctionCall 5 len () [(ConstantString "" (Character 1 0 () []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantString "test" (Character 1 4 () []))] [] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantString "this is a test" (Character 1 14 () []))] [] (Integer 4 []) (ConstantInteger 14 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 []) (Integer 4 [])]))] [] (Integer 4 []) (ConstantInteger 3 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantTuple [(ConstantTuple [(ConstantString "a" (Character 1 1 () [])) (ConstantString "b" (Character 1 1 () [])) (ConstantReal 3.400000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])])) (ConstantTuple [(ConstantString "c" (Character 1 1 () [])) (ConstantInteger 3 (Integer 4 [])) (ConstantReal 5.600000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])]))] (Tuple [(Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])]) (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])])]))] [] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantArray [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Integer 4 []))] [] (Integer 4 []) (ConstantInteger 3 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantArray [(ConstantArray [(UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) (UnaryOp USub (ConstantInteger 6 (Integer 4 [])) (Integer 4 []) (ConstantInteger -6 (Integer 4 [])))] (Integer 4 [])) (ConstantArray [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []) (ConstantInteger -2 (Integer 4 []))) (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 [])))] (Integer 4 []))] (Integer 4 []))] [] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantSet [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Set (Integer 4 [])))] [] (Integer 4 []) (ConstantInteger 3 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantDictionary [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] [(ConstantString "a" (Character 1 1 () [])) (ConstantString "b" (Character 1 1 () [])) (ConstantString "c" (Character 1 1 () []))] (Dict (Integer 4 []) (Character 1 1 () [])))] [] (Integer 4 []) (ConstantInteger 3 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord_chr: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 13 chr lpython_builtin [] chr Private), ord: (ExternalSymbol 3 ord 13 ord lpython_builtin [] ord Private), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord_chr [] [(= (Var 3 a) (FunctionCall 3 ord () [(ConstantString "5" (Character 1 1 () []))] [] (Integer 4 []) (ConstantInteger 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [(ConstantInteger 43 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "+" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_str: (Subroutine (SymbolTable 7 {s: (Variable 7 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 7 str 13 str lpython_builtin [] str Private)}) test_str [] [(= (Var 7 s) (FunctionCall 7 str () [] [] (Character 1 -2 () []) (ConstantString "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantInteger 5 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantReal 5.600000 (Real 8 []))] [] (Character 1 -2 () []) (ConstantString "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantLogical .true. (Logical 1 []))] [] (Character 1 -2 () []) (ConstantString "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantLogical .false. (Logical 1 []))] [] (Character 1 -2 () []) (ConstantString "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantString "5346" (Character 1 4 () []))] [] (Character 1 -2 () []) (ConstantString "5346" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 13 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 13 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 13 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 13 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 13 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 13 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 13 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 13 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 46 {}) main_program [] []), test_abs: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () () Default (Integer 4 []) Source Public Required .false.), abs: (ExternalSymbol 4 abs 13 abs lpython_builtin [] abs Private), b: (Variable 4 b Local () () Default (Real 4 []) Source Public Required .false.), complex: (ExternalSymbol 4 complex 13 complex lpython_builtin [] complex Private)}) test_abs [] [(= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [(ConstantInteger 5 (Integer 4 []))] [] (Integer 8 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [(UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 [])))] [] (Integer 8 []) (ConstantInteger 500 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [(ConstantLogical .false. (Logical 1 []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [(ConstantLogical .true. (Logical 1 []))] [] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [(ConstantReal 3.450000 (Real 8 []))] [] (Real 8 []) (ConstantReal 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [(UnaryOp USub (ConstantReal 5346.340000 (Real 8 [])) (Real 8 []) (ConstantReal -5346.340000 (Real 8 [])))] [] (Real 8 []) (ConstantReal 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_5__abs 4 abs [(FunctionCall 4 complex () [(ConstantReal 3.450000 (Real 8 [])) (ConstantReal 5.600000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.450000 5.600000 (Complex 8 [])) ())] [] (Real 8 []) (ConstantReal 6.577424 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ())] Source Public Implementation () .false. .false.), test_bool: (Subroutine (SymbolTable 6 {a: (Variable 6 a Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 6 bool 13 bool lpython_builtin [] bool Private), complex: (ExternalSymbol 6 complex 13 complex lpython_builtin [] complex Private)}) test_bool [] [(= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [(ConstantInteger 0 (Integer 4 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [(ConstantString "" (Character 1 0 () []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_7__bool 6 bool [(FunctionCall 6 complex () [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ())] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [(ConstantString "t" (Character 1 1 () []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_3__bool 6 bool [(ConstantReal 2.300000 (Real 8 []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_boz: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Character 1 -2 () []) Source Public Required .false.), bin: (ExternalSymbol 2 bin 13 bin lpython_builtin [] bin Private), hex: (ExternalSymbol 2 hex 13 hex lpython_builtin [] hex Private), oct: (ExternalSymbol 2 oct 13 oct lpython_builtin [] oct Private)}) test_boz [] [(= (Var 2 b) (FunctionCall 2 bin () [(ConstantInteger 5 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [(ConstantInteger 64 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [(UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [(ConstantInteger 8 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [(ConstantInteger 56 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [(UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [(ConstantInteger 42 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [(ConstantInteger 12648430 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [(UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0x216" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_callable: (Subroutine (SymbolTable 8 {a: (Variable 8 a Local () () Default (Logical 1 []) Source Public Required .false.), b: (Variable 8 b Local () () Default (Integer 4 []) Source Public Required .false.)}) test_callable [] [(= (Var 8 b) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 8 a) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_divmod: (Subroutine (SymbolTable 11 {a: (Variable 11 a Local () () Default (Tuple [(Integer 4 []) (Integer 4 [])]) Source Public Required .false.), divmod: (ExternalSymbol 11 divmod 13 divmod lpython_builtin [] divmod Private)}) test_divmod [] [(= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 9 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 9 (Integer 4 [])) (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 [])))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger -3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 4 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))] [] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ())] Source Public Implementation () .false. .false.), test_float: (Subroutine (SymbolTable 10 {a: (Variable 10 a Local () () Default (Real 8 []) Source Public Required .false.), float: (ExternalSymbol 10 float 13 float lpython_builtin [] float Private)}) test_float [] [(= (Var 10 a) (FunctionCall 10 float () [] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantReal 4.560000 (Real 8 []))] [] (Real 8 []) (ConstantReal 4.560000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantInteger 5 (Integer 4 []))] [] (Real 8 []) (ConstantReal 5.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Real 8 []) (ConstantReal -1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantLogical .true. (Logical 1 []))] [] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantLogical .false. (Logical 1 []))] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantString "5346" (Character 1 4 () []))] [] (Real 8 []) (ConstantReal 5346.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [(ConstantString "423.534" (Character 1 7 () []))] [] (Real 8 []) (ConstantReal 423.533997 (Real 8 [])) ()) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.), int: (ExternalSymbol 9 int 13 int lpython_builtin [] int Private)}) test_int [] [(= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantReal 4.560000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantInteger 5 (Integer 4 []))] [] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(UnaryOp USub (ConstantReal 5.000010 (Real 8 [])) (Real 8 []) (ConstantReal -5.000010 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantLogical .true. (Logical 1 []))] [] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantLogical .false. (Logical 1 []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [(ConstantString "5346" (Character 1 4 () []))] [] (Integer 4 []) (ConstantInteger 5346 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ())] Source Public Implementation () .false. .false.), test_len: (Subroutine (SymbolTable 5 {a: (Variable 5 a Local () () Default (Integer 4 []) Source Public Required .false.), len: (ExternalSymbol 5 len 13 len lpython_builtin [] len Private)}) test_len [] [(= (Var 5 a) (FunctionCall 5 len () [(ConstantString "" (Character 1 0 () []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantString "test" (Character 1 4 () []))] [] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantString "this is a test" (Character 1 14 () []))] [] (Integer 4 []) (ConstantInteger 14 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 []) (Integer 4 [])]))] [] (Integer 4 []) (ConstantInteger 3 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantTuple [(ConstantTuple [(ConstantString "a" (Character 1 1 () [])) (ConstantString "b" (Character 1 1 () [])) (ConstantReal 3.400000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])])) (ConstantTuple [(ConstantString "c" (Character 1 1 () [])) (ConstantInteger 3 (Integer 4 [])) (ConstantReal 5.600000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])]))] (Tuple [(Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])]) (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])])]))] [] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantArray [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Integer 4 []))] [] (Integer 4 []) (ConstantInteger 3 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantArray [(ConstantArray [(UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) (UnaryOp USub (ConstantInteger 6 (Integer 4 [])) (Integer 4 []) (ConstantInteger -6 (Integer 4 [])))] (Integer 4 [])) (ConstantArray [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []) (ConstantInteger -2 (Integer 4 []))) (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 [])))] (Integer 4 []))] (Integer 4 []))] [] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantSet [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Set (Integer 4 [])))] [] (Integer 4 []) (ConstantInteger 3 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [(ConstantDictionary [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] [(ConstantString "a" (Character 1 1 () [])) (ConstantString "b" (Character 1 1 () [])) (ConstantString "c" (Character 1 1 () []))] (Dict (Integer 4 []) (Character 1 1 () [])))] [] (Integer 4 []) (ConstantInteger 3 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord_chr: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 13 chr lpython_builtin [] chr Private), ord: (ExternalSymbol 3 ord 13 ord lpython_builtin [] ord Private), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord_chr [] [(= (Var 3 a) (FunctionCall 3 ord () [(ConstantString "5" (Character 1 1 () []))] [] (Integer 4 []) (ConstantInteger 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [(ConstantInteger 43 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "+" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_str: (Subroutine (SymbolTable 7 {s: (Variable 7 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 7 str 13 str lpython_builtin [] str Private)}) test_str [] [(= (Var 7 s) (FunctionCall 7 str () [] [] (Character 1 -2 () []) (ConstantString "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantInteger 5 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantReal 5.600000 (Real 8 []))] [] (Character 1 -2 () []) (ConstantString "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantLogical .true. (Logical 1 []))] [] (Character 1 -2 () []) (ConstantString "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantLogical .false. (Logical 1 []))] [] (Character 1 -2 () []) (ConstantString "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [(ConstantString "5346" (Character 1 4 () []))] [] (Character 1 -2 () []) (ConstantString "5346" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr1-8df2d66.json b/tests/reference/asr-expr1-8df2d66.json index fa806a991f..030df7bed8 100644 --- a/tests/reference/asr-expr1-8df2d66.json +++ b/tests/reference/asr-expr1-8df2d66.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr1-8df2d66.stdout", - "stdout_hash": "23bbf3eb19f89608557e3f47c5123b78f571253c72c0b05931ed3d46", + "stdout_hash": "3069f66225444fbbefdf48f93e127d91cb2e7baabc4815b3fc4e8d0d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr1-8df2d66.stdout b/tests/reference/asr-expr1-8df2d66.stdout index 5b5bd6b744..0586e2f678 100644 --- a/tests/reference/asr-expr1-8df2d66.stdout +++ b/tests/reference/asr-expr1-8df2d66.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] []), test_namedexpr: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 4 ord lpython_builtin [] ord Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Integer 4 []) Source Public Required .false.)}) test_namedexpr [] [(= (Var 2 x) (NamedExpr (Var 2 y) (ConstantInteger 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [(ConstantString "3" (Character 1 1 () []))] [] (Integer 4 []) (ConstantInteger 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (ConstantInteger 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (ConstantInteger 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] []), test_namedexpr: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 4 ord lpython_builtin [] ord Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Integer 4 []) Source Public Required .false.)}) test_namedexpr [] [(= (Var 2 x) (NamedExpr (Var 2 y) (ConstantInteger 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [(ConstantString "3" (Character 1 1 () []))] [] (Integer 4 []) (ConstantInteger 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (ConstantInteger 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (ConstantInteger 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr10-efcbb1b.json b/tests/reference/asr-expr10-efcbb1b.json index 70355f3923..9725dc13f9 100644 --- a/tests/reference/asr-expr10-efcbb1b.json +++ b/tests/reference/asr-expr10-efcbb1b.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr10-efcbb1b.stdout", - "stdout_hash": "34c41e698593e4c015341a7e8023a4e2353dd851162f6e110343a015", + "stdout_hash": "d107c1e673b880fe8e1176fff919733e78cfc42ee07edb7e066a4bb8", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout index ebfc863801..cb95892511 100644 --- a/tests/reference/asr-expr10-efcbb1b.stdout +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] []), test_UnaryOp: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), b3: (Variable 2 b3 Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), f: (Variable 2 f Local () () Default (Real 4 []) Source Public Required .false.)}) test_UnaryOp [] [(= (Var 2 a) (UnaryOp UAdd (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f) (ImplicitCast (UnaryOp UAdd (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (ImplicitCast (UnaryOp USub (ConstantReal 183745.534000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (ConstantLogical .false. (Logical 1 [])) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantLogical .false. (Logical 1 [])) (Integer 4 []) (ConstantInteger 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger -2 (Integer 4 []))) ()) (= (Var 2 c) (ImplicitCast (UnaryOp UAdd (FunctionCall 2 complex () [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (UnaryOp USub (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantReal 65.000000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 2 complex () [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] []), test_UnaryOp: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), b3: (Variable 2 b3 Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), f: (Variable 2 f Local () () Default (Real 4 []) Source Public Required .false.)}) test_UnaryOp [] [(= (Var 2 a) (UnaryOp UAdd (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f) (ImplicitCast (UnaryOp UAdd (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (ImplicitCast (UnaryOp USub (ConstantReal 183745.534000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (ConstantLogical .false. (Logical 1 [])) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantLogical .false. (Logical 1 [])) (Integer 4 []) (ConstantInteger 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger -2 (Integer 4 []))) ()) (= (Var 2 c) (ImplicitCast (UnaryOp UAdd (FunctionCall 2 complex () [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (UnaryOp USub (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantReal 65.000000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 2 complex () [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index 0a68fcce96..a5dc4beb14 100644 --- a/tests/reference/asr-expr13-81bdb5a.json +++ b/tests/reference/asr-expr13-81bdb5a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr13-81bdb5a.stdout", - "stdout_hash": "d7c6b5c1ddf9fe7325ac9a2eff6c3c1be3342eda1fd7b49ccfca57a2", + "stdout_hash": "87c2f94c76d54ad64dd688033613b3ddd62d32ab00019daa4d75e444", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index 88f2001929..867788f7eb 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) LtE (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Lt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 5.600000 (Real 8 [])) GtE (ConstantReal 5.599990 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) Eq (ConstantReal 3.300000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) NotEq (ConstantReal 3.400000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 2 complex () [(ConstantReal 3.000000 (Real 8 [])) (ConstantReal 4.000000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Gt (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Lt (ConstantString "s" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "-abs" (Character 1 4 () [])) GtE (ConstantString "abs" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abcd" (Character 1 4 () [])) LtE (ConstantString "abcde" (Character 1 5 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Eq (ConstantString "abc" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) NotEq (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Eq (ConstantString "+" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Gt (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) NotEq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) GtE (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) LtE (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Lt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 5.600000 (Real 8 [])) GtE (ConstantReal 5.599990 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) Eq (ConstantReal 3.300000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) NotEq (ConstantReal 3.400000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 2 complex () [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 2 complex () [(ConstantReal 3.000000 (Real 8 [])) (ConstantReal 4.000000 (Real 8 []))] [] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Gt (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Lt (ConstantString "s" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "-abs" (Character 1 4 () [])) GtE (ConstantString "abs" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abcd" (Character 1 4 () [])) LtE (ConstantString "abcde" (Character 1 5 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Eq (ConstantString "abc" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) NotEq (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Eq (ConstantString "+" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Gt (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) NotEq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) GtE (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr7-480ba2f.json b/tests/reference/asr-expr7-480ba2f.json index 8cb219d149..1e3aa64dd7 100644 --- a/tests/reference/asr-expr7-480ba2f.json +++ b/tests/reference/asr-expr7-480ba2f.json @@ -2,11 +2,11 @@ "basename": "asr-expr7-480ba2f", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/expr7.py", - "infile_hash": "fae3ed29e0e4f0db9ba4c72e0bf99afa832859b9a4e832a8e8b2f495", + "infile_hash": "4a455e2279eb7dd269d81c1a257dea625b17b100d92e304e5ac34421", "outfile": null, "outfile_hash": null, "stdout": "asr-expr7-480ba2f.stdout", - "stdout_hash": "89c3c23aae4c7b238b9004671bdae3a6c732b7f1ecb09d9ed7776f88", + "stdout_hash": "18355b490c6f9e0360d341cfa2eab28d5b9e3efea8fbbbb05b508638", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout index dcc4ca3951..5cded56c8b 100644 --- a/tests/reference/asr-expr7-480ba2f.stdout +++ b/tests/reference/asr-expr7-480ba2f.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 30 {}) _lpython_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 29 {}) main_program [] [(SubroutineCall 1 _lpython_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 ())}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_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 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 6 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), 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 1 pow@__lpython_overloaded_0__pow 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 1 pow@__lpython_overloaded_0__pow 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 ())}) []) diff --git a/tests/reference/asr-test_builtin-aa64615.json b/tests/reference/asr-test_builtin-aa64615.json index d52c9459fa..e2b3440fa0 100644 --- a/tests/reference/asr-test_builtin-aa64615.json +++ b/tests/reference/asr-test_builtin-aa64615.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin-aa64615.stdout", - "stdout_hash": "debd98109fd526f42ebff36428d90aea61845c27484127dff2ae3abb", + "stdout_hash": "ef77a59ad6c01f278550229b07e44c38240793d4def1ddbd3b2b88f2", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin-aa64615.stdout b/tests/reference/asr-test_builtin-aa64615.stdout index 633ec5682a..173fde290d 100644 --- a/tests/reference/asr-test_builtin-aa64615.stdout +++ b/tests/reference/asr-test_builtin-aa64615.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 29 {}) _lpython_main_program [] [(SubroutineCall 1 test_ord () [] ()) (SubroutineCall 1 test_chr () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 28 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (ConstantInteger 48 (Integer 4 [])) ()) (= (Var 3 s) (FunctionCall 3 chr () [(Var 3 i)] [] (Character 1 -2 () []) () ()) ()) (Assert (Compare (Var 3 s) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [(ConstantInteger 48 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0" (Character 1 1 () [])) ()) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (ConstantString "1" (Character 1 1 () [])) ()) (= (Var 2 i) (FunctionCall 2 ord () [(Var 2 s)] [] (Integer 4 []) () ()) ()) (Assert (Compare (Var 2 i) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [(ConstantString "1" (Character 1 1 () []))] [] (Integer 4 []) (ConstantInteger 49 (Integer 4 [])) ()) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 39 {}) _lpython_main_program [] [(SubroutineCall 1 test_ord () [] ()) (SubroutineCall 1 test_chr () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 38 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (ConstantInteger 48 (Integer 4 [])) ()) (= (Var 3 s) (FunctionCall 3 chr () [(Var 3 i)] [] (Character 1 -2 () []) () ()) ()) (Assert (Compare (Var 3 s) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [(ConstantInteger 48 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0" (Character 1 1 () [])) ()) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (ConstantString "1" (Character 1 1 () [])) ()) (= (Var 2 i) (FunctionCall 2 ord () [(Var 2 s)] [] (Integer 4 []) () ()) ()) (Assert (Compare (Var 2 i) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [(ConstantString "1" (Character 1 1 () []))] [] (Integer 4 []) (ConstantInteger 49 (Integer 4 [])) ()) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_abs-c74d2c9.json b/tests/reference/asr-test_builtin_abs-c74d2c9.json index 94545d1f1c..8bdf69c542 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.json +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.json @@ -2,11 +2,11 @@ "basename": "asr-test_builtin_abs-c74d2c9", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/test_builtin_abs.py", - "infile_hash": "196e1cd7d641336a4bb317f947ec4e3369a0e62a4da29af1a9c20946", + "infile_hash": "1d3a2fe34e71f8cedfab4b2a0587c6057236cceff793e4fed506652c", "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_abs-c74d2c9.stdout", - "stdout_hash": "710543f9732f0b3973e4a29a9e396e6330c8a3f991997a3de4b60b0f", + "stdout_hash": "a0f2fbefb38c4a8aa8b037d86fcd39a6fcf4e50bbbaa0eaf12f1925e", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout index 31a384c723..28abfe49f8 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_abs () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_abs: (Subroutine (SymbolTable 2 {abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), x: (Variable 2 x Local () () Default (Real 8 []) Source Public Required .false.)}) test_abs [] [(= (Var 2 x) (ConstantReal 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 2 abs () [(Var 2 x)] [] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 2 abs () [(Var 2 x)] [] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 abs () [(ConstantReal 5.500000 (Real 8 []))] [] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 abs () [(UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 [])))] [] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_abs () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_1__abs: (ExternalSymbol 1 abs@__lpython_overloaded_1__abs 4 __lpython_overloaded_1__abs lpython_builtin [] __lpython_overloaded_1__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 4 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 4 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_abs: (Subroutine (SymbolTable 2 {abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Real 8 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_abs [] [(= (Var 2 x) (ConstantReal 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(Var 2 x)] [] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(Var 2 x)] [] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(ConstantReal 5.500000 (Real 8 []))] [] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 [])))] [] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (ImplicitCast (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [(Var 2 x2)] [] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [(Var 2 i)] [] (Integer 8 []) () ()) Eq (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Integer 8 []) (ConstantInteger 1 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [(Var 2 b)] [] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [(Var 2 b)] [] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.json b/tests/reference/asr-test_builtin_bin-52ba9fa.json index c21f4ce993..9d5cf0a3ef 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.json +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bin-52ba9fa.stdout", - "stdout_hash": "ff0b7cb38dc3e74f5319975f5b266cecd2d7134cb1d0b994541961da", + "stdout_hash": "0c86b499a7cc7a8621b818ddb4860e392b1d6999f95c21d660ce758e", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout index a08f636c5e..6131ec7643 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_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 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_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.)}) []) diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json index f05ceccea8..407f208570 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.json +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bool-330223a.stdout", - "stdout_hash": "b37431f7fe4835aa1c93b1a2e6feee963113531a528a4842f4be3174", + "stdout_hash": "2c612429950b232dfbeb3581a7591e41b3b028c7ed471988d2159e87", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_bool-330223a.stdout b/tests/reference/asr-test_builtin_bool-330223a.stdout index 17f34b2444..2c047f8c40 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.stdout +++ b/tests/reference/asr-test_builtin_bool-330223a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_bool () [] ())] Source Public Implementation () .false. .false.), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 4 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_1__bool: (ExternalSymbol 1 bool@__lpython_overloaded_1__bool 4 __lpython_overloaded_1__bool lpython_builtin [] __lpython_overloaded_1__bool Public), bool@__lpython_overloaded_2__bool: (ExternalSymbol 1 bool@__lpython_overloaded_2__bool 4 __lpython_overloaded_2__bool lpython_builtin [] __lpython_overloaded_2__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 4 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 4 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 4 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Integer 8 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [(Var 2 a)] [] (Logical 1 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [(Var 2 a)] [] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [(ConstantInteger 0 (Integer 4 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 a2) (ImplicitCast (ConstantInteger 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [(Var 2 a2)] [] (Logical 1 []) () ()) ()) (= (Var 2 f) (ConstantReal 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [(Var 2 f)] [] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (ConstantReal 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [(Var 2 f)] [] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [(ConstantReal 56.786866 (Real 8 []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [(ConstantReal 0.000000 (Real 8 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f2) (ImplicitCast (UnaryOp USub (ConstantReal 235.600000 (Real 8 [])) (Real 8 []) (ConstantReal -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [(Var 2 f2)] [] (Logical 1 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [(Var 2 s)] [] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (ConstantString "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [(Var 2 s)] [] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [(ConstantString "" (Character 1 0 () []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [(ConstantString "str" (Character 1 3 () []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [(Var 2 b)] [] (Logical 1 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [(Var 2 b)] [] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [(ConstantLogical .true. (Logical 1 []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [(ConstantLogical .false. (Logical 1 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_bool () [] ())] Source Public Implementation () .false. .false.), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 4 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_1__bool: (ExternalSymbol 1 bool@__lpython_overloaded_1__bool 4 __lpython_overloaded_1__bool lpython_builtin [] __lpython_overloaded_1__bool Public), bool@__lpython_overloaded_2__bool: (ExternalSymbol 1 bool@__lpython_overloaded_2__bool 4 __lpython_overloaded_2__bool lpython_builtin [] __lpython_overloaded_2__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 4 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 4 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 4 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Integer 8 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [(Var 2 a)] [] (Logical 1 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [(Var 2 a)] [] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [(ConstantInteger 0 (Integer 4 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 a2) (ImplicitCast (ConstantInteger 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [(Var 2 a2)] [] (Logical 1 []) () ()) ()) (= (Var 2 f) (ConstantReal 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [(Var 2 f)] [] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (ConstantReal 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [(Var 2 f)] [] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [(ConstantReal 56.786866 (Real 8 []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [(ConstantReal 0.000000 (Real 8 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f2) (ImplicitCast (UnaryOp USub (ConstantReal 235.600000 (Real 8 [])) (Real 8 []) (ConstantReal -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [(Var 2 f2)] [] (Logical 1 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [(Var 2 s)] [] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (ConstantString "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [(Var 2 s)] [] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [(ConstantString "" (Character 1 0 () []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [(ConstantString "str" (Character 1 3 () []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [(Var 2 b)] [] (Logical 1 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [(Var 2 b)] [] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [(ConstantLogical .true. (Logical 1 []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [(ConstantLogical .false. (Logical 1 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_float-20601dd.json b/tests/reference/asr-test_builtin_float-20601dd.json index 1c7165e564..ede9ace91d 100644 --- a/tests/reference/asr-test_builtin_float-20601dd.json +++ b/tests/reference/asr-test_builtin_float-20601dd.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_float-20601dd.stdout", - "stdout_hash": "8db190623558eb326908459ba434131b8431092a5b488292b6df9bbf", + "stdout_hash": "7761681ef36721431abc17d387adb72374c29db6c35c94a79852e896", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_float-20601dd.stdout b/tests/reference/asr-test_builtin_float-20601dd.stdout index cbae8ebb41..288e5b3428 100644 --- a/tests/reference/asr-test_builtin_float-20601dd.stdout +++ b/tests/reference/asr-test_builtin_float-20601dd.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_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.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_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.)}) []) diff --git a/tests/reference/asr-test_builtin_hex-64bd268.json b/tests/reference/asr-test_builtin_hex-64bd268.json index 48721bd3ec..46fdf7a9d5 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.json +++ b/tests/reference/asr-test_builtin_hex-64bd268.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_hex-64bd268.stdout", - "stdout_hash": "b2dc4714e9d131f1d30baec3a7d939e2a96e5e67e8fcd484b6f6bf31", + "stdout_hash": "933299577367e3dc30f73faf39e0e1611183be3acd986a1e64ee8b83", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_hex-64bd268.stdout b/tests/reference/asr-test_builtin_hex-64bd268.stdout index f4769de658..63cc29ceaf 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.stdout +++ b/tests/reference/asr-test_builtin_hex-64bd268.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_hex: (Subroutine (SymbolTable 2 {hex: (ExternalSymbol 2 hex 4 hex lpython_builtin [] hex Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_hex [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [(ConstantInteger 34 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0x22" (Character 1 1 () [])) ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [(UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0x108b" (Character 1 1 () [])) ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_hex: (Subroutine (SymbolTable 2 {hex: (ExternalSymbol 2 hex 4 hex lpython_builtin [] hex Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_hex [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [(ConstantInteger 34 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0x22" (Character 1 1 () [])) ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [(UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0x108b" (Character 1 1 () [])) ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_int-8f88fdc.json b/tests/reference/asr-test_builtin_int-8f88fdc.json index 8ff295facb..5d9862ac82 100644 --- a/tests/reference/asr-test_builtin_int-8f88fdc.json +++ b/tests/reference/asr-test_builtin_int-8f88fdc.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_int-8f88fdc.stdout", - "stdout_hash": "503cf4277f11c3b8625c3ff3d5cf0b850eb8f501abc78fee737b4932", + "stdout_hash": "376febcf8ab58acea59babf86a56592b1a3629e3fb958dca2361ba3d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_int-8f88fdc.stdout b/tests/reference/asr-test_builtin_int-8f88fdc.stdout index 28288fdccd..45ab59635a 100644 --- a/tests/reference/asr-test_builtin_int-8f88fdc.stdout +++ b/tests/reference/asr-test_builtin_int-8f88fdc.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_int: (Subroutine (SymbolTable 2 {f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), int: (ExternalSymbol 2 int 4 int lpython_builtin [] int Private)}) test_int [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 2 int () [(ConstantReal 5.678000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 2 int () [(UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger -183745 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 183745 (Integer 4 [])) (Integer 4 []) (ConstantInteger -183745 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [(ConstantReal 5.500000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [(UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_int: (Subroutine (SymbolTable 2 {f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), int: (ExternalSymbol 2 int 4 int lpython_builtin [] int Private)}) test_int [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 2 int () [(ConstantReal 5.678000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 2 int () [(UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger -183745 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 183745 (Integer 4 [])) (Integer 4 []) (ConstantInteger -183745 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [(ConstantReal 5.500000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [(UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_len-55b0dec.json b/tests/reference/asr-test_builtin_len-55b0dec.json index c90d4166e4..34dedebe0a 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.json +++ b/tests/reference/asr-test_builtin_len-55b0dec.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_len-55b0dec.stdout", - "stdout_hash": "c01055927ea8e5b884392e07e8d61d50fc651757c37641f7172cad29", + "stdout_hash": "12a57ebb39584cea9d5cb740bb620656f422f789791954004c04032b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_len-55b0dec.stdout b/tests/reference/asr-test_builtin_len-55b0dec.stdout index 7c48cbd48e..5ab4c8e330 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.stdout +++ b/tests/reference/asr-test_builtin_len-55b0dec.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_len () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_len: (Subroutine (SymbolTable 2 {len: (ExternalSymbol 2 len 4 len lpython_builtin [] len Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_len [] [(= (Var 2 s) (ConstantString "abcd" (Character 1 4 () [])) ()) (Assert (Compare (FunctionCall 2 len () [(Var 2 s)] [] (Integer 4 []) () ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (Compare (FunctionCall 2 len () [(Var 2 s)] [] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 len () [(ConstantString "abcd" (Character 1 4 () []))] [] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 len () [(ConstantString "" (Character 1 0 () []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_len () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_len: (Subroutine (SymbolTable 2 {len: (ExternalSymbol 2 len 4 len lpython_builtin [] len Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_len [] [(= (Var 2 s) (ConstantString "abcd" (Character 1 4 () [])) ()) (Assert (Compare (FunctionCall 2 len () [(Var 2 s)] [] (Integer 4 []) () ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (Compare (FunctionCall 2 len () [(Var 2 s)] [] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 len () [(ConstantString "abcd" (Character 1 4 () []))] [] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 len () [(ConstantString "" (Character 1 0 () []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index 9d5b4ede6c..056471af52 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.json +++ b/tests/reference/asr-test_builtin_oct-20b9066.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_oct-20b9066.stdout", - "stdout_hash": "37fd4988209488c00ec2b610c6aa81e8b1db6db9d58e502f770dd400", + "stdout_hash": "5e29f217e5063bbee9851a5a8003a51d509c97d7e681c8fbea9453b0", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_oct-20b9066.stdout b/tests/reference/asr-test_builtin_oct-20b9066.stdout index 3f9a64eb46..b3b941587b 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.stdout +++ b/tests/reference/asr-test_builtin_oct-20b9066.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_oct: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), oct: (ExternalSymbol 2 oct 4 oct lpython_builtin [] oct Private)}) test_oct [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [(ConstantInteger 34 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0o42" (Character 1 1 () [])) ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [(UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0o10213" (Character 1 1 () [])) ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_oct: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), oct: (ExternalSymbol 2 oct 4 oct lpython_builtin [] oct Private)}) test_oct [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [(Var 2 i)] [] (Character 1 -2 () []) () ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [(ConstantInteger 34 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "0o42" (Character 1 1 () [])) ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [(UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-0o10213" (Character 1 1 () [])) ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index c29a1bc129..d385338fc7 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.json +++ b/tests/reference/asr-test_builtin_pow-f02fcda.json @@ -2,11 +2,11 @@ "basename": "asr-test_builtin_pow-f02fcda", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/test_builtin_pow.py", - "infile_hash": "3b620c15ec6e5d491f129f43e59ff743a033d6ae3109b6f14a64e51a", + "infile_hash": "a43827864d94f879b4364cde16489730187a20a012c6ce65a171cf78", "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_pow-f02fcda.stdout", - "stdout_hash": "97e021858447c5e6ff9641c10378a5ba680924ba681fafa650da6736", + "stdout_hash": "527c552454bb4766fc2c4e5f9486fc030d16b8b8b773a01a13960d74", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index df49bda1e6..5789bed594 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.stdout +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_pow () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Integer 4 []) Source Public Required .false.), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private)}) test_pow [] [(= (Var 2 eps) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 pow () [(Var 2 a) (Var 2 b)] [] (Real 8 []) () ()) Eq (ImplicitCast (ConstantInteger 32 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 pow () [(Var 2 a) (Var 2 b)] [] (Real 8 []) () ()) Eq (ImplicitCast (ConstantInteger 216 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 pow () [(Var 2 a) (Var 2 b)] [] (Real 8 []) () ()) Eq (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 abs () [(BinOp (FunctionCall 2 pow () [(ConstantInteger 2 (Integer 4 [])) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Real 8 []) (ConstantReal 0.500000 (Real 8 [])) ()) Sub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 abs () [(BinOp (FunctionCall 2 pow () [(ConstantInteger 6 (Integer 4 [])) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 [])))] [] (Real 8 []) (ConstantReal 0.000772 (Real 8 [])) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 abs () [(BinOp (FunctionCall 2 pow () [(UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 []))) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 [])))] [] (Real 8 []) (ConstantReal -0.004115 (Real 8 [])) ()) Add (ConstantReal 0.004115 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 abs () [(BinOp (FunctionCall 2 pow () [(ConstantInteger 6 (Integer 4 [])) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 [])))] [] (Real 8 []) (ConstantReal 0.000772 (Real 8 [])) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_pow () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 4 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), pow@__lpython_overloaded_1__pow: (ExternalSymbol 1 pow@__lpython_overloaded_1__pow 4 __lpython_overloaded_1__pow lpython_builtin [] __lpython_overloaded_1__pow Public), pow@__lpython_overloaded_2__pow: (ExternalSymbol 1 pow@__lpython_overloaded_2__pow 4 __lpython_overloaded_2__pow lpython_builtin [] __lpython_overloaded_2__pow Public), pow@__lpython_overloaded_3__pow: (ExternalSymbol 1 pow@__lpython_overloaded_3__pow 4 __lpython_overloaded_3__pow lpython_builtin [] __lpython_overloaded_3__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () () Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Real 8 []) Source Public Required .false.), abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Integer 4 []) Source Public Required .false.), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(Var 2 a) (Var 2 b)] [] (Integer 4 []) () ()) Eq (ConstantInteger 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(Var 2 a) (Var 2 b)] [] (Integer 4 []) () ()) Eq (ConstantInteger 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(Var 2 a) (Var 2 b)] [] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(Var 2 a) (Var 2 b)] [] (Integer 4 []) () ())]) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(Var 2 a) (Var 2 b)] [] (Integer 4 []) () ())]) (= (Var 2 a1) (ConstantReal 4.500000 (Real 8 [])) ()) (= (Var 2 a2) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [(Var 2 a1) (Var 2 a2)] [] (Real 8 []) () ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [(Var 2 a2) (Var 2 a1)] [] (Real 8 []) () ()) Sub (ConstantReal 42.439989 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 x) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 2 y) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [(Var 2 x) (Var 2 y)] [] (Real 8 []) () ()) Sub (ConstantReal 12.513503 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [(Var 2 y) (Var 2 x)] [] (Real 8 []) () ()) Sub (ConstantReal 12.167000 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [(Var 2 x) (ConstantReal 5.500000 (Real 8 []))] [] (Real 8 []) () ()) Sub (ConstantReal 420.888346 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(ConstantInteger 2 (Integer 4 [])) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Integer 4 []) (ConstantReal 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(ConstantInteger 6 (Integer 4 [])) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 [])))] [] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 []))) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 [])))] [] (Integer 4 []) (ConstantReal -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (ConstantReal 0.004115 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(ConstantInteger 6 (Integer 4 [])) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 [])))] [] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ())] [] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [(ConstantReal 4.500000 (Real 8 [])) (ConstantReal 2.300000 (Real 8 []))] [] (Real 8 []) (ConstantReal 31.797193 (Real 8 [])) ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [(ConstantReal 2.300000 (Real 8 [])) (ConstantReal 0.000000 (Real 8 []))] [] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) Sub (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [(ConstantReal 2.300000 (Real 8 [])) (UnaryOp USub (ConstantReal 1.500000 (Real 8 [])) (Real 8 []) (ConstantReal -1.500000 (Real 8 [])))] [] (Real 8 []) (ConstantReal 0.286687 (Real 8 [])) ()) Sub (ConstantReal 0.286687 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [(ConstantInteger 2 (Integer 4 [])) (ConstantReal 3.400000 (Real 8 []))] [] (Real 8 []) (ConstantReal 10.556063 (Real 8 [])) ()) Sub (ConstantReal 10.556063 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [(ConstantInteger 2 (Integer 4 [])) (UnaryOp USub (ConstantReal 3.400000 (Real 8 [])) (Real 8 []) (ConstantReal -3.400000 (Real 8 [])))] [] (Real 8 []) (ConstantReal 0.094732 (Real 8 [])) ()) Sub (ConstantReal 0.094732 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [(ConstantReal 3.400000 (Real 8 [])) (ConstantInteger 9 (Integer 4 []))] [] (Real 8 []) (ConstantReal 60716.992766 (Real 8 [])) ()) Sub (ConstantReal 60716.992766 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [(ConstantReal 0.000000 (Real 8 [])) (ConstantInteger 53 (Integer 4 []))] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Sub (ConstantReal 0.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [(ConstantInteger 4 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))] [] (Integer 4 []) (ConstantInteger 16 (Integer 4 [])) ()) Eq (ConstantInteger 16 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [(BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [(UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (ConstantInteger 52 (Integer 4 []))] [] (Real 8 []) (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ())] [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_round-7417a21.json b/tests/reference/asr-test_builtin_round-7417a21.json index 73acf78fb2..1c7542f939 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.json +++ b/tests/reference/asr-test_builtin_round-7417a21.json @@ -2,11 +2,11 @@ "basename": "asr-test_builtin_round-7417a21", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/test_builtin_round.py", - "infile_hash": "48e36f1b357956530982b1f1a1d91bade8f408a2fcf6eed603e5f433", + "infile_hash": "00896643c6bbb49cdd96978636712e8e5d7e4ab15bd3937c98bdeafd", "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_round-7417a21.stdout", - "stdout_hash": "5b08aaa3d977cdbce8d65e4374c2739e1b5f9060e0eedf219909e485", + "stdout_hash": "a32bfd80013efddbe637187b018a43b4eed11f791f71c1481ce8985c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_round-7417a21.stdout b/tests/reference/asr-test_builtin_round-7417a21.stdout index 6b00eb70cf..5459b68e30 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.stdout +++ b/tests/reference/asr-test_builtin_round-7417a21.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_round: (Subroutine (SymbolTable 2 {f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Print () [(FunctionCall 2 round () [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Print () [(FunctionCall 2 round () [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 44.340000 (Real 8 [])) ()) (Print () [(FunctionCall 2 round () [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 0.500000 (Real 8 [])) ()) (Print () [(FunctionCall 2 round () [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 50.500000 (Real 8 [])) (Real 8 []) (ConstantReal -50.500000 (Real 8 []))) ()) (Print () [(FunctionCall 2 round () [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 1.500000 (Real 8 [])) ()) (Print () [(FunctionCall 2 round () [(Var 2 f)] [] (Integer 4 []) () ())]) (Assert (Compare (FunctionCall 2 round () [(ConstantReal 13.001000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 13 (Integer 4 [])) ()) Eq (ConstantInteger 13 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 round () [(UnaryOp USub (ConstantReal 40.499990 (Real 8 [])) (Real 8 []) (ConstantReal -40.499990 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger -40 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 40 (Integer 4 [])) (Integer 4 []) (ConstantInteger -40 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 round () [(ConstantReal 0.500000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 round () [(UnaryOp USub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) (ConstantReal -0.500000 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 round () [(ConstantReal 1.500000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 round () [(ConstantReal 50.500000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 50 (Integer 4 [])) ()) Eq (ConstantInteger 50 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 round () [(ConstantReal 56.780000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 57 (Integer 4 [])) ()) Eq (ConstantInteger 57 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), round@__lpython_overloaded_0__round: (ExternalSymbol 1 round@__lpython_overloaded_0__round 4 __lpython_overloaded_0__round lpython_builtin [] __lpython_overloaded_0__round Public), round@__lpython_overloaded_1__round: (ExternalSymbol 1 round@__lpython_overloaded_1__round 4 __lpython_overloaded_1__round lpython_builtin [] __lpython_overloaded_1__round Public), round@__lpython_overloaded_2__round: (ExternalSymbol 1 round@__lpython_overloaded_2__round 4 __lpython_overloaded_2__round lpython_builtin [] __lpython_overloaded_2__round Public), test_round: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 44.340000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 0.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 50.500000 (Real 8 [])) (Real 8 []) (ConstantReal -50.500000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(Var 2 f)] [] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 1.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(Var 2 f)] [] (Integer 4 []) () ())]) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(ConstantReal 13.001000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 13 (Integer 4 [])) ()) Eq (ConstantInteger 13 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(UnaryOp USub (ConstantReal 40.499990 (Real 8 [])) (Real 8 []) (ConstantReal -40.499990 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger -40 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 40 (Integer 4 [])) (Integer 4 []) (ConstantInteger -40 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(ConstantReal 0.500000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(UnaryOp USub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) (ConstantReal -0.500000 (Real 8 [])))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(ConstantReal 1.500000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(ConstantReal 50.500000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 50 (Integer 4 [])) ()) Eq (ConstantInteger 50 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [(ConstantReal 56.780000 (Real 8 []))] [] (Integer 4 []) (ConstantInteger 57 (Integer 4 [])) ()) Eq (ConstantInteger 57 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [(Var 2 i)] [] (Integer 8 []) () ()) Eq (ImplicitCast (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [(ConstantInteger 4 (Integer 4 []))] [] (Integer 8 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 4 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [(Var 2 b)] [] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [(Var 2 b)] [] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [(ConstantLogical .false. (Logical 1 []))] [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_str-580e920.json b/tests/reference/asr-test_builtin_str-580e920.json index 5a6df5df7b..6bf95b0e7a 100644 --- a/tests/reference/asr-test_builtin_str-580e920.json +++ b/tests/reference/asr-test_builtin_str-580e920.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_str-580e920.stdout", - "stdout_hash": "dee9b37ff62d659da916c0d66636167d03804aa31847c0ee77117255", + "stdout_hash": "1f8c713c53af9b1a6558d23b54b2cf0130e42904871eac32d4774377", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_str-580e920.stdout b/tests/reference/asr-test_builtin_str-580e920.stdout index 8835b08af8..648449ea0f 100644 --- a/tests/reference/asr-test_builtin_str-580e920.stdout +++ b/tests/reference/asr-test_builtin_str-580e920.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 28 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 27 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_str_int: (Subroutine (SymbolTable 2 {s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 2 str 4 str lpython_builtin [] str Private)}) test_str_int [] [(= (Var 2 s) (FunctionCall 2 str () [(ConstantInteger 356 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [(UnaryOp USub (ConstantInteger 567 (Integer 4 [])) (Integer 4 []) (ConstantInteger -567 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [(ConstantInteger 4 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "4" (Character 1 1 () [])) ()) Eq (ConstantString "4" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [(UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-5" (Character 1 1 () [])) ()) Eq (ConstantString "-5" (Character 1 2 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 38 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 37 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_str_int: (Subroutine (SymbolTable 2 {s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 2 str 4 str lpython_builtin [] str Private)}) test_str_int [] [(= (Var 2 s) (FunctionCall 2 str () [(ConstantInteger 356 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [(UnaryOp USub (ConstantInteger 567 (Integer 4 [])) (Integer 4 []) (ConstantInteger -567 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [(ConstantInteger 4 (Integer 4 []))] [] (Character 1 -2 () []) (ConstantString "4" (Character 1 1 () [])) ()) Eq (ConstantString "4" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [(UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 [])))] [] (Character 1 -2 () []) (ConstantString "-5" (Character 1 1 () [])) ()) Eq (ConstantString "-5" (Character 1 2 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/ast-constants1-91cb6ff.json b/tests/reference/ast-constants1-91cb6ff.json index 3f3efe77fc..f0158a4dd4 100644 --- a/tests/reference/ast-constants1-91cb6ff.json +++ b/tests/reference/ast-constants1-91cb6ff.json @@ -2,11 +2,11 @@ "basename": "ast-constants1-91cb6ff", "cmd": "lpython --show-ast --no-color {infile} -o {outfile}", "infile": "tests/constants1.py", - "infile_hash": "488c771ec7195280a10fa5247d117ac339e0df7f39fa77dfd215619e", + "infile_hash": "9d9ec520168d754127cb16a43c1d99fbd3d20ab046a8ed7c41b3b5e3", "outfile": null, "outfile_hash": null, "stdout": "ast-constants1-91cb6ff.stdout", - "stdout_hash": "94fac2c33ce8f8da092b44a0d3dcb09642c38d8b6edc6876412a2c42", + "stdout_hash": "7ae2f666da19793f44eb32e18e6f96c86e2181a6c31483e921576fcd", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-constants1-91cb6ff.stdout b/tests/reference/ast-constants1-91cb6ff.stdout index d5aad5d910..ca437f5979 100644 --- a/tests/reference/ast-constants1-91cb6ff.stdout +++ b/tests/reference/ast-constants1-91cb6ff.stdout @@ -1 +1 @@ -(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(Tuple [(ConstantStr "a" ()) (ConstantStr "b" ()) (ConstantFloat 3.400000 ())] Load) (Tuple [(ConstantStr "c" ()) (ConstantInt 3 ()) (ConstantFloat 5.600000 ())] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(List [(UnaryOp USub (ConstantInt 4 ())) (UnaryOp USub (ConstantInt 5 ())) (UnaryOp USub (ConstantInt 6 ()))] Load) (List [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ())) (UnaryOp USub (ConstantInt 3 ()))] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Set [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())])] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Dict [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] [(ConstantStr "a" ()) (ConstantStr "b" ()) (ConstantStr "c" ())])] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "t" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantStr "5346" ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantStr "423.534" ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Subscript (Name tuple Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] []) +(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantInt 500 ()))] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .true. ())] []) ()) (AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(Call (Name complex Load) [(ConstantFloat 3.450000 ()) (ConstantFloat 5.600000 ())] [])] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(Tuple [(ConstantStr "a" ()) (ConstantStr "b" ()) (ConstantFloat 3.400000 ())] Load) (Tuple [(ConstantStr "c" ()) (ConstantInt 3 ()) (ConstantFloat 5.600000 ())] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(List [(UnaryOp USub (ConstantInt 4 ())) (UnaryOp USub (ConstantInt 5 ())) (UnaryOp USub (ConstantInt 6 ()))] Load) (List [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ())) (UnaryOp USub (ConstantInt 3 ()))] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Set [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())])] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Dict [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] [(ConstantStr "a" ()) (ConstantStr "b" ()) (ConstantStr "c" ())])] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "t" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantStr "5346" ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantStr "423.534" ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Subscript (Name tuple Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] []) diff --git a/tests/reference/ast-expr7-fe52776.json b/tests/reference/ast-expr7-fe52776.json index e170f35498..418f5964ee 100644 --- a/tests/reference/ast-expr7-fe52776.json +++ b/tests/reference/ast-expr7-fe52776.json @@ -2,11 +2,11 @@ "basename": "ast-expr7-fe52776", "cmd": "lpython --show-ast --no-color {infile} -o {outfile}", "infile": "tests/expr7.py", - "infile_hash": "fae3ed29e0e4f0db9ba4c72e0bf99afa832859b9a4e832a8e8b2f495", + "infile_hash": "4a455e2279eb7dd269d81c1a257dea625b17b100d92e304e5ac34421", "outfile": null, "outfile_hash": null, "stdout": "ast-expr7-fe52776.stdout", - "stdout_hash": "c136c389b566b6a8316247fe5dd191e47fd2c593e49c6b50737471a4", + "stdout_hash": "eb95e2f66e29e53b80188f6fd239ae88c21ae560a388437514e44517", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-expr7-fe52776.stdout b/tests/reference/ast-expr7-fe52776.stdout index b637253839..a0daa4bd8b 100644 --- a/tests/reference/ast-expr7-fe52776.stdout +++ b/tests/reference/ast-expr7-fe52776.stdout @@ -1 +1 @@ -(Module [(FunctionDef test_pow ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name pow Load) [(ConstantInt 2 ()) (ConstantInt 2 ())] []) ())] [] () ()) (FunctionDef test_pow_1 ([] [(a (Name i32 Load) ()) (b (Name i32 Load) ())] [] [] [] [] []) [(AnnAssign (Name res Store) (Name f64 Load) () 1) (Assign [(Name res Store)] (Call (Name pow Load) [(Name a Load) (Name b Load)] []) ()) (Return (Name res Load))] [] (Name f64 Load) ()) (FunctionDef main0 ([] [] [] [] [] [] []) [(Expr (Call (Name test_pow Load) [] [])) (AnnAssign (Name c Store) (Name f64 Load) () 1) (Assign [(Name c Store)] (Call (Name test_pow_1 Load) [(ConstantInt 1 ()) (ConstantInt 2 ())] []) ())] [] () ()) (Expr (Call (Name main0 Load) [] []))] []) +(Module [(FunctionDef test_pow ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name pow Load) [(ConstantInt 2 ()) (ConstantInt 2 ())] []) ())] [] () ()) (FunctionDef test_pow_1 ([] [(a (Name i32 Load) ()) (b (Name i32 Load) ())] [] [] [] [] []) [(AnnAssign (Name res Store) (Name i32 Load) () 1) (Assign [(Name res Store)] (Call (Name pow Load) [(Name a Load) (Name b Load)] []) ()) (Return (Name res Load))] [] (Name i32 Load) ()) (FunctionDef main0 ([] [] [] [] [] [] []) [(Expr (Call (Name test_pow Load) [] [])) (AnnAssign (Name c Store) (Name i32 Load) () 1) (Assign [(Name c Store)] (Call (Name test_pow_1 Load) [(ConstantInt 1 ()) (ConstantInt 2 ())] []) ())] [] () ()) (Expr (Call (Name main0 Load) [] []))] []) diff --git a/tests/reference/cpp-expr7-529bd53.json b/tests/reference/cpp-expr7-529bd53.json index 05b25a57d5..55fdefcc39 100644 --- a/tests/reference/cpp-expr7-529bd53.json +++ b/tests/reference/cpp-expr7-529bd53.json @@ -2,11 +2,11 @@ "basename": "cpp-expr7-529bd53", "cmd": "lpython --no-color --show-cpp {infile}", "infile": "tests/expr7.py", - "infile_hash": "fae3ed29e0e4f0db9ba4c72e0bf99afa832859b9a4e832a8e8b2f495", + "infile_hash": "4a455e2279eb7dd269d81c1a257dea625b17b100d92e304e5ac34421", "outfile": null, "outfile_hash": null, "stdout": "cpp-expr7-529bd53.stdout", - "stdout_hash": "6ff7c26645849882d17a526692ac3f4c64b735d575b3166f31a78425", + "stdout_hash": "8a8ded44e2568a07f90eefa92a606bb253483c6c9aed31507b6612a4", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/cpp-expr7-529bd53.stdout b/tests/reference/cpp-expr7-529bd53.stdout index fcf35d7403..06fe93aef6 100644 --- a/tests/reference/cpp-expr7-529bd53.stdout +++ b/tests/reference/cpp-expr7-529bd53.stdout @@ -23,30 +23,30 @@ void _lpython_main_program() void main0() { - double c; + int c; test_pow(); c = test_pow_1(1, 2); } void test_pow() { - double a; - a = pow(2, 2); + int a; + a = __lpython_overloaded_0__pow(2, 2); } -float test_pow_1(int a, int b) +int test_pow_1(int a, int b) { - double _lpython_return_variable; - double res; - res = pow(a, b); + int _lpython_return_variable; + int res; + res = __lpython_overloaded_0__pow(a, b); _lpython_return_variable = res; return _lpython_return_variable; } -float pow(int x, int y) +int __lpython_overloaded_0__pow(int x, int y) { - double _lpython_return_variable; - _lpython_return_variable = 1.000000*(float)(std::pow(x, y)); + int _lpython_return_variable; + _lpython_return_variable = std::pow(x, y); return _lpython_return_variable; }