Skip to content

Commit

Permalink
add test cases for satToSimpleMaxCut
Browse files Browse the repository at this point in the history
  • Loading branch information
msakai committed Dec 13, 2024
1 parent 58ca002 commit 9537213
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/Test/Converter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,34 @@ prop_maxSAT2ToSimpleMaxCut_json =
in counterexample (show ret) $ counterexample (show json) $
J.eitherDecode json === Right info

-- -- Too Slow
-- prop_satToSimpleMaxCut_forward :: Property
-- prop_satToSimpleMaxCut_forward =
-- forAll arbitraryCNF $ \cnf ->
-- let ret@((g, threshold), info) = satToSimpleMaxCut cnf
-- in counterexample (show ret) $
-- forAllAssignments (CNF.cnfNumVars cnf) $ \m ->
-- evalCNF m cnf === (MaxCut.eval (transformForward info m) g >= threshold)

-- -- Too Slow
-- prop_satToSimpleMaxCut_backward :: Property
-- prop_satToSimpleMaxCut_backward = forAll arbitraryCNF $ \cnf ->
-- let ret@((g, threshold),info) = satToSimpleMaxCut cnf
-- in counterexample (show ret) $
-- forAll (arbitraryCut g) $ \cut ->
-- if MaxCut.eval cut g >= threshold then
-- evalCNF (transformBackward info cut) cnf
-- else
-- True

prop_satToSimpleMaxCut_json :: Property
prop_satToSimpleMaxCut_json =
forAll arbitraryCNF $ \cnf ->
let ret@(_, info) = satToSimpleMaxCut cnf
json = J.encode info
in counterexample (show ret) $ counterexample (show json) $
J.eitherDecode json === Right info

------------------------------------------------------------------------

prop_satToIS_forward :: Property
Expand Down

0 comments on commit 9537213

Please sign in to comment.