import Test.HUnit
import System.IO
import AbsSRL
import qualified AbsSRL
import Control.Monad.State
import InSRL

----受けとったリストの要素がif文、from文、step文のどれなのかを判別し、文の種類に応じて適切に反転する関数
tests = TestList
    [ "fact 1" ~:srlInv (Bstep(SasnAdd (Ident "12345") (Econ 123))) ~?= Bstep(SasnMin (Ident "12345") (Econ 123))
    , "fact 2" ~: srlInv (Bif (Econ 123)[Bstep(SasnAdd (Ident "12345") (Econ 123))][Bstep(SasnMin (Ident "12345") (Econ 123))](Econ 456)) ~?= Bif (Econ 456)[Bstep(SasnMin (Ident "12345") (Econ 123))][Bstep(SasnAdd (Ident "12345") (Econ 123))](Econ 123)
    , "fact 3" ~: srlInv (Bfrom (Econ 123)[Bstep(SasnAdd (Ident "12345") (Econ 123))][Bstep(SasnMin (Ident "12345") (Econ 123))](Econ 456)) ~?= Bfrom (Econ 456)[Bstep(SasnMin (Ident "12345") (Econ 123))][Bstep(SasnAdd (Ident "12345") (Econ 123))](Econ 123)
    ]

main =
    runTestText (putTextToHandle stderr False) tests
