Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khushi-411 committed Dec 20, 2023
1 parent 3fb4d26 commit 016da52
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/reference/python-complex1-f676023.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "python-complex1-f676023",
"cmd": "lpython --no-color --show-python {infile}",
"infile": "tests/complex1.py",
"infile_hash": "60b45de7b88ec768d70a3122b36545e9604a86504ed6e5d9d813c719",
"outfile": null,
"outfile_hash": null,
"stdout": "python-complex1-f676023.stdout",
"stdout_hash": "dd0d13182e8c14c21aeb38bab81105cb1b973c6f0c0f39d019198970",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
9 changes: 9 additions & 0 deletions tests/reference/python-complex1-f676023.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def __main__():


def lpython_builtin():


def main0():
main_program()

13 changes: 13 additions & 0 deletions tests/reference/python-expr2-6b69018.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "python-expr2-6b69018",
"cmd": "lpython --no-color --show-python {infile}",
"infile": "tests/expr2.py",
"infile_hash": "52d7d4d33553138f2cf55b9900047e5310c54d62e54b3ca1fa394024",
"outfile": null,
"outfile_hash": null,
"stdout": "python-expr2-6b69018.stdout",
"stdout_hash": "80f84c6042272b02da27b09a41c342a510a0e1cad85c7882dfe595b7",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
6 changes: 6 additions & 0 deletions tests/reference/python-expr2-6b69018.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def __main__():


def main0():
main_program()

13 changes: 13 additions & 0 deletions tests/reference/python-expr_01-123410e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "python-expr_01-123410e",
"cmd": "lpython --no-color --show-python {infile}",
"infile": "tests/expr_01.py",
"infile_hash": "4284fe3a1b4dd3e5d1de1357a79e9a25b426ca245b4cc91cf99e8547",
"outfile": null,
"outfile_hash": null,
"stdout": null,
"stdout_hash": null,
"stderr": "python-expr_01-123410e.stderr",
"stderr_hash": "c48bf3950a62f0ef47f60bffcd24fab81f76a02560b590ddda0e574f",
"returncode": 1
}
26 changes: 26 additions & 0 deletions tests/reference/python-expr_01-123410e.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
 Binary file "$DIR/src/bin/lpython", in _start()
 File "./csu/../csu/libc-start.c", line 392, in __libc_start_main_impl()
 File "./csu/../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main()
 File "$DIR/src/bin/lpython.cpp", line 1845, in ??
return emit_python(arg_file, runtime_library_dir, compiler_options);
 File "$DIR/src/bin/lpython.cpp", line 429, in ??
LCompilers::Result<std::string> res = LCompilers::asr_to_lpython(al, *asr, diagnostics, compiler_options, color, indent);
 File "$DIR/src/libasr/codegen/asr_to_python.cpp", line 273, in LCompilers::asr_to_lpython[abi:cxx11](Allocator&, LCompilers::ASR::TranslationUnit_t&, LCompilers::diag::Diagnostics&, LCompilers::CompilerOptions&, bool, int)
v.visit_TranslationUnit(asr);
 File "$DIR/src/libasr/codegen/asr_to_python.cpp", line 183, in LCompilers::ASRToLpythonVisitor::visit_TranslationUnit(LCompilers::ASR::TranslationUnit_t const&)
visit_symbol(*item.second);
 File "$DIR/src/libasr/../libasr/asr.h", line 5060, in LCompilers::ASR::BaseVisitor<LCompilers::ASRToLpythonVisitor>::visit_symbol(LCompilers::ASR::symbol_t const&)
void visit_symbol(const symbol_t &b) { visit_symbol_t(b, self()); }
 File "$DIR/src/libasr/../libasr/asr.h", line 4774, in ??
case symbolType::Program: { v.visit_Program((const Program_t &)x); return; }
 File "$DIR/src/libasr/codegen/asr_to_python.cpp", line 252, in LCompilers::ASRToLpythonVisitor::visit_Program(LCompilers::ASR::Program_t const&)
visit_body(x, r, true);
 File "$DIR/src/libasr/codegen/asr_to_python.cpp", line 120, in void LCompilers::ASRToLpythonVisitor::visit_body<LCompilers::ASR::Program_t>(LCompilers::ASR::Program_t const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)
visit_stmt(*x.m_body[i]);
 File "$DIR/src/libasr/../libasr/asr.h", line 5077, in LCompilers::ASR::BaseVisitor<LCompilers::ASRToLpythonVisitor>::visit_stmt(LCompilers::ASR::stmt_t const&)
void visit_stmt(const stmt_t &b) { visit_stmt_t(b, self()); }
 File "$DIR/src/libasr/../libasr/asr.h", line 4826, in ??
case stmtType::SubroutineCall: { v.visit_SubroutineCall((const SubroutineCall_t &)x); return; }
LCompilersException: visit_SubroutineCall() not implemented
3 changes: 3 additions & 0 deletions tests/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cpp = true
filename = "complex1.py"
ast = true
asr = true
python = true

[[test]]
filename = "complex2.py"
Expand Down Expand Up @@ -62,6 +63,7 @@ ast = true
asr = true
cpp = true
wat = true
python = true

[[test]]
filename = "expr4.py"
Expand Down Expand Up @@ -141,6 +143,7 @@ ast = true
asr = true
llvm = true
llvm_dbg = true
python = true

[[test]]
filename = "../integration_tests/array_01_decl.py"
Expand Down

0 comments on commit 016da52

Please sign in to comment.