Changed the functions in GenerateCTest to have separate tests (rather than separate assertions) for C and C++

This makes it easier to see straight away if both the C and C++ tests are failing (previously only the C test would have shown up if it failed, masking the C++ failure temporarily, until the C test passed).
This commit is contained in:
Neil Brown 2007-10-03 16:21:05 +00:00
parent 80836c0074
commit 91d9dcf3bc

View File

@ -75,16 +75,16 @@ testBothS ::
-> (State CompState ()) -- ^ State transformation
-> Test
testBothS testName expC expCPP act startState = TestCase $
do assertGen (testName ++ "/C") expC $ (evalStateT (runErrorT (execWriterT $ act cgenOps)) state)
assertGen (testName ++ "/C++") expCPP $ (evalStateT (runErrorT (execWriterT $ act cppgenOps)) state)
testBothS testName expC expCPP act startState = TestList
[TestCase $ assertGen (testName ++ "/C") expC $ (evalStateT (runErrorT (execWriterT $ act cgenOps)) state)
,TestCase $ assertGen (testName ++ "/C++") expCPP $ (evalStateT (runErrorT (execWriterT $ act cppgenOps)) state) ]
where
state = execState startState emptyState
testBothFailS :: String -> (GenOps -> CGen ()) -> (State CompState ()) -> Test
testBothFailS testName act startState = TestCase $
do assertGenFail (testName ++ "/C") (evalStateT (runErrorT (execWriterT $ act cgenOps)) state)
assertGenFail (testName ++ "/C++") (evalStateT (runErrorT (execWriterT $ act cppgenOps)) state)
testBothFailS testName act startState = TestList
[TestCase $ assertGenFail (testName ++ "/C") (evalStateT (runErrorT (execWriterT $ act cgenOps)) state)
,TestCase $ assertGenFail (testName ++ "/C++") (evalStateT (runErrorT (execWriterT $ act cppgenOps)) state) ]
where
state = execState startState emptyState