Skip to content

Commit 2b4ca11

Browse files
committed
add a test
1 parent 6e4f30d commit 2b4ca11

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

integration_tests/test_generics_01.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from overload_testing import foo, test
2-
from ltypes import overload, i32
2+
from ltypes import overload, i32, i64
33
import overload_testing2
44

5+
56
@overload
67
def foo1(a: i32, b: i32) -> i32:
78
return a-b
@@ -14,6 +15,7 @@ def foo1(a: i32) -> i32:
1415
def foo1(a: str) -> str:
1516
return "lpython-is-fun-" + a
1617

18+
1719
@overload
1820
def test1(a: i32) -> i32:
1921
return a + 20
@@ -25,6 +27,19 @@ def test1(a: bool) -> i32:
2527
return -20
2628

2729

30+
@overload
31+
def add(a: i32):
32+
print(a)
33+
34+
@overload
35+
def add(a: i32, b: i32):
36+
print(a + b)
37+
38+
@overload
39+
def add(a: i32, b: i64):
40+
print(a + b)
41+
42+
2843
def check():
2944
assert foo(2) == 4
3045
assert foo1(2) == 16
@@ -41,5 +56,11 @@ def check():
4156
assert test(False) == -test(True) and test(True) == 10
4257
assert test1(False) == -test1(True) and test1(True) == 20
4358
assert overload_testing2.test2(True) == 30
59+
# We are testing the subroutine using print to test it actually works
60+
add(1, 2)
61+
add(3)
62+
i: i64
63+
i = 10
64+
add(2, i)
4465

4566
check()

0 commit comments

Comments
 (0)