Added a test of genGetTime for the C and C++ backends

This commit is contained in:
Neil Brown 2007-10-04 14:06:15 +00:00
parent bc7e1b1433
commit af74ac1039
3 changed files with 9 additions and 2 deletions

View File

@ -107,6 +107,7 @@ data GenOps = GenOps {
genForwardDeclaration :: GenOps -> A.Specification -> CGen(), genForwardDeclaration :: GenOps -> A.Specification -> CGen(),
genFuncDyadic :: GenOps -> Meta -> String -> A.Expression -> A.Expression -> CGen (), genFuncDyadic :: GenOps -> Meta -> String -> A.Expression -> A.Expression -> CGen (),
genFuncMonadic :: GenOps -> Meta -> String -> A.Expression -> CGen (), genFuncMonadic :: GenOps -> Meta -> String -> A.Expression -> CGen (),
-- | Gets the current time into the given variable
genGetTime :: GenOps -> Meta -> A.Variable -> CGen (), genGetTime :: GenOps -> Meta -> A.Variable -> CGen (),
genIf :: GenOps -> Meta -> A.Structured -> CGen (), genIf :: GenOps -> Meta -> A.Structured -> CGen (),
genInput :: GenOps -> A.Variable -> A.InputMode -> CGen (), genInput :: GenOps -> A.Variable -> A.InputMode -> CGen (),
@ -1568,7 +1569,7 @@ cgenGetTime :: GenOps -> Meta -> A.Variable -> CGen ()
cgenGetTime ops m v cgenGetTime ops m v
= do tell ["ProcTime(&"] = do tell ["ProcTime(&"]
call genVariable ops v call genVariable ops v
tell [");\n"] tell [");"]
cgenWait :: GenOps -> A.WaitMode -> A.Expression -> CGen () cgenWait :: GenOps -> A.WaitMode -> A.Expression -> CGen ()
cgenWait ops A.WaitUntil e = call genTimerWait ops e cgenWait ops A.WaitUntil e = call genTimerWait ops e

View File

@ -344,7 +344,7 @@ cppgenTimerRead ops c v
cppgenGetTime :: GenOps -> Meta -> A.Variable -> CGen () cppgenGetTime :: GenOps -> Meta -> A.Variable -> CGen ()
cppgenGetTime ops m v cppgenGetTime ops m v
= do tell ["csp::CurrentTime (&"] = do tell ["csp::CurrentTime(&"]
call genVariable ops v call genVariable ops v
tell [");"] tell [");"]

View File

@ -548,6 +548,11 @@ testCase = TestList
spec = A.Spec emptyMeta undefined spec = A.Spec emptyMeta undefined
over ops = ops {genExpression = override1 dollar, genProcess = override1 at, genStop = override2 caret, genSpec = override2 hash} over ops = ops {genExpression = override1 dollar, genProcess = override1 at, genStop = override2 caret, genSpec = override2 hash}
testGetTime :: Test
testGetTime = testBoth "testGetTime 0" "ProcTime(&@);" "csp::CurrentTime(&@);" ((tcall2 genGetTime emptyMeta undefined) . over)
where
over ops = ops {genVariable = override1 at}
---Returns the list of tests: ---Returns the list of tests:
tests :: Test tests :: Test
tests = TestList tests = TestList
@ -561,6 +566,7 @@ tests = TestList
,testDeclareInitFree ,testDeclareInitFree
,testGenType ,testGenType
,testGenVariable ,testGenVariable
,testGetTime
,testOverArray ,testOverArray
,testReplicator ,testReplicator
,testStop ,testStop