Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-ganeti
Commits
691dcd2a
Commit
691dcd2a
authored
Jul 21, 2010
by
Iustin Pop
Browse files
Remove an obsolete function and add Utils tests
parent
b880f1d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Ganeti/HTools/QC.hs
View file @
691dcd2a
...
...
@@ -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
)
...
...
Ganeti/HTools/Utils.hs
View file @
691dcd2a
...
...
@@ -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
...
...
test.hs
View file @
691dcd2a
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment