Converted one of the input case tests to use the occam EDSL, making it much clearer
This commit is contained in:
parent
42e4ca5c92
commit
278b80932e
|
@ -347,19 +347,18 @@ testInputCase = TestList
|
||||||
a0
|
a0
|
||||||
--Process p0
|
--Process p0
|
||||||
-}
|
-}
|
||||||
TestCase $ testPass "testInputCase 0"
|
testOccamPassTransform "testInputCase 0" (nameAndStopCaringPattern "tag" "Z") (
|
||||||
(tag2 A.Seq DontCare $
|
defineProtocolAndC $ (oC *? oCASEinput
|
||||||
mSpecP (tag3 A.Specification DontCare (Named "tag" DontCare) $ mDeclaration A.Int) $
|
[inputCaseOption (simpleName "a0", [], p0)]
|
||||||
mSeveralP
|
) `becomes`
|
||||||
[mOnlyP $ tag3 A.Input DontCare c $ tag2 A.InputSimple DontCare [tag2 A.InVariable DontCare $ tag2 A.Variable DontCare (Named "tag" DontCare)]
|
oSEQ
|
||||||
,mOnlyP $ tag3 A.Case DontCare (tag2 A.ExprVariable DontCare $ tag2 A.Variable DontCare (Named "tag" DontCare)) $
|
[decl (return A.Int) oZ
|
||||||
mOnlyO $ tag3 A.Option DontCare [intLiteralPattern 0] p0
|
[oC *? oZ
|
||||||
|
,oCASE oZ
|
||||||
|
[caseOption ([0 :: Int], p0)]
|
||||||
]
|
]
|
||||||
)
|
]
|
||||||
transformInputCase (
|
) transformInputCase
|
||||||
A.Input emptyMeta c $ A.InputCase emptyMeta $ A.Only emptyMeta $ A.Variant emptyMeta a0 [] p0
|
|
||||||
)
|
|
||||||
(defineMyProtocol >> defineC)
|
|
||||||
|
|
||||||
-- Input that involves multiple tags and multiple inputs:
|
-- Input that involves multiple tags and multiple inputs:
|
||||||
{-
|
{-
|
||||||
|
@ -523,6 +522,12 @@ testInputCase = TestList
|
||||||
defineC :: CSM m => m ()
|
defineC :: CSM m => m ()
|
||||||
defineC = defineName (simpleName "c") $ simpleDefDecl "c" (A.Chan A.DirUnknown (A.ChanAttributes False False) (A.UserProtocol $ simpleName "prot"))
|
defineC = defineName (simpleName "c") $ simpleDefDecl "c" (A.Chan A.DirUnknown (A.ChanAttributes False False) (A.UserProtocol $ simpleName "prot"))
|
||||||
|
|
||||||
|
defineProtocolAndC :: Data a => Occ (A.Structured a) -> Occ (A.Structured a)
|
||||||
|
defineProtocolAndC =
|
||||||
|
decl' (simpleName "prot") (A.ProtocolCase emptyMeta [(a0,[]),(b2,[A.Int,A.Int]),(c1,[A.Int])])
|
||||||
|
. (:[]) . decl (return $ A.Chan A.DirUnknown (A.ChanAttributes False False) (A.UserProtocol $ simpleName "prot"))
|
||||||
|
oC . (:[])
|
||||||
|
|
||||||
specInt s = A.Spec emptyMeta (A.Specification emptyMeta (simpleName s) $ A.Declaration emptyMeta A.Int)
|
specInt s = A.Spec emptyMeta (A.Specification emptyMeta (simpleName s) $ A.Declaration emptyMeta A.Int)
|
||||||
specIntPatt s = mSpecA' emptyMeta (A.Specification emptyMeta (simpleName s) $ A.Declaration emptyMeta A.Int)
|
specIntPatt s = mSpecA' emptyMeta (A.Specification emptyMeta (simpleName s) $ A.Declaration emptyMeta A.Int)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user