Added some extra tests for parse_range

This commit is contained in:
Jef Roosens 2022-04-10 16:58:55 +02:00
parent f92a20fcf8
commit 799fe2e454
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
2 changed files with 31 additions and 5 deletions

View file

@ -17,17 +17,15 @@ fn parse_range(s string, min u32, max u32) ?[]u32 {
if s != '*' {
exps := s.split('/')
start = math.min(max, math.max(exps[0].u32(), min))
if exps.len > 1 {
interval = exps[1].u32()
}
// Here, s solely consists of a number, so that's the only value we
// should return.
else {
return [exps[0].u32()]
}
if exps[0] != '*' {
start = math.max(exps[0].u32(), min)
return [start]
}
}