mirror of
https://github.com/logos-storage/nim-leopard.git
synced 2026-01-02 13:43:08 +00:00
test that data+parity isn't > 65536
This commit is contained in:
parent
d85bb31062
commit
1aa0cfb8dc
@ -206,7 +206,7 @@ proc init[TT: Leo](
|
||||
if parity > buffers:
|
||||
return err("number of parity buffers cannot exceed number of data buffers!")
|
||||
|
||||
if buffers + parity > 65536:
|
||||
if (buffers + parity) > 65536:
|
||||
return err("number of parity and data buffers cannot exceed 65536!")
|
||||
|
||||
once:
|
||||
|
||||
@ -20,6 +20,14 @@ suite "Leopard Parametrization":
|
||||
LeoEncoder.init(64, 1, 2).error ==
|
||||
"number of parity buffers cannot exceed number of data buffers!"
|
||||
|
||||
test "Should not allow data + parity to exceed 65536":
|
||||
check:
|
||||
LeoEncoder.init(64, 65536 + 1, 0).error ==
|
||||
"number of parity and data buffers cannot exceed 65536!"
|
||||
|
||||
LeoEncoder.init(64, 32768 + 1, 32768).error ==
|
||||
"number of parity and data buffers cannot exceed 65536!"
|
||||
|
||||
test "Should not allow encoding with invalid data buffer counts":
|
||||
var
|
||||
leo = LeoEncoder.init(64, 4, 2).tryGet()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user