Arnaud 2dd97631ed
chore: update nim 2.2.8 (#1424)
Signed-off-by: Arnaud <arno.deville@gmail.com>
Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
2026-04-22 13:57:14 +00:00

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