Commit 691dcd2a authored by Iustin Pop's avatar Iustin Pop
Browse files

Remove an obsolete function and add Utils tests

parent b880f1d1
......@@ -24,7 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Ganeti.HTools.QC
( testPeerMap
( testUtils
, testPeerMap
, testContainer
, testInstance
, testNode
......@@ -192,6 +193,21 @@ instance Arbitrary Jobs.JobStatus where
-- * Actual tests
-- | Test utils separator/joiner functions
-- If the list is not just an empty element, and if the elements do
-- not contain commas, then join+split should be idepotent
prop_Utils_commaJoinSplit lst = lst /= [""] &&
all (not . elem ',') lst ==>
Utils.sepSplit ',' (Utils.commaJoin lst) == lst
-- Split and join should always be idempotent
prop_Utils_commaSplitJoin s = Utils.commaJoin (Utils.sepSplit ',' s) == s
testUtils =
[ run prop_Utils_commaJoinSplit
, run prop_Utils_commaSplitJoin
]
-- | Make sure add is idempotent
prop_PeerMap_addIdempotent pmap key em =
fn puniq == fn (fn puniq)
......
......@@ -25,7 +25,6 @@ module Ganeti.HTools.Utils
(
debug
, sepSplit
, fst3
, varianceCoeff
, commaJoin
, readEitherString
......@@ -73,10 +72,6 @@ sepSplit sep s
where (x, xs) = break (== sep) s
ys = drop 1 xs
-- | Simple version of 'fst' for a triple
fst3 :: (a, b, c) -> a
fst3 (a, _, _) = a
-- * Mathematical functions
-- Simple and slow statistical functions, please replace with better
......
......@@ -64,7 +64,8 @@ wrapTest ir t to = do
allTests :: [(String, TestOptions, [TestOptions -> IO TestResult])]
allTests =
[ ("PeerMap", fast, testPeerMap)
[ ("Utils", fast, testUtils)
, ("PeerMap", fast, testPeerMap)
, ("Container", fast, testContainer)
, ("Instance", fast, testInstance)
, ("Node", fast, testNode)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment