aboutsummaryrefslogtreecommitdiff
path: root/tests/tintegers.nim
diff options
context:
space:
mode:
authorpacien2018-11-25 16:45:35 +0100
committerpacien2018-11-25 16:45:35 +0100
commit680c0a3c94f0bb84a2773bc9a95dc5399b6925fb (patch)
tree8b7efa786f14aa4d17ab22ab11b55eda1981519f /tests/tintegers.nim
parent643d2d72fab23df30d29c10614bfa89648cd3655 (diff)
downloadgziplike-680c0a3c94f0bb84a2773bc9a95dc5399b6925fb.tar.gz
Fix bitreader look-ahead overflow
Diffstat (limited to 'tests/tintegers.nim')
-rw-r--r--tests/tintegers.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/tintegers.nim b/tests/tintegers.nim
index c77abec..956e4aa 100644
--- a/tests/tintegers.nim
+++ b/tests/tintegers.nim
@@ -27,6 +27,13 @@ suite "integers":
27 check truncateToUint8(0x00FA'u16) == 0xFA'u8 27 check truncateToUint8(0x00FA'u16) == 0xFA'u8
28 check truncateToUint8(0xFFFA'u16) == 0xFA'u8 28 check truncateToUint8(0xFFFA'u16) == 0xFA'u8
29 29
30 test "leastSignificantBits":
31 check leastSignificantBits(0xFF'u8, 3) == 0b0000_0111'u8
32 check leastSignificantBits(0b0001_0101'u8, 3) == 0b0000_0101'u8
33 check leastSignificantBits(0xFF'u8, 10) == 0xFF'u8
34 check leastSignificantBits(0xFFFF'u16, 16) == 0xFFFF'u16
35 check leastSignificantBits(0xFFFF'u16, 8) == 0x00FF'u16
36
30 test "chunks iterator": 37 test "chunks iterator":
31 check toSeq(chunks(70, uint32)) == @[(0, 32), (1, 32), (2, 6)] 38 check toSeq(chunks(70, uint32)) == @[(0, 32), (1, 32), (2, 6)]
32 check toSeq(chunks(32, uint16)) == @[(0, 16), (1, 16)] 39 check toSeq(chunks(32, uint16)) == @[(0, 16), (1, 16)]