Started using the stopCaringPattern function to easily use assertPatternMatch (which pretty-prints its output) instead of assertEqual (which just uses Show)
This commit is contained in:
parent
d514d40943
commit
7e51ad1b1c
|
@ -182,8 +182,8 @@ testEach :: [ParseTest A.Process]
|
|||
testEach =
|
||||
[
|
||||
pass ("seqeach (c : \"1\") c = 7;", RP.statement,
|
||||
assertEqual "Each Test 0" $ A.Seq m $ A.Rep m (A.ForEach m (simpleName "c") (makeLiteralString "1")) $
|
||||
A.OnlyP m $ (makeAssign (variable "c") (A.Literal m A.Int (A.IntLiteral m "7"))) )
|
||||
assertPatternMatch "Each Test 0" (stopCaringPattern m $ mkPattern $ A.Seq m $ A.Rep m (A.ForEach m (simpleName "c") (makeLiteralString "1")) $
|
||||
A.OnlyP m $ (makeAssign (variable "c") (A.Literal m A.Int (A.IntLiteral m "7"))) ))
|
||||
,pass ("pareach (c : \"345\") {c = 1; c = 2;}", RP.statement,
|
||||
assertEqual "Each Test 1" $ A.Par m A.PlainPar $ A.Rep m (A.ForEach m (simpleName "c") (makeLiteralString "345")) $
|
||||
A.OnlyP m $ makeSeq[(makeAssign (variable "c") (A.Literal m A.Int (A.IntLiteral m "1"))),(makeAssign (variable "c") (A.Literal m A.Int (A.IntLiteral m "2")))] )
|
||||
|
|
|
@ -56,7 +56,7 @@ intLiteral :: Int -> A.Expression
|
|||
intLiteral n = A.Literal m A.Int $ A.IntLiteral m (show n)
|
||||
|
||||
intLiteralPattern :: Int -> Pattern
|
||||
intLiteralPattern n = tag3 A.Literal DontCare A.Int (tag2 A.IntLiteral DontCare (show n))
|
||||
intLiteralPattern = (stopCaringPattern m) . mkPattern . intLiteral
|
||||
|
||||
makeNamesWR :: ([String],[String]) -> ([A.Variable],[A.Variable])
|
||||
makeNamesWR (x,y) = (map variable x,map variable y)
|
||||
|
@ -85,6 +85,8 @@ makeLiteralString str = A.Literal m (A.Array [A.Dimension (length str)] A.Byte)
|
|||
makeLiteralChar :: Char -> A.ArrayElem
|
||||
makeLiteralChar c = A.ArrayElemExpr $ A.Literal m A.Byte (A.ByteLiteral m [c] {-(show (fromEnum c))-})
|
||||
|
||||
makeLiteralStringPattern :: String -> Pattern
|
||||
makeLiteralStringPattern = (stopCaringPattern m) . mkPattern . makeLiteralString
|
||||
|
||||
assertCompareCustom :: (Show a) => String -> (a -> a -> Bool) -> a -> a -> Assertion
|
||||
assertCompareCustom preface cmp expected actual =
|
||||
|
|
Loading…
Reference in New Issue
Block a user