Simplified the tests for IsChannelArray a little by overriding genVariable in the test

This commit is contained in:
Neil Brown 2007-10-06 13:32:12 +00:00
parent 0517465eff
commit 0cf27ce4b6

View File

@ -477,11 +477,11 @@ testSpec = TestList
--IsChannelArray: --IsChannelArray:
,testAll 500 ,testAll 500
("$(" ++ show chanInt ++ ")*foo[]={(&c),(&c)};const int foo_sizes[]={2};","") ("$(" ++ show chanInt ++ ")*foo[]={@,@};const int foo_sizes[]={2};","")
("$(" ++ show chanInt ++ ")*foo_actual[]={(&c),(&c)};const $(" ++ show (A.Array [A.Dimension 2] $ chanInt) ++ ") foo=$(" ("$(" ++ show chanInt ++ ")*foo_actual[]={@,@};const $(" ++ show (A.Array [A.Dimension 2] $ chanInt) ++ ") foo=$("
++ show (A.Array [A.Dimension 2] $ chanInt) ++ ")(foo_actual,tockDims(2));","") ++ show (A.Array [A.Dimension 2] $ chanInt) ++ ")(foo_actual,tockDims(2));","")
$ A.IsChannelArray emptyMeta (A.Array [A.Dimension 2] $ chanInt) $ A.IsChannelArray emptyMeta (A.Array [A.Dimension 2] $ chanInt)
[A.Variable emptyMeta $ simpleName "c",A.Variable emptyMeta $ simpleName "c"] [A.Variable undefined undefined,A.Variable undefined undefined]
--TODO Is --TODO Is
@ -497,14 +497,14 @@ testSpec = TestList
testAll :: Int -> (String,String) -> (String,String) -> A.SpecType -> Test testAll :: Int -> (String,String) -> (String,String) -> A.SpecType -> Test
testAll n (eCI,eCR) (eCPPI,eCPPR) spec = TestList testAll n (eCI,eCR) (eCPPI,eCPPR) spec = TestList
[ [
testBothS ("testSpec " ++ show n) eCI eCPPI ((tcall introduceSpec $ A.Specification emptyMeta foo spec) . over) state testBoth ("testSpec " ++ show n) eCI eCPPI ((tcall introduceSpec $ A.Specification emptyMeta foo spec) . over)
,testBothS ("testSpec " ++ show n) eCR eCPPR ((tcall removeSpec $ A.Specification emptyMeta foo spec) . over) state ,testBoth ("testSpec " ++ show n) eCR eCPPR ((tcall removeSpec $ A.Specification emptyMeta foo spec) . over)
] ]
testAllSame n e s = testAll n e e s testAllSame n e s = testAll n e e s
state = defineName (simpleName "c") $ simpleDefDecl "c" $ A.Chan A.DirUnknown (A.ChanAttributes False False) A.Int over ops = ops {genDeclaration = override2 (tell . (\x -> ["#ATION_",show x]))
over ops = ops {genDeclaration = override2 (tell . (\x -> ["#ATION_",show x])), genDecl = override3 (tell ["#DECL"])
,declareInit = (override3 (Just $ tell ["#INIT"])), declareFree = override3 (Just $ tell ["#FREE"]) ,declareInit = (override3 (Just $ tell ["#INIT"])), declareFree = override3 (Just $ tell ["#FREE"])
,genType = (\_ x -> tell ["$(",show x,")"]) ,genType = (\_ x -> tell ["$(",show x,")"])
,genVariable = override1 at
} }