Skip to content

Commit 96e4438

Browse files
Add basic tests for truncate and shifts methods
1 parent fe44fed commit 96e4438

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/flint/test/test_all.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2952,6 +2952,12 @@ def setbad(obj, i, val):
29522952
assert raises(lambda: 1 / P([1, 1]), DomainError)
29532953
assert raises(lambda: P([1, 2, 1]) / P([1, 2]), DomainError)
29542954

2955+
# Shifts and truncation.
2956+
assert P([1, 2, 3]).left_shift(3) == P([0, 0, 0, 1, 2, 3])
2957+
assert P([1, 2, 3]).right_shift(1) == P([2, 3])
2958+
assert P([1, 2, 3]).truncate(4) == P([1, 2, 3])
2959+
assert P([1, 2, 3]).truncate(2) == P([1, 2])
2960+
29552961
assert P([1, 1]) ** 0 == P([1])
29562962
assert P([1, 1]) ** 1 == P([1, 1])
29572963
assert P([1, 1]) ** 2 == P([1, 2, 1])

0 commit comments

Comments
 (0)