Revision cce30754 htest/Test/Ganeti/HTools/Graph.hs
b/htest/Test/Ganeti/HTools/Graph.hs | ||
---|---|---|
97 | 97 |
anyTwo op (x:y:xs) = (x `op` y) && anyTwo op (y:xs) |
98 | 98 |
|
99 | 99 |
-- | Check order of vertices returned by verticesByDegreeAsc. |
100 |
prop_verticesByDegreeAscAsc :: TestableGraph -> Property |
|
101 |
prop_verticesByDegreeAscAsc (TestableGraph g) = |
|
102 |
anyTwo (<=) (degrees asc) ==? True |
|
100 |
prop_verticesByDegreeAscAsc :: TestableGraph -> Bool |
|
101 |
prop_verticesByDegreeAscAsc (TestableGraph g) = anyTwo (<=) (degrees asc) |
|
103 | 102 |
where degrees = map (length . neighbors g) |
104 | 103 |
asc = verticesByDegreeAsc g |
105 | 104 |
|
106 | 105 |
-- | Check order of vertices returned by verticesByDegreeDesc. |
107 |
prop_verticesByDegreeDescDesc :: TestableGraph -> Property |
|
108 |
prop_verticesByDegreeDescDesc (TestableGraph g) = |
|
109 |
anyTwo (>=) (degrees desc) ==? True |
|
106 |
prop_verticesByDegreeDescDesc :: TestableGraph -> Bool |
|
107 |
prop_verticesByDegreeDescDesc (TestableGraph g) = anyTwo (>=) (degrees desc) |
|
110 | 108 |
where degrees = map (length . neighbors g) |
111 | 109 |
desc = verticesByDegreeDesc g |
112 | 110 |
|
113 | 111 |
-- | Check that our generated graphs are colorable |
114 |
prop_isColorableTestableGraph :: TestableGraph -> Property
|
|
115 |
prop_isColorableTestableGraph (TestableGraph g) = isColorable g ==? True
|
|
112 |
prop_isColorableTestableGraph :: TestableGraph -> Bool
|
|
113 |
prop_isColorableTestableGraph (TestableGraph g) = isColorable g |
|
116 | 114 |
|
117 | 115 |
-- | Check that our generated graphs are colorable |
118 |
prop_isColorableTestableClique :: TestableClique -> Property
|
|
119 |
prop_isColorableTestableClique (TestableClique g) = isColorable g ==? True
|
|
116 |
prop_isColorableTestableClique :: TestableClique -> Bool
|
|
117 |
prop_isColorableTestableClique (TestableClique g) = isColorable g |
|
120 | 118 |
|
121 | 119 |
-- | Check that the given algorithm colors a clique with the same number of |
122 | 120 |
-- colors as the vertices number. |
Also available in: Unified diff