Revision 1cb92fac htools/Ganeti/HTools/QC.hs
b/htools/Ganeti/HTools/QC.hs | ||
---|---|---|
334 | 334 |
tlist = map (\e -> (True, e)) lst2 |
335 | 335 |
cndlist = flist ++ tlist ++ [undefined] |
336 | 336 |
|
337 |
prop_Utils_parseUnit (NonNegative n) = |
|
338 |
Utils.parseUnit (show n) == Types.Ok n && |
|
339 |
Utils.parseUnit (show n ++ "m") == Types.Ok n && |
|
340 |
(case Utils.parseUnit (show n ++ "M") of |
|
341 |
Types.Ok m -> if n > 0 |
|
342 |
then m < n -- for positive values, X MB is less than X MiB |
|
343 |
else m == 0 -- but for 0, 0 MB == 0 MiB |
|
344 |
Types.Bad _ -> False) && |
|
345 |
Utils.parseUnit (show n ++ "g") == Types.Ok (n*1024) && |
|
346 |
Utils.parseUnit (show n ++ "t") == Types.Ok (n*1048576) && |
|
347 |
Types.isBad (Utils.parseUnit (show n ++ "x")::Types.Result Int) |
|
348 |
where _types = (n::Int) |
|
349 |
|
|
337 | 350 |
-- | Test list for the Utils module. |
338 | 351 |
testUtils = |
339 | 352 |
[ run prop_Utils_commaJoinSplit |
... | ... | |
343 | 356 |
, run prop_Utils_select |
344 | 357 |
, run prop_Utils_select_undefd |
345 | 358 |
, run prop_Utils_select_undefv |
359 |
, run prop_Utils_parseUnit |
|
346 | 360 |
] |
347 | 361 |
|
348 | 362 |
-- ** PeerMap tests |
Also available in: Unified diff