From 0ea42ec0b2f349e6d8790addbad4060a63357798 Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Mon, 13 Nov 2023 11:27:10 +0530 Subject: [PATCH 1/3] Added explicit test for Out[S] --- integration_tests/symbolics_13.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/integration_tests/symbolics_13.py b/integration_tests/symbolics_13.py index 06f2c27599..0040fc5e3a 100644 --- a/integration_tests/symbolics_13.py +++ b/integration_tests/symbolics_13.py @@ -1,12 +1,22 @@ from lpython import S from sympy import pi, Symbol -def func() -> S: +def func1() -> S: return pi -def test_func(): - z: S = func() +def test_func1(): + z: S = func1() print(z) assert z == pi -test_func() \ No newline at end of file +def func2(r: Out[S]) -> None: + r = pi + +def test_func2(): + z: S + func2(z) + print(z) + assert z == pi + +test_func1() +test_func2() \ No newline at end of file From 35b5fe69b385128f3fb4620003e241ce73e0c424 Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Mon, 13 Nov 2023 11:46:07 +0530 Subject: [PATCH 2/3] Fixed failing tests --- integration_tests/CMakeLists.txt | 1 + integration_tests/func_02.py | 13 +++++++++++++ integration_tests/symbolics_13.py | 20 +++++--------------- 3 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 integration_tests/func_02.py diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 1051514f43..3540040ea6 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -775,6 +775,7 @@ RUN(NAME func_dep_03 LABELS cpython llvm c) RUN(NAME func_dep_04 LABELS cpython llvm c) RUN(NAME func_internal_def_01 LABELS cpython llvm NOFAST) RUN(NAME func_01 LABELS cpython llvm) +RUN(NAME func_02 LABELS c_sym) RUN(NAME float_01 LABELS cpython llvm c wasm wasm_x64) RUN(NAME recursive_01 LABELS cpython llvm c wasm wasm_x64 wasm_x86) diff --git a/integration_tests/func_02.py b/integration_tests/func_02.py new file mode 100644 index 0000000000..89bf1990d3 --- /dev/null +++ b/integration_tests/func_02.py @@ -0,0 +1,13 @@ +from lpython import S +from sympy import pi, Symbol + +def func(r: Out[S]) -> None: + r = pi + +def test_func(): + z: S + func(z) + print(z) + assert z == pi + +test_func() diff --git a/integration_tests/symbolics_13.py b/integration_tests/symbolics_13.py index 0040fc5e3a..6494d28a40 100644 --- a/integration_tests/symbolics_13.py +++ b/integration_tests/symbolics_13.py @@ -1,22 +1,12 @@ from lpython import S -from sympy import pi, Symbol +from sympy import pi -def func1() -> S: +def func() -> S: return pi -def test_func1(): - z: S = func1() +def test_func(): + z: S = func() print(z) assert z == pi -def func2(r: Out[S]) -> None: - r = pi - -def test_func2(): - z: S - func2(z) - print(z) - assert z == pi - -test_func1() -test_func2() \ No newline at end of file +test_func() From 7345fcb6187fb8f017d953168279d46f7beb77e7 Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Mon, 13 Nov 2023 11:47:27 +0530 Subject: [PATCH 3/3] Minor fix --- integration_tests/func_02.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/func_02.py b/integration_tests/func_02.py index 89bf1990d3..73c1f8e8f0 100644 --- a/integration_tests/func_02.py +++ b/integration_tests/func_02.py @@ -1,5 +1,5 @@ from lpython import S -from sympy import pi, Symbol +from sympy import pi def func(r: Out[S]) -> None: r = pi