Skip to content
Snippets Groups Projects
Commit 095d7ac0 authored by Iustin Pop's avatar Iustin Pop
Browse files

A simple test for Container.addTwo

parent 7bc82927
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ import qualified Ganeti.HTools.Utils as Utils
-- copied from the introduction to quickcheck
instance Arbitrary Char where
arbitrary = choose ('\32', '\128')
arbitrary = choose ('\32', '\128')
-- let's generate a random instance
instance Arbitrary Instance.Instance where
......@@ -81,6 +81,17 @@ prop_PeerMap_maxElem pmap =
where _types = pmap::PeerMap.PeerMap
puniq = PeerMap.accumArray const pmap
-- Container tests
prop_Container_addTwo cdata i1 i2 =
fn i1 i2 cont == fn i2 i1 cont &&
fn i1 i2 cont == fn i1 i2 (fn i1 i2 cont)
where _types = (cdata::[Int],
i1::Int, i2::Int)
cont = foldl (\c x -> Container.add x x c) Container.empty cdata
fn x1 x2 = Container.addTwo x1 x1 x2 x2
-- Simple instance tests, we only have setter/getters
prop_Instance_setIdx inst idx =
......
......@@ -21,6 +21,9 @@ main = do
, run prop_PeerMap_findMissing
]
runTests "Container" options
[ run prop_Container_addTwo ]
runTests "Instance" options
[ run prop_Instance_setIdx
, run prop_Instance_setName
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment