diff options
Diffstat (limited to 'tests/tintegers.nim')
-rw-r--r-- | tests/tintegers.nim | 7 |
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)] |