Skip to content

Commit

Permalink
add test cases for DualizeInfo instance of ToJSON/FromJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
msakai committed Dec 3, 2024
1 parent d2b1ba7 commit 4009d47
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/Test/SDPFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
module Test.SDPFile (sdpTestGroup) where

import Control.Monad
import qualified Data.Aeson as J
import Data.List
import Data.Maybe
import Data.ByteString.Builder (toLazyByteString)
import Test.Tasty
import Test.Tasty.QuickCheck
import Test.Tasty.HUnit
import Test.Tasty.TH

import qualified ToySolver.SDP as SDP
import ToySolver.Text.SDPFile

------------------------------------------------------------------------
Expand Down Expand Up @@ -74,6 +77,20 @@ checkParsed actual expected =
Left err -> assertFailure $ show err
Right prob -> prob @?= expected

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

case_dualize_json_example1 :: Assertion
case_dualize_json_example1 = do
let ret@(_, info) = SDP.dualize example1
json = J.encode info
J.eitherDecode json @?= Right info

case_dualize_json_example2 :: Assertion
case_dualize_json_example2 = do
let ret@(_, info) = SDP.dualize example2
json = J.encode info
J.eitherDecode json @?= Right info

------------------------------------------------------------------------
-- Test harness

Expand Down

0 comments on commit 4009d47

Please sign in to comment.