diff options
author | pacien | 2018-12-01 15:55:33 +0100 |
---|---|---|
committer | pacien | 2018-12-01 15:55:33 +0100 |
commit | 1850acb5b77aabbf4e9ba24ae6d5314c3d4d896a (patch) | |
tree | 461fcceb048e58bf234916ec9f03888d930e5465 /tests | |
parent | 0c375acd686f2e7f3116e243bf9c89a836d5be99 (diff) | |
download | gziplike-1850acb5b77aabbf4e9ba24ae6d5314c3d4d896a.tar.gz |
add dynamic symbol length to output
Diffstat (limited to 'tests')
-rw-r--r-- | tests/thuffman.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/thuffman.nim b/tests/thuffman.nim index 0294694..db209f4 100644 --- a/tests/thuffman.nim +++ b/tests/thuffman.nim | |||
@@ -90,15 +90,15 @@ suite "huffencoder": | |||
90 | test "buildCodebook": | 90 | test "buildCodebook": |
91 | let codebook = buildCodebook(tree, uint) | 91 | let codebook = buildCodebook(tree, uint) |
92 | check codebook.len == 3 | 92 | check codebook.len == 3 |
93 | check codebook[1'u] == 0b0 | 93 | check codebook[1'u] == (1, 0b0'u) |
94 | check codebook[2'u] == 0b01 | 94 | check codebook[2'u] == (2, 0b01'u) |
95 | check codebook[3'u] == 0b11 | 95 | check codebook[3'u] == (2, 0b11'u) |
96 | 96 | ||
97 | test "encode": | 97 | test "encode": |
98 | let encoder = tree.encoder(uint) | 98 | let encoder = tree.encoder(uint) |
99 | check encoder.encode(1'u) == 0b0 | 99 | check encoder.encode(1'u) == (1, 0b0'u) |
100 | check encoder.encode(2'u) == 0b01 | 100 | check encoder.encode(2'u) == (2, 0b01'u) |
101 | check encoder.encode(3'u) == 0b11 | 101 | check encoder.encode(3'u) == (2, 0b11'u) |
102 | 102 | ||
103 | suite "huffdecoder": | 103 | suite "huffdecoder": |
104 | test "decode": | 104 | test "decode": |