Adjusted the tests for findMain to allow a nonce to be using during name mangling
This commit is contained in:
parent
0c28f6255c
commit
0913ab655c
|
@ -267,14 +267,17 @@ testRecordInfNames3 = testPassShouldFail "testRecordInfNames3" (recordInfNameTyp
|
||||||
--TODO check recursive main function works
|
--TODO check recursive main function works
|
||||||
|
|
||||||
testFindMain0 :: Test
|
testFindMain0 :: Test
|
||||||
testFindMain0 = testPassWithStateCheck "testFindMain0" exp ((uniquifyAndResolveVars >>> findMain) orig) (return ()) check
|
testFindMain0 = testPassWithItemsStateCheck "testFindMain0" exp ((uniquifyAndResolveVars >>> findMain) orig) (return ()) check
|
||||||
where
|
where
|
||||||
proc name = A.Spec m (A.Specification m (A.Name m A.ProcName name) $ A.Proc m A.PlainSpec [] (A.Skip m)) $ A.Several m []
|
orig = A.Spec m (A.Specification m (A.Name m A.ProcName "main") $ A.Proc m A.PlainSpec [] (A.Skip m)) $ A.Several m []
|
||||||
orig = proc "main"
|
exp = tag3 A.Spec DontCare (tag3 A.Specification DontCare (tag3 A.Name DontCare A.ProcName (Named "main" DontCare)) $
|
||||||
exp = proc "____main"
|
tag4 A.Proc DontCare A.PlainSpec ([] :: [A.Formal]) (tag1 A.Skip DontCare)) $ tag2 A.Several DontCare ([] :: [A.Structured])
|
||||||
check state = do assertEqual "testFindMain0 A" [("____main",(A.Name m A.ProcName "____main"))] (csMainLocals state)
|
check (items,state)
|
||||||
assertVarDef "testFindMain0 B" state "____main"
|
= do mainName <- castAssertADI (Map.lookup "main" items)
|
||||||
(tag7 A.NameDef DontCare "____main" "main" A.ProcName DontCare A.Original A.Unplaced)
|
assertNotEqual "testFindMain0 A" "main" mainName
|
||||||
|
assertEqual "testFindMain0 B" [(mainName,(A.Name m A.ProcName mainName))] (csMainLocals state)
|
||||||
|
assertVarDef "testFindMain0 C" state mainName
|
||||||
|
(tag7 A.NameDef DontCare mainName "main" A.ProcName DontCare A.Original A.Unplaced)
|
||||||
|
|
||||||
testFindMain1 :: Test
|
testFindMain1 :: Test
|
||||||
testFindMain1 = testPassWithStateCheck "testFindMain1" orig ((uniquifyAndResolveVars >>> findMain) orig) (return ()) check
|
testFindMain1 = testPassWithStateCheck "testFindMain1" orig ((uniquifyAndResolveVars >>> findMain) orig) (return ()) check
|
||||||
|
@ -283,25 +286,18 @@ testFindMain1 = testPassWithStateCheck "testFindMain1" orig ((uniquifyAndResolve
|
||||||
check state = assertEqual "testFindMain1" [] (csMainLocals state)
|
check state = assertEqual "testFindMain1" [] (csMainLocals state)
|
||||||
|
|
||||||
testFindMain2 :: Test
|
testFindMain2 :: Test
|
||||||
testFindMain2 = testPassWithStateCheck "testFindMain2" exp ((uniquifyAndResolveVars >>> findMain) orig) (return ()) check
|
testFindMain2 = testPassWithItemsStateCheck "testFindMain2" exp ((uniquifyAndResolveVars >>> findMain) orig) (return ()) check
|
||||||
where
|
where
|
||||||
proc name = A.Spec m (A.Specification m (A.Name m A.ProcName name) $ A.Proc m A.PlainSpec [] (A.Skip m)) $
|
inner = A.Spec m (A.Specification m (A.Name m A.ProcName "foo") $ A.Proc m A.PlainSpec [] (A.Skip m)) $
|
||||||
A.Spec m (A.Specification m (A.Name m A.ProcName "foo") $ A.Proc m A.PlainSpec [] (A.Skip m)) $
|
A.Several m []
|
||||||
A.Several m []
|
orig = A.Spec m (A.Specification m (A.Name m A.ProcName "main") $ A.Proc m A.PlainSpec [] (A.Skip m)) inner
|
||||||
orig = proc "main"
|
|
||||||
exp = proc "____main"
|
exp = tag3 A.Spec DontCare (tag3 A.Specification DontCare (tag3 A.Name DontCare A.ProcName (Named "main" DontCare)) $
|
||||||
check state = assertEqual "testFindMain2" [("____main",(A.Name m A.ProcName "____main"))] (csMainLocals state)
|
tag4 A.Proc DontCare A.PlainSpec ([] :: [A.Formal]) (tag1 A.Skip DontCare)) (stopCaringPattern m $ mkPattern inner)
|
||||||
|
check (items,state)
|
||||||
testFindMain3 :: Test
|
= do mainName <- castAssertADI (Map.lookup "main" items)
|
||||||
testFindMain3 = testPassWithStateCheck "testFindMain3" exp ((uniquifyAndResolveVars >>> findMain) orig) (return ()) check
|
assertNotEqual "testFindMain2 A" "main" mainName
|
||||||
where
|
assertEqual "testFindMain2 B" [(mainName,(A.Name m A.ProcName mainName))] (csMainLocals state)
|
||||||
proc name = A.Spec m (A.Specification m (A.Name m A.ProcName "foo") $ A.Proc m A.PlainSpec [] (A.Skip m)) $
|
|
||||||
A.Spec m (A.Specification m (A.Name m A.ProcName name) $ A.Proc m A.PlainSpec [] (A.Skip m)) $
|
|
||||||
A.Several m []
|
|
||||||
orig = proc "main"
|
|
||||||
exp = proc "____main"
|
|
||||||
check state = assertEqual "testFindMain3" [("____main",(A.Name m A.ProcName "____main"))] (csMainLocals state)
|
|
||||||
|
|
||||||
|
|
||||||
--Returns the list of tests:
|
--Returns the list of tests:
|
||||||
tests :: Test
|
tests :: Test
|
||||||
|
@ -321,7 +317,6 @@ tests = TestList
|
||||||
,testFindMain0
|
,testFindMain0
|
||||||
,testFindMain1
|
,testFindMain1
|
||||||
,testFindMain2
|
,testFindMain2
|
||||||
,testFindMain3
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user