diff --git a/Ganeti/HTools/QC.hs b/Ganeti/HTools/QC.hs index a133978b851b77aab551f031074946d1cabb7ec7..46fd430c0e505bae4ab7b72759a92085d11c6a8b 100644 --- a/Ganeti/HTools/QC.hs +++ b/Ganeti/HTools/QC.hs @@ -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 = diff --git a/test.hs b/test.hs index 18a5ca65b4cf1266ee94464e32b6ed2c8728d81d..14227e9a28be67f22c4b0486fa4c0c84ba113724 100644 --- a/test.hs +++ b/test.hs @@ -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