Skip to content

Commit f8d73dd

Browse files
Add tests
1 parent 8a74b77 commit f8d73dd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

integration_tests/test_list_01.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,30 @@ def test_list_02():
4242
for j in range(len(y)):
4343
assert x[j] == y[j]
4444

45+
# Negative Indexing
46+
def test_list_03():
47+
x: list[f64] = []
48+
49+
i: i32
50+
for i in range(2):
51+
x.append(float(i))
52+
53+
assert x[1] == x[-1]
54+
assert x[0] == x[-2]
55+
assert x[-1] == 1.0
56+
assert x[-2] == 0.0
57+
58+
size: i32 = 2
59+
for i in range(100):
60+
x.append((i * size)/2)
61+
size = len(x)
62+
63+
for i in range(size):
64+
assert x[i] == x[((i-len(x)) + size) % size]
65+
4566
def tests():
4667
test_list_01()
4768
test_list_02()
69+
test_list_03()
4870

4971
tests()

0 commit comments

Comments
 (0)