1 {-# LANGUAGE DataKinds #-} -- For using P.viewGrammar
2 {-# LANGUAGE Rank2Types #-}
3 {-# LANGUAGE TypeApplications #-}
4 module Golden.Grammar where
6 import Data.Bool (Bool(..))
7 import Control.Monad (Monad(..))
8 import Data.Function (($))
9 import Data.Semigroup (Semigroup(..))
10 import Data.String (IsString(..))
12 import Test.Tasty.Golden
13 import Text.Show (Show(..))
15 import qualified Data.List as List
18 import qualified Symantic.Parser as P
19 import qualified Grammar
22 goldens = testGroup "Grammar" $
23 [ testGroup "ViewGrammar" $
24 (\f -> List.zipWith f Grammar.grammars [1::Int ..]) $ \g gNum ->
25 let grammarFile = getGoldenDir $ "Grammar/ViewGrammar/G"<>show gNum<>".expected.txt" in
26 goldenVsStringDiff ("G"<>show gNum) goldenDiff grammarFile $ do
28 return $ fromString $ show $
29 P.viewGrammar @'False g
30 , testGroup "OptimizeGrammar" $
31 (\f -> List.zipWith f Grammar.grammars [1::Int ..]) $ \g gNum ->
32 let grammarFile = getGoldenDir $ "Grammar/OptimizeGrammar/G"<>show gNum<>".expected.txt" in
33 goldenVsStringDiff ("G"<>show gNum) goldenDiff grammarFile $ do
35 return $ fromString $ show $
36 P.viewGrammar @'False $