diff --git a/integration_tests/run_tests.py b/integration_tests/run_tests.py index 1bb1b1535d..da284c32b7 100755 --- a/integration_tests/run_tests.py +++ b/integration_tests/run_tests.py @@ -15,6 +15,7 @@ "test_math.py", #"test_builtin.py", "test_builtin_abs.py", + "test_builtin_bool.py", "test_math1.py" ] diff --git a/integration_tests/test_builtin_bool.py b/integration_tests/test_builtin_bool.py new file mode 100644 index 0000000000..ddd0aa654c --- /dev/null +++ b/integration_tests/test_builtin_bool.py @@ -0,0 +1,8 @@ +def test_bool(): + a: i32 + a = 34 + assert bool(a) == True + a = 0 + assert bool(a) == False + assert bool(-1) == True + assert bool(0) == False diff --git a/integration_tests/test_builtin_str.py b/integration_tests/test_builtin_str.py new file mode 100644 index 0000000000..3f2054309b --- /dev/null +++ b/integration_tests/test_builtin_str.py @@ -0,0 +1,8 @@ +def test_str_int(): + s: str + s = str(356) + assert s == "356" + s = str(-567) + assert s == "-567" + assert str(4) == "4" + assert str(-5) == "-5" diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index f7dc7229a6..fd80dce0af 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -2613,8 +2613,24 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor x.base.base.loc); } } + } else if (optype == ASR::ttypeType::Logical) { + switch (x.m_op) { + case (ASR::cmpopType::Eq) : { + tmp = builder->CreateICmpEQ(left, right); + break; + } + case (ASR::cmpopType::NotEq) : { + tmp = builder->CreateICmpNE(left, right); + break; + } + default : { + throw CodeGenError("Comparison operator not implemented.", + x.base.base.loc); + } + } } else { - throw CodeGenError("Only Integer, Real, Complex, Character implemented in Compare"); + throw CodeGenError("Only Integer, Real, Complex, Character, and Logical" + " types are supported for comparison.", x.base.base.loc); } } diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 49ccd201a5..f7f408fe40 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1708,9 +1708,11 @@ class BodyVisitor : public CommonVisitor { right_type->type != ASR::ttypeType::Complex) && x.m_ops != AST::cmpopType::Eq && x.m_ops != AST::cmpopType::NotEq) && (left_type->type != ASR::ttypeType::Character || - right_type->type != ASR::ttypeType::Character))) { + right_type->type != ASR::ttypeType::Character)) && + (left_type->type != ASR::ttypeType::Logical || + right_type->type != ASR::ttypeType::Logical)) { throw SemanticError( - "Compare: only Integer, Real, or String can be on the LHS and RHS." + "Compare: only Integer, Real, Logical, or String can be on the LHS and RHS." "If operator is Eq or NotEq then Complex type is also acceptable", x.base.base.loc); } @@ -1810,6 +1812,27 @@ class BodyVisitor : public CommonVisitor { value = ASR::down_cast(ASR::make_ConstantLogical_t( al, x.base.base.loc, result, type)); + } else if (ASRUtils::is_logical(*source_type)) { + bool left_value = ASR::down_cast( + ASRUtils::expr_value(left))->m_value; + bool right_value = ASR::down_cast( + ASRUtils::expr_value(right))->m_value; + bool result; + switch (asr_op) { + case (ASR::cmpopType::Eq): { result = left_value == right_value; break; } + case (ASR::cmpopType::Gt): { result = left_value > right_value; break; } + case (ASR::cmpopType::GtE): { result = left_value >= right_value; break; } + case (ASR::cmpopType::Lt): { result = left_value < right_value; break; } + case (ASR::cmpopType::LtE): { result = left_value <= right_value; break; } + case (ASR::cmpopType::NotEq): { result = left_value != right_value; break; } + default: { + throw SemanticError("Comparison operator not implemented", + x.base.base.loc); + } + } + value = ASR::down_cast(ASR::make_ConstantLogical_t( + al, x.base.base.loc, result, type)); + } else if (ASRUtils::is_character(*source_type)) { char* left_value = ASR::down_cast( ASRUtils::expr_value(left))->m_s; @@ -2271,130 +2294,6 @@ class BodyVisitor : public CommonVisitor { throw SemanticError(call_name + "() must have one integer argument", x.base.base.loc); } - } else if (call_name == "abs") { - if (args.size() != 1) { - throw SemanticError(call_name + "() takes exactly one argument (" + - std::to_string(args.size()) + " given)", x.base.base.loc); - } - std::string rl_path = get_runtime_library_dir(); - SymbolTable *st = current_scope; - while (st->parent != nullptr) { - st = st->parent; - } - bool ltypes; - std::string msym = "lpython_builtin"; - ASR::symbol_t *t = (ASR::symbol_t*)(load_module(al, st, - msym, x.base.base.loc, true, rl_path, ltypes, - [&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); } - )); - LFORTRAN_ASSERT(!ltypes) - if (!t) { - throw SemanticError("The module '" + msym + "' cannot be loaded", - x.base.base.loc); - } - - ASR::Module_t *m = ASR::down_cast(t); - - std::string local_sym = "abs"; - t = m->m_symtab->resolve_symbol(local_sym); - if (!t) { - throw SemanticError("ICE: The symbol '" + local_sym + "' not found in the module '" + msym + "'", - x.base.base.loc); - } - if (ASR::is_a(*t)) { - if (current_scope->scope.find(local_sym) != current_scope->scope.end()) { - throw SemanticError("Function already defined", - x.base.base.loc); - } - ASR::Function_t *mfn = ASR::down_cast(t); - // `mfn` is the Function in a module. Now we construct - // an ExternalSymbol that points to it. - Str name; - name.from_str(al, local_sym); - char *cname = name.c_str(al); - ASR::asr_t *fn = ASR::make_ExternalSymbol_t( - al, mfn->base.base.loc, - /* a_symtab */ current_scope, - /* a_name */ cname, - (ASR::symbol_t*)mfn, - m->m_name, nullptr, 0, mfn->m_name, - ASR::accessType::Public - ); - current_scope->scope[local_sym] = ASR::down_cast(fn); - - ASR::ttype_t *a_type = ASRUtils::TYPE(ASR::make_Real_t(al, - x.base.base.loc, 8, nullptr, 0)); - tmp = ASR::make_FunctionCall_t(al, x.base.base.loc, ASR::down_cast(fn), - nullptr, args.p, args.size(), nullptr, 0, a_type, nullptr, nullptr); - return; - } else { - throw SemanticError("ICE: Abs expected to be a function", x.base.base.loc); - } - // Compile time value implementation: - /* - ASR::expr_t* arg = ASRUtils::expr_value(args[0]); - ASR::ttype_t* t = ASRUtils::expr_type(arg); - ASR::ttype_t* real_type = ASRUtils::TYPE(ASR::make_Real_t(al, - x.base.base.loc, 8, nullptr, 0)); - ASR::ttype_t *int_type = ASRUtils::TYPE(ASR::make_Integer_t(al, - x.base.base.loc, 4, nullptr, 0)); - if (ASRUtils::is_real(*t)) { - double rv = ASR::down_cast(arg)->m_r; - double val = std::abs(rv); - tmp = ASR::make_ConstantReal_t(al, x.base.base.loc, val, t); - } else if (ASRUtils::is_integer(*t)) { - int64_t rv = ASR::down_cast(arg)->m_n; - int64_t val = std::abs(rv); - tmp = ASR::make_ConstantInteger_t(al, x.base.base.loc, val, t); - } else if (ASRUtils::is_complex(*t)) { - double re = ASR::down_cast(arg)->m_re; - double im = ASR::down_cast(arg)->m_im; - std::complex c(re, im); - double result = std::abs(c); - tmp = ASR::make_ConstantReal_t(al, x.base.base.loc, result, real_type); - } else if (ASRUtils::is_logical(*t)) { - bool rv = ASR::down_cast(arg)->m_value; - int8_t val = rv ? 1 : 0; - tmp = ASR::make_ConstantInteger_t(al, x.base.base.loc, val, int_type); - } else { - throw SemanticError(call_name + "() must have one real, integer, complex, or logical argument", - x.base.base.loc); - } - return; - */ - } else if (call_name == "bool") { - if (args.size() != 1) { - throw SemanticError(call_name + "() takes exactly one argument (" + - std::to_string(args.size()) + " given)", x.base.base.loc); - } - ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Logical_t(al, x.base.base.loc, - 1, nullptr, 0)); - ASR::expr_t* arg = ASRUtils::expr_value(args[0]); - ASR::ttype_t* t = ASRUtils::expr_type(arg); - bool result; - if (ASRUtils::is_real(*t)) { - double rv = ASR::down_cast(arg)->m_r; - result = rv ? true : false; - } else if (ASRUtils::is_integer(*t)) { - int64_t rv = ASR::down_cast(arg)->m_n; - result = rv ? true : false; - } else if (ASRUtils::is_complex(*t)) { - double re = ASR::down_cast(arg)->m_re; - double im = ASR::down_cast(arg)->m_im; - std::complex c(re, im); - result = (re || im) ? true : false; - } else if (ASRUtils::is_logical(*t)) { - bool rv = ASR::down_cast(arg)->m_value; - result = rv; - } else if (ASRUtils::is_character(*t)) { - char* c = ASR::down_cast(ASRUtils::expr_value(arg))->m_s; - result = strlen(s2c(al, std::string(c))) ? true : false; - } else { - throw SemanticError(call_name + "() must have one real, integer, character," - " complex, or logical argument", x.base.base.loc); - } - tmp = ASR::make_ConstantLogical_t(al, x.base.base.loc, result, type); - return; } else if (call_name == "callable") { if (args.size() != 1) { throw SemanticError(call_name + "() takes exactly one argument (" + @@ -2482,40 +2381,6 @@ class BodyVisitor : public CommonVisitor { ASRUtils::type_to_str(float_type) + "'", x.base.base.loc); } return; - } else if (call_name == "str") { - ASR::ttype_t* str_type = ASRUtils::TYPE(ASR::make_Character_t(al, - x.base.base.loc, 1, 1, nullptr, nullptr, 0)); - if (args.size() == 0) { // create an empty string - tmp = ASR::make_ConstantString_t(al, x.base.base.loc, s2c(al, ""), str_type); - return; - } - ASR::expr_t* arg = ASRUtils::expr_value(args[0]); - ASR::ttype_t* arg_type = ASRUtils::expr_type(arg); - if (arg == nullptr) { - throw SemanticError("runtime str(x) is not supported, only compile time for now", - x.base.base.loc); - } - if (ASRUtils::is_integer(*arg_type)) { - int64_t ival = ASR::down_cast(arg)->m_n; - std::string s = std::to_string(ival); - tmp = ASR::make_ConstantString_t(al, x.base.base.loc, s2c(al, s), str_type); - } else if (ASRUtils::is_real(*arg_type)) { - double rval = ASR::down_cast(arg)->m_r; - std::string s = std::to_string(rval); - tmp = ASR::make_ConstantString_t(al, x.base.base.loc, s2c(al, s), str_type); - } else if (ASRUtils::is_logical(*arg_type)) { - bool rv = ASR::down_cast(arg)->m_value; - std::string s = rv ? "True" : "False"; - tmp = ASR::make_ConstantString_t(al, x.base.base.loc, s2c(al, s), str_type); - } else if (ASRUtils::is_character(*arg_type)) { - char* c = ASR::down_cast(arg)->m_s; - std::string s = std::string(c); - tmp = ASR::make_ConstantString_t(al, x.base.base.loc, s2c(al, s), str_type); - } else { - throw SemanticError("str() argument must be real, integer, logical, or a string, not '" + - ASRUtils::type_to_str(arg_type) + "'", x.base.base.loc); - } - return; } else if (call_name == "divmod") { if (args.size() != 2) { throw SemanticError(call_name + "() takes exactly two arguments (" + diff --git a/src/lpython/semantics/python_comptime_eval.h b/src/lpython/semantics/python_comptime_eval.h index 7a10f24981..5f4db7f9f8 100644 --- a/src/lpython/semantics/python_comptime_eval.h +++ b/src/lpython/semantics/python_comptime_eval.h @@ -2,6 +2,8 @@ #define LPYTHON_SEMANTICS_COMPTIME_EVAL_H #include +#include +#include #include #include @@ -26,6 +28,8 @@ struct PythonIntrinsicProcedures { PythonIntrinsicProcedures() { comptime_eval_map = { {"abs", {m_builtin, &eval_abs}}, + {"str", {m_builtin, &eval_str}}, + {"bool", {m_builtin, &eval_bool}}, }; } @@ -100,6 +104,70 @@ struct PythonIntrinsicProcedures { } } + static ASR::expr_t *eval_str(Allocator &al, const Location &loc, Vec &args) { + ASR::ttype_t* str_type = ASRUtils::TYPE(ASR::make_Character_t(al, + loc, 1, 1, nullptr, nullptr, 0)); + if (args.size() == 0) { // create an empty string + return ASR::down_cast(ASR::make_ConstantString_t(al, loc, s2c(al, ""), str_type)); + } + ASR::expr_t* arg = ASRUtils::expr_value(args[0]); + ASR::ttype_t* arg_type = ASRUtils::expr_type(arg); + if (ASRUtils::is_integer(*arg_type)) { + int64_t ival = ASR::down_cast(arg)->m_n; + std::string s = std::to_string(ival); + return ASR::down_cast(ASR::make_ConstantString_t(al, loc, s2c(al, s), str_type)); + } else if (ASRUtils::is_real(*arg_type)) { + double rval = ASR::down_cast(arg)->m_r; + std::string s = std::to_string(rval); + return ASR::down_cast(ASR::make_ConstantString_t(al, loc, s2c(al, s), str_type)); + } else if (ASRUtils::is_logical(*arg_type)) { + bool rv = ASR::down_cast(arg)->m_value; + std::string s = rv ? "True" : "False"; + return ASR::down_cast(ASR::make_ConstantString_t(al, loc, s2c(al, s), str_type)); + } else if (ASRUtils::is_character(*arg_type)) { + char* c = ASR::down_cast(arg)->m_s; + std::string s = std::string(c); + return ASR::down_cast(ASR::make_ConstantString_t(al, loc, s2c(al, s), str_type)); + } else { + throw SemanticError("str() argument must be real, integer, logical, or a string, not '" + + ASRUtils::type_to_str(arg_type) + "'", loc); + } + } + + static ASR::expr_t *eval_bool(Allocator &al, const Location &loc, Vec &args) { + if (args.size() != 1) { + throw SemanticError("bool() takes exactly one argument (" + + std::to_string(args.size()) + " given)", loc); + } + ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Logical_t(al, loc, + 1, nullptr, 0)); + ASR::expr_t* arg = ASRUtils::expr_value(args[0]); + ASR::ttype_t* t = ASRUtils::expr_type(arg); + bool result; + if (ASRUtils::is_real(*t)) { + double rv = ASR::down_cast(arg)->m_r; + result = rv ? true : false; + } else if (ASRUtils::is_integer(*t)) { + int64_t rv = ASR::down_cast(arg)->m_n; + result = rv ? true : false; + } else if (ASRUtils::is_complex(*t)) { + double re = ASR::down_cast(arg)->m_re; + double im = ASR::down_cast(arg)->m_im; + std::complex c(re, im); + result = (re || im) ? true : false; + } else if (ASRUtils::is_logical(*t)) { + bool rv = ASR::down_cast(arg)->m_value; + result = rv; + } else if (ASRUtils::is_character(*t)) { + char* c = ASR::down_cast(ASRUtils::expr_value(arg))->m_s; + result = strlen(s2c(al, std::string(c))) ? true : false; + } else { + throw SemanticError("bool() must have one real, integer, character," + " complex, or logical argument, not '" + ASRUtils::type_to_str(t) + "'", loc); + } + return ASR::down_cast(make_ConstantLogical_t(al, loc, result, type)); + } + }; // ComptimeEval } // namespace LFortran diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index c6e5234cc8..3a093fbec5 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -38,3 +38,40 @@ def abs(x: f64) -> f64: return x else: return -x + + +def str(x: i32) -> str: + """ + Return the string representation of an integer `x`. + """ + if x == 0: + return '0' + result: str + result = '' + if x < 0: + result += '-' + x = -x + rev_result: str + rev_result = '' + rev_result_len: i32 + rev_result_len = 0 + pos_to_str: list[str] + pos_to_str = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] + while x > 0: + rev_result += pos_to_str[x - (x//10)*10] + rev_result_len += 1 + x = x//10 + pos: i32 + for pos in range(rev_result_len - 1, -1, -1): + result += rev_result[pos] + return result + + +def bool(x: i32) -> bool: + """ + Return False when the argument `x` is 0, True otherwise. + """ + if x == 0: + return False + else: + return True diff --git a/tests/expr13.py b/tests/expr13.py index 1647a0e8e1..48a3984abf 100644 --- a/tests/expr13.py +++ b/tests/expr13.py @@ -16,3 +16,8 @@ def test_Compare(): a = "abc" == "abc" a = "abc" != "abd" a = "" == "+" + + a = True > False + a = True == True + a = False != True + a = False >= True diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index 8eb9f87993..e3c2ab8b46 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "0a0d5acbd9b14c908f856d9d95d36e49e4cb2f5db735109a008af200", + "stdout_hash": "2cd6b3df9a5069e5994f1d67abeaa2210431cc9286cb483b137ceeb9", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index f9450621d6..c7ccf734c8 100644 --- a/tests/reference/asr-constants1-5828e8a.stdout +++ b/tests/reference/asr-constants1-5828e8a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 17 {}) 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) (FunctionCall 4 abs () [(ConstantReal 3.450000 (Real 8 []))] [] (Real 8 []) (ConstantReal 3.450000 (Real 8 [])) ()) ()) (= (Var 4 b) (FunctionCall 4 abs () [(UnaryOp USub (ConstantReal 5346.340000 (Real 8 [])) (Real 8 []) (ConstantReal -5346.340000 (Real 8 [])))] [] (Real 8 []) (ConstantReal 5346.340000 (Real 8 [])) ()) ())] Source Public Implementation () .false. .false.), test_bool: (Subroutine (SymbolTable 6 {a: (Variable 6 a Local () () Default (Logical 1 []) Source Public Required .false.)}) test_bool [] [(= (Var 6 a) (ConstantLogical .false. (Logical 1 [])) ()) (= (Var 6 a) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 6 a) (ConstantLogical .false. (Logical 1 [])) ()) (= (Var 6 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 6 a) (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.)}) test_boz [] [(= (Var 2 b) (ConstantString "0b101" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0b1000000" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0o10" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0o70" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "-0o1026" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0x2a" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0xc0ffee" (Character 1 1 () [])) ()) (= (Var 2 b) (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 (Integer 4 []) Source Public Required .false.)}) test_divmod [] [(= (Var 11 a) (ConstantTuple [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 11 a) (ConstantTuple [(ConstantInteger -3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 11 a) (ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 11 a) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 11 a) (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.)}) test_float [] [(= (Var 10 a) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 4.560000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 5.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal -1.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 1.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 5346.000000 (Real 8 [])) ()) (= (Var 10 a) (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.)}) test_int [] [(= (Var 9 a) (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger 4 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger -5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (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.)}) test_len [] [(= (Var 5 a) (ConstantInteger 0 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 4 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 14 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 5 a) (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.), ord: (ExternalSymbol 3 ord 13 ord lpython_builtin [] ord Public), 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 []) () ()) ()) (= (Var 3 s) (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.)}) test_str [] [(= (Var 7 s) (ConstantString "" (Character 1 1 () [])) ()) (= (Var 7 s) (ConstantString "5" (Character 1 1 () [])) ()) (= (Var 7 s) (ConstantString "-4" (Character 1 1 () [])) ()) (= (Var 7 s) (ConstantString "5.600000" (Character 1 1 () [])) ()) (= (Var 7 s) (ConstantString "True" (Character 1 1 () [])) ()) (= (Var 7 s) (ConstantString "False" (Character 1 1 () [])) ()) (= (Var 7 s) (ConstantString "5346" (Character 1 1 () [])) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 19 {}) 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) (FunctionCall 4 abs () [(ConstantReal 3.450000 (Real 8 []))] [] (Real 8 []) (ConstantReal 3.450000 (Real 8 [])) ()) ()) (= (Var 4 b) (FunctionCall 4 abs () [(UnaryOp USub (ConstantReal 5346.340000 (Real 8 [])) (Real 8 []) (ConstantReal -5346.340000 (Real 8 [])))] [] (Real 8 []) (ConstantReal 5346.340000 (Real 8 [])) ()) ())] 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)}) test_bool [] [(= (Var 6 a) (FunctionCall 6 bool () [(ConstantInteger 0 (Integer 4 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 6 bool () [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 6 bool () [(ConstantString "" (Character 1 0 () []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 6 bool () [(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 6 bool () [(ConstantString "t" (Character 1 1 () []))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 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.)}) test_boz [] [(= (Var 2 b) (ConstantString "0b101" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0b1000000" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0o10" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0o70" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "-0o1026" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0x2a" (Character 1 1 () [])) ()) (= (Var 2 b) (ConstantString "0xc0ffee" (Character 1 1 () [])) ()) (= (Var 2 b) (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 (Integer 4 []) Source Public Required .false.)}) test_divmod [] [(= (Var 11 a) (ConstantTuple [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 11 a) (ConstantTuple [(ConstantInteger -3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 11 a) (ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 11 a) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 11 a) (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.)}) test_float [] [(= (Var 10 a) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 4.560000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 5.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal -1.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 1.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 10 a) (ConstantReal 5346.000000 (Real 8 [])) ()) (= (Var 10 a) (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.)}) test_int [] [(= (Var 9 a) (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger 4 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger -5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (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.)}) test_len [] [(= (Var 5 a) (ConstantInteger 0 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 4 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 14 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 5 a) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 5 a) (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.), ord: (ExternalSymbol 3 ord 13 ord lpython_builtin [] ord Public), 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 []) () ()) ()) (= (Var 3 s) (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 f61e510dfe..6075958575 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": "3386132d1619fd644c4ff66843325b74795f6565389176b4bf9968bc", + "stdout_hash": "8b55908580a78eecb9935f8fa92301c3242295ee414a9c4801365910", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr1-8df2d66.stdout b/tests/reference/asr-expr1-8df2d66.stdout index 809084fb91..08fac85665 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 8 {}) 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 Public), 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 []) () ()) (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 10 {}) 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 Public), 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 []) () ()) (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-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index f757a6ba5a..9e0bb79eef 100644 --- a/tests/reference/asr-expr13-81bdb5a.json +++ b/tests/reference/asr-expr13-81bdb5a.json @@ -2,11 +2,11 @@ "basename": "asr-expr13-81bdb5a", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/expr13.py", - "infile_hash": "1e4796f83f033a02aa6adef9a0cced2be0366e753c85ad2cfd3767c8", + "infile_hash": "fae72924c71183c45d328b379dfa81aa4971b5e1a9ea668db546078f", "outfile": null, "outfile_hash": null, "stdout": "asr-expr13-81bdb5a.stdout", - "stdout_hash": "985e0bd6eac2829a0290c7cb47d8c2f7d6694e14e73dce3d5f473f06", + "stdout_hash": "25aca9a36f7a40fba1cde5b8211bac48a87664470a93829629b8d2c5", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index 71fe55755c..d538d0cbef 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {main_program: (Program (SymbolTable 3 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (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 (ConstantComplex 3.000000 4.000000 (Complex 8 [])) Eq (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 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {main_program: (Program (SymbolTable 3 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (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 (ConstantComplex 3.000000 4.000000 (Complex 8 [])) Eq (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-test_builtin-aa64615.json b/tests/reference/asr-test_builtin-aa64615.json index c83af44483..152e20119d 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": "699f7bacfe37c1de4ea3f6c7029c84ba01eb3e81d738ea39a1cd1cd8", + "stdout_hash": "b1ff8c5f336d4f0562ec2df73b8ba531761d24dd70056047fabf784b", "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 b90e25f433..fb58b84912 100644 --- a/tests/reference/asr-test_builtin-aa64615.stdout +++ b/tests/reference/asr-test_builtin-aa64615.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lfortran_main_program: (Subroutine (SymbolTable 9 {}) _lfortran_main_program [] [(SubroutineCall 1 test_ord () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 8 {}) main_program [] [(SubroutineCall 1 _lfortran_main_program () [] ())]), test_ord: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 4 ord lpython_builtin [] ord Public), 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 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lfortran_main_program: (Subroutine (SymbolTable 11 {}) _lfortran_main_program [] [(SubroutineCall 1 test_ord () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 10 {}) main_program [] [(SubroutineCall 1 _lfortran_main_program () [] ())]), test_ord: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 4 ord lpython_builtin [] ord Public), 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 []) () ()) ())] 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 ce80265555..dcbefdd4eb 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.json +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_abs-c74d2c9.stdout", - "stdout_hash": "db838618bb7ad2900d537a296ac699b1fcd846d088528fb22fba502a", + "stdout_hash": "cb17627dc7e113159c18c248e59c2d5f8c7de8a6e453e4d6560c850c", "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 57091561ff..ea96ddbada 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lfortran_main_program: (Subroutine (SymbolTable 9 {}) _lfortran_main_program [] [(SubroutineCall 1 test_abs () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 8 {}) main_program [] [(SubroutineCall 1 _lfortran_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 {_lfortran_main_program: (Subroutine (SymbolTable 11 {}) _lfortran_main_program [] [(SubroutineCall 1 test_abs () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 10 {}) main_program [] [(SubroutineCall 1 _lfortran_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.)}) []) diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json new file mode 100644 index 0000000000..bbcd1e8331 --- /dev/null +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-test_builtin_bool-330223a", + "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/../integration_tests/test_builtin_bool.py", + "infile_hash": "535d49e7c5f7b59129a0fcd9cea09d45cfb9d9ba4aad469bb6a61e4f", + "outfile": null, + "outfile_hash": null, + "stdout": "asr-test_builtin_bool-330223a.stdout", + "stdout_hash": "cfb37973fcbe3697a8b657efdf5254acf7bbbe0fce500158808cbfe5", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_bool-330223a.stdout b/tests/reference/asr-test_builtin_bool-330223a.stdout new file mode 100644 index 0000000000..1ec0d26c0d --- /dev/null +++ b/tests/reference/asr-test_builtin_bool-330223a.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 10 {}) main_program [] []), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bool () [(Var 2 a)] [] (Logical 1 []) () ()) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bool () [(Var 2 a)] [] (Logical 1 []) () ()) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bool () [(UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 [])))] [] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bool () [(ConstantInteger 0 (Integer 4 []))] [] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_str-580e920.json b/tests/reference/asr-test_builtin_str-580e920.json new file mode 100644 index 0000000000..a26e55322d --- /dev/null +++ b/tests/reference/asr-test_builtin_str-580e920.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-test_builtin_str-580e920", + "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/../integration_tests/test_builtin_str.py", + "infile_hash": "e89fe05f26beccce05eb6f0a61a3f46d46eb134b22ce5175c45ed795", + "outfile": null, + "outfile_hash": null, + "stdout": "asr-test_builtin_str-580e920.stdout", + "stdout_hash": "376942714268b386faf41d01a7cfcf19d1e860a3a8985acfaaa1edac", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_str-580e920.stdout b/tests/reference/asr-test_builtin_str-580e920.stdout new file mode 100644 index 0000000000..d1aad26856 --- /dev/null +++ b/tests/reference/asr-test_builtin_str-580e920.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 10 {}) 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-expr13-c35ace1.json b/tests/reference/ast-expr13-c35ace1.json index 889644d025..5a2c133700 100644 --- a/tests/reference/ast-expr13-c35ace1.json +++ b/tests/reference/ast-expr13-c35ace1.json @@ -2,11 +2,11 @@ "basename": "ast-expr13-c35ace1", "cmd": "lpython --show-ast --no-color {infile} -o {outfile}", "infile": "tests/expr13.py", - "infile_hash": "1e4796f83f033a02aa6adef9a0cced2be0366e753c85ad2cfd3767c8", + "infile_hash": "fae72924c71183c45d328b379dfa81aa4971b5e1a9ea668db546078f", "outfile": null, "outfile_hash": null, "stdout": "ast-expr13-c35ace1.stdout", - "stdout_hash": "a6eec7dd7c81accae96097cad772d5afdc91a68275f04bbefdc05ccf", + "stdout_hash": "4eefbd260e67134f1a3e011aaea29567cd6dde2f94e0c05e952d7101", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-expr13-c35ace1.stdout b/tests/reference/ast-expr13-c35ace1.stdout index 06c78c035a..345eda34fd 100644 --- a/tests/reference/ast-expr13-c35ace1.stdout +++ b/tests/reference/ast-expr13-c35ace1.stdout @@ -1 +1 @@ -(Module [(FunctionDef test_Compare ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) Gt [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) LtE [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) Lt [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 5.600000 ()) GtE [(ConstantFloat 5.599990 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 3.300000 ()) Eq [(ConstantFloat 3.300000 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 3.300000 ()) NotEq [(ConstantFloat 3.400000 ())]) ()) (Assign [(Name a Store)] (Compare (Call (Name complex Load) [(ConstantInt 3 ()) (ConstantInt 4 ())] []) Eq [(Call (Name complex Load) [(ConstantFloat 3.000000 ()) (ConstantFloat 4.000000 ())] [])]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "abc" ()) Gt [(ConstantStr "abd" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "" ()) Lt [(ConstantStr "s" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "-abs" ()) GtE [(ConstantStr "abs" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "abcd" ()) LtE [(ConstantStr "abcde" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "abc" ()) Eq [(ConstantStr "abc" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "abc" ()) NotEq [(ConstantStr "abd" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "" ()) Eq [(ConstantStr "+" ())]) ())] [] () ())] []) +(Module [(FunctionDef test_Compare ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) Gt [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) LtE [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantInt 5 ()) Lt [(ConstantInt 4 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 5.600000 ()) GtE [(ConstantFloat 5.599990 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 3.300000 ()) Eq [(ConstantFloat 3.300000 ())]) ()) (Assign [(Name a Store)] (Compare (ConstantFloat 3.300000 ()) NotEq [(ConstantFloat 3.400000 ())]) ()) (Assign [(Name a Store)] (Compare (Call (Name complex Load) [(ConstantInt 3 ()) (ConstantInt 4 ())] []) Eq [(Call (Name complex Load) [(ConstantFloat 3.000000 ()) (ConstantFloat 4.000000 ())] [])]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "abc" ()) Gt [(ConstantStr "abd" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "" ()) Lt [(ConstantStr "s" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "-abs" ()) GtE [(ConstantStr "abs" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "abcd" ()) LtE [(ConstantStr "abcde" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "abc" ()) Eq [(ConstantStr "abc" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "abc" ()) NotEq [(ConstantStr "abd" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantStr "" ()) Eq [(ConstantStr "+" ())]) ()) (Assign [(Name a Store)] (Compare (ConstantBool .true. ()) Gt [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Compare (ConstantBool .true. ()) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Compare (ConstantBool .false. ()) NotEq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Compare (ConstantBool .false. ()) GtE [(ConstantBool .true. ())]) ())] [] () ())] []) diff --git a/tests/tests.toml b/tests/tests.toml index 189d0fbbd2..6efef14614 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -168,3 +168,11 @@ asr = true [[test]] filename = "../integration_tests/test_builtin_abs.py" asr = true + +[[test]] +filename = "../integration_tests/test_builtin_str.py" +asr = true + +[[test]] +filename = "../integration_tests/test_builtin_bool.py" +asr = true