module System.DotFS.Test.Tests where
import System.DotFS.Core.ExpressionParsers
import Text.Parsec hiding (parseTest)
import Control.Monad
import System.DotFS.Core.Datatypes
import Test.QuickCheck.Gen
import Data.Char
import Data.Map
import System.DotFS.Test.Unit()
prop_parseExpr :: DFSExpr -> Bool
prop_parseExpr xs = xs == testExprP (show xs)
testExprP :: String -> DFSExpr
testExprP inp = case runParser exprP empty "expr" inp of
Left err -> Prim . VString $ "error = \n" ++ show (errorPos err) ++ "\n"
Right s -> s
arbitraryStr :: Gen String
arbitraryStr = sized $ \n ->
do k <- choose (0,n)
sequence [ arbitraryChar | _ <- [1..k] ]
arbitraryChar :: Gen Char
arbitraryChar = chr `fmap` oneof [choose (65,90), choose (97,122)]