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

--反転したSRL文を表示する関数
tests = TestList
    [ "fact 1" ~: inSRL(ESRL[Bstep(SasnAdd (Ident "12345") (Econ 123))]) ~?= ESRL[Bstep(SasnMin (Ident "12345") (Econ 123))]
    , "fact 2" ~: inSRL(ESRL[Bif (Econ 123)[Bstep(SasnAdd (Ident "12345") (Econ 123))][Bstep(SasnMin (Ident "12345") (Econ 123))](Econ 456)]) ~?=ESRL[Bif (Econ 456)[Bstep(SasnMin (Ident "12345") (Econ 123))][Bstep(SasnAdd (Ident "12345") (Econ 123))](Econ 123)]
    , "fact 3" ~: inSRL(ESRL[Bfrom (Econ 123)[Bstep(SasnAdd (Ident "12345") (Econ 123))][Bstep(SasnMin (Ident "12345") (Econ 123))](Econ 456)]) ~?=ESRL[Bfrom (Econ 456)[Bstep(SasnMin (Ident "12345") (Econ 123))][Bstep(SasnAdd (Ident "12345") (Econ 123))](Econ 123)]
    ]

main =
    runTestText (putTextToHandle stderr False) tests
