Skip to content

Commit 47a38f9

Browse files
committed
Update tests
1 parent 613017d commit 47a38f9

File tree

6 files changed

+32
-13
lines changed

6 files changed

+32
-13
lines changed

integration_tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,6 @@ RUN(NAME test_str_comparison LABELS cpython llvm)
222222
RUN(NAME test_bit_length LABELS cpython llvm)
223223

224224
RUN(NAME generics_01 LABELS cpython llvm)
225+
RUN(NAME generics_02 LABELS cpython llvm)
225226
RUN(NAME generics_array_01 LABELS llvm)
226227
RUN(NAME test_statistics LABELS cpython llvm)

integration_tests/generics_02.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from ltypes import TypeVar
2+
3+
T = TypeVar('T')
4+
5+
def swap(x: T, y: T):
6+
temp: T
7+
temp = x
8+
x = y
9+
y = temp
10+
print(x)
11+
print(y)
12+
13+
swap(1,2)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-generics_02-e2ea5c9",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/../integration_tests/generics_02.py",
5+
"infile_hash": "6f748cbf059da328ff092c08ad0063e639ba460eb481fadfadeebc51",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": "asr-generics_02-e2ea5c9.stdout",
9+
"stdout_hash": "5e109b8427357ce9883ef4927ac34a69330c4948dde307af0a92de9c",
10+
"stderr": null,
11+
"stderr_hash": null,
12+
"returncode": 0
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(TranslationUnit (SymbolTable 1 {T: (Variable 1 T Local () () Default (TypeParameter T []) Source Public Required .false.), __lpython_generic_swap_0: (Function (SymbolTable 3 {temp: (Variable 3 temp Local () () Default (Integer 4 []) Source Public Required .false.), x: (Variable 3 x In () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 3 y In () () Default (Integer 4 []) Source Public Required .false.)}) __lpython_generic_swap_0 [(Var 3 x) (Var 3 y)] [] [(= (Var 3 temp) (Var 3 x) ()) (= (Var 3 x) (Var 3 y) ()) (= (Var 3 y) (Var 3 temp) ()) (Print () [(Var 3 x)] () ()) (Print () [(Var 3 y)] () ())] () Source Public Implementation () .false. .false. .false.), _lpython_main_program: (Function (SymbolTable 5 {}) _lpython_main_program [] [] [(SubroutineCall 1 __lpython_generic_swap_0 () [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] ())] () Source Public Implementation () .false. .false. .false.), main_program: (Program (SymbolTable 4 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), swap: (Function (SymbolTable 2 {temp: (Variable 2 temp Local () () Default (TypeParameter T []) Source Public Required .false.), x: (Variable 2 x In () () Default (TypeParameter T []) Source Public Required .false.), y: (Variable 2 y In () () Default (TypeParameter T []) Source Public Required .false.)}) swap [(Var 2 x) (Var 2 y)] [(TypeParameter T [])] [(= (Var 2 temp) (Var 2 x) ()) (= (Var 2 x) (Var 2 y) ()) (= (Var 2 y) (Var 2 temp) ()) (Print () [(Var 2 x)] () ()) (Print () [(Var 2 y)] () ())] () Source Public Implementation () .false. .false. .false.)}) [])

tests/reference/cpp-expr3-9c516d4.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/tests.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,10 @@ cpp = true
377377
filename = "../integration_tests/generics_01.py"
378378
asr = true
379379

380+
[[test]]
381+
filename = "../integration_tests/generics_02.py"
382+
asr = true
383+
380384
[[test]]
381385
filename = "../integration_tests/generics_array_01.py"
382386
asr = true

0 commit comments

Comments
 (0)