

{-# LANGUAGE OverloadedStrings #-}



{-# LANGUAGE CPP #-}
-- {-# OPTIONS_GHC -cpp -DPiForallInstalled #-}

--------------------------------------------------------------------
-- |
-- Copyright :  (c) Andreas Reuleaux 2015
-- License   :  BSD2
-- Maintainer:  Andreas Reuleaux <rx@a-rx.info>
-- Stability :  experimental
-- Portability: non-portable
--
-- This module tests Pire's parser, forget, and untie functionality
--------------------------------------------------------------------



module ParserTests.Contra where


import Test.Tasty
import Test.Tasty.HUnit


import Pire.Syntax
import Pire.NoPos
import Pire.Parser.Expr
import Pire.Forget
import Pire.Untie
import Pire.Parser.ParseUtils
import Pire.Parser.PiParseUtils


#ifdef PiForallInstalled
import qualified PiForall.Parser as P
#endif



-- contra
-- cf examples in Hw2


-- new as of May 2015
-- test w/
-- main' "contra"

parsingContraU = testGroup "parsing contra - unit tests" $ tail [

  undefined

    
  , let s = "contra pf"
    in
      testGroup ("contra  '"++s++"'") $ tail [
        undefined

        -- as a contra
        , testCase ("parsing contra  '"++s++"'")
          $ (nopos $ parse contra s) @?= (Contra (V "pf") (Annot Nothing))

          
          
          -- and as an expr as well, course
        , testCase ("parsing expr  '"++s++"'")
          $ (nopos $ parse expr s) @?= (Contra (V "pf") (Annot Nothing))
          
         
         
        , testCase ("parse & forget contra_ '"++s++"'")
         $ (forget $ parse contra_ s) @?= (parse contra s)
          
          
          -- contra_ should be an expr_ as well
        , testCase ("parse & forget expr_ '"++s++"'")
          $ (forget $ parse expr_ s) @?= (parse expr s)

        ]
         

         
         
#ifdef PiForallInstalled
  ++ tail [
    
    undefined
    
    , testCase ("parse & untie expr '"++s++"'")
      $ (untie $ parse expr s) @?= (piParse P.expr s)

    ]
      
#endif
     




  , let s = "\\ x . contra pf"
    in
      testGroup (">>= for contra: \""++s++"\"") $ tail [

        undefined

        

        --   make sure, the bind op for contra is defined
        --   trivial equality
        
        , testCase ("parsing expr  '"++s++"'")
          $ (parse expr s) @?= (parse expr s)
          

        , testCase ("parsing expr_  '"++s++"'")
          $ (parse expr_ s) @?= (parse expr_ s)


          -- , testCase ("parse & forget expr_ '"++s++"'")
          --   $ (forget $ parse expr_ s) @?= (parse expr s)
          

        ]

      
      -- indent!
      ]




