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

--SRL文のStepを反転する関数
tests = TestList
    [ "fact 1" ~: transStepIn (SasnAdd (Ident "12345") (Econ 123)) ~?= SasnMin (Ident "12345") (Econ 123)
    , "fact 2" ~: transStepIn (SasnMin (Ident "12345") (Econ 123)) ~?= SasnAdd (Ident "12345") (Econ 123)
    , "fact 3" ~: transStepIn (SasnXor (Ident "12345") (Econ 123)) ~?= SasnXor (Ident "12345") (Econ 123)
    , "fact 4" ~: transStepIn (SasnArrAdd (Ident "12345") (Econ 123) (Econ 456)) ~?= SasnArrMin (Ident "12345") (Econ 123) (Econ 456)
    , "fact 5" ~: transStepIn (SasnArrMin (Ident "12345") (Econ 123) (Econ 456)) ~?= SasnArrAdd (Ident "12345") (Econ 123) (Econ 456)
    , "fact 6" ~: transStepIn (SasnArrXor (Ident "12345") (Econ 123) (Econ 456)) ~?= SasnArrXor (Ident "12345") (Econ 123) (Econ 456)
    , "fact 7" ~: transStepIn (Spush (Ident "123") (Ident "456")) ~?= Spop (Ident "123") (Ident "456")
    , "fact 8" ~: transStepIn (Spop (Ident "123") (Ident "456")) ~?= Spush (Ident "123") (Ident "456")
    , "fact 9" ~: transStepIn (Sskip) ~?= Sskip
    ]

main =
    runTestText (putTextToHandle stderr False) tests
