mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-05-12 22:39:26 +00:00
Signed-off-by: Arnaud <arno.deville@gmail.com> Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
16 lines
561 B
Nim
16 lines
561 B
Nim
import pkg/unittest2
|
|
|
|
import pkg/storage/utils
|
|
|
|
suite "parseDuration":
|
|
test "should parse durations":
|
|
var res: Duration # caller must still know if 'b' refers to bytes|bits
|
|
check parseDuration("10Hr", res) == 3
|
|
check res == hours(10)
|
|
check parseDuration("64min", res) == 3
|
|
check res == minutes(64)
|
|
check parseDuration("7m/block", res) == 2 # '/' stops parse
|
|
check res == minutes(7) # 1 shl 30, forced binary metric
|
|
check parseDuration("3d", res) == 2 # '/' stops parse
|
|
check res == days(3) # 1 shl 30, forced binary metric
|