Skip to content
Snippets Groups Projects
Commit cce30754 authored by Guido Trotter's avatar Guido Trotter
Browse files

Improve a few Graph test properties


Return type is changed from Property to Bool, and the ==? True at the
end is dropped.

Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent f127e585
No related branches found
No related tags found
No related merge requests found
......@@ -97,26 +97,24 @@ anyTwo _ [_] = True
anyTwo op (x:y:xs) = (x `op` y) && anyTwo op (y:xs)
-- | Check order of vertices returned by verticesByDegreeAsc.
prop_verticesByDegreeAscAsc :: TestableGraph -> Property
prop_verticesByDegreeAscAsc (TestableGraph g) =
anyTwo (<=) (degrees asc) ==? True
prop_verticesByDegreeAscAsc :: TestableGraph -> Bool
prop_verticesByDegreeAscAsc (TestableGraph g) = anyTwo (<=) (degrees asc)
where degrees = map (length . neighbors g)
asc = verticesByDegreeAsc g
-- | Check order of vertices returned by verticesByDegreeDesc.
prop_verticesByDegreeDescDesc :: TestableGraph -> Property
prop_verticesByDegreeDescDesc (TestableGraph g) =
anyTwo (>=) (degrees desc) ==? True
prop_verticesByDegreeDescDesc :: TestableGraph -> Bool
prop_verticesByDegreeDescDesc (TestableGraph g) = anyTwo (>=) (degrees desc)
where degrees = map (length . neighbors g)
desc = verticesByDegreeDesc g
-- | Check that our generated graphs are colorable
prop_isColorableTestableGraph :: TestableGraph -> Property
prop_isColorableTestableGraph (TestableGraph g) = isColorable g ==? True
prop_isColorableTestableGraph :: TestableGraph -> Bool
prop_isColorableTestableGraph (TestableGraph g) = isColorable g
-- | Check that our generated graphs are colorable
prop_isColorableTestableClique :: TestableClique -> Property
prop_isColorableTestableClique (TestableClique g) = isColorable g ==? True
prop_isColorableTestableClique :: TestableClique -> Bool
prop_isColorableTestableClique (TestableClique g) = isColorable g
-- | Check that the given algorithm colors a clique with the same number of
-- colors as the vertices number.
......
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