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

--受け取ったリストのそれぞれの要素を、関数srlInvで評価する
tests = TestList
    [ "fact 1" ~:mapInv [Bstep(SasnAdd (Ident "12345") (Econ 123))] ~?= [Bstep(SasnMin (Ident "12345") (Econ 123))]
    , "fact 2" ~: mapInv [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" ~: mapInv [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
