Skip to content

Commit 2fb6601

Browse files
committed
Add tests
1 parent c191f3d commit 2fb6601

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

integration_tests/test_list_const.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from lpython import i32, i64, f32, f64, dict, list, tuple, str, Const, c64
2+
3+
4+
def test_list_const():
5+
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
6+
7+
assert CONST_INTEGER_LIST.count(1) == 2
8+
assert CONST_INTEGER_LIST.index(1) == 0
9+
10+
CONST_STRING_LIST: Const[list[str]] = ["ALPHA", "BETA", "RELEASE"]
11+
assert CONST_STRING_LIST.count("ALPHA") == 1
12+
assert CONST_STRING_LIST.index("RELEASE") == 2
13+
14+
15+
test_list_const()

tests/errors/test_list_const.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def test_list_const():
2+
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
3+
4+
CONST_INTEGER_LIST.append(6)
5+
CONST_INTEGER_LIST.insert(3, 8)
6+
CONST_INTEGER_LIST.reverse()
7+
CONST_INTEGER_LIST.pop()
8+
CONST_INTEGER_LIST.pop(0)
9+
CONST_INTEGER_LIST.clear()
10+
CONST_INTEGER_LIST.remove(1)
11+
12+

0 commit comments

Comments
 (0)