|
1 | 1 | {-# LANGUAGE DerivingStrategies #-} |
| 2 | +{-# LANGUAGE TemplateHaskell #-} |
2 | 3 | {-# LANGUAGE TypeApplications #-} |
3 | 4 | {-# LANGUAGE ScopedTypeVariables #-} |
4 | 5 | {-# LANGUAGE NumericUnderscores #-} |
@@ -34,6 +35,21 @@ prop_subtract_topsort g g' = |
34 | 35 | isRight (topsort g) ==> |
35 | 36 | isRight (topsort $ subtractGraph g g') |
36 | 37 |
|
| 38 | +prop_subtract_union :: Graph Node -> Graph Node -> Property |
| 39 | +prop_subtract_union g g0' = |
| 40 | + let g' = subtractGraph g g0' |
| 41 | + in subtractGraph g g' <> g' === g |
| 42 | + |
| 43 | +prop_subtract_keeps_nodes :: Graph Node -> Graph Node -> Property |
| 44 | +prop_subtract_keeps_nodes g g' = nodes (subtractGraph g g') === nodes g |
| 45 | + |
| 46 | +prop_subtract_removes_edges :: Graph Node -> Graph Node -> Node -> Node -> Property |
| 47 | +prop_subtract_removes_edges g g' x y = |
| 48 | + property $ not (dependsOn x y (subtractGraph g $ dependency x (Set.singleton y) <> g')) |
| 49 | + |
| 50 | +prop_union_commutes :: Graph Node -> Graph Node -> Property |
| 51 | +prop_union_commutes g g' = g <> g' === g' <> g |
| 52 | + |
37 | 53 | prop_delete_topsort :: Graph Node -> Node -> Property |
38 | 54 | prop_delete_topsort g n = |
39 | 55 | isRight (topsort g) ==> |
@@ -95,22 +111,8 @@ prop_find_cycle_loops = |
95 | 111 | | n <- Set.toList $ nodes g |
96 | 112 | ] |
97 | 113 |
|
| 114 | +return [] |
| 115 | + |
98 | 116 | tests :: Bool -> Spec |
99 | 117 | tests _nightly = |
100 | | - describe "Graph tests" $ do |
101 | | - prop "prop_arbitrary_reasonable_distribution" $ checkCoverage $ prop_arbitrary_reasonable_distribution |
102 | | - prop "prop_no_dependencies_topsort" $ checkCoverage $ prop_no_dependencies_topsort |
103 | | - prop "prop_subtract_topsort" $ checkCoverage $ prop_subtract_topsort |
104 | | - prop "prop_delete_topsort" $ checkCoverage $ prop_delete_topsort |
105 | | - prop "prop_op_topsort" $ checkCoverage $ prop_op_topsort |
106 | | - prop "prop_trC_topsort" $ checkCoverage $ prop_trC_topsort |
107 | | - prop "prop_trC_opgraph_commute" $ checkCoverage $ prop_trC_opgraph_commute |
108 | | - prop "prop_depends_grows" $ checkCoverage $ prop_depends_grows |
109 | | - prop "prop_topsort_all_nodes" $ checkCoverage $ prop_topsort_all_nodes |
110 | | - prop "prop_topsort_sound" $ checkCoverage $ prop_topsort_sound |
111 | | - prop "prop_topsort_complete" $ checkCoverage $ prop_topsort_complete |
112 | | - prop "prop_find_cycle_sound" $ checkCoverage $ prop_find_cycle_sound |
113 | | - prop "prop_find_cycle_loops" $ checkCoverage $ prop_find_cycle_loops |
114 | | - |
115 | | -runTests :: IO () |
116 | | -runTests = hspec $ tests False |
| 118 | + describe "Graph tests" $ sequence_ [ prop n (checkCoverage $ withMaxSuccess 1000 p) | (n, p) <- $allProperties ] |
0 commit comments