From e90ea48baac6594fe598c6a7da061fed53fee5a7 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sun, 9 Mar 2008 17:26:37 +0000 Subject: [PATCH] Fixed the test for genOverArray, to test arrays with fixed and unknown dimensions --- backends/GenerateCTest.hs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/backends/GenerateCTest.hs b/backends/GenerateCTest.hs index 5f6b3dc..3d8477f 100644 --- a/backends/GenerateCTest.hs +++ b/backends/GenerateCTest.hs @@ -389,20 +389,33 @@ testOverArray = TestList $ map testOverArray' testOverArray' :: ((Int -> String),[(String,[Int])] -> String,String, GenOps) -> Test testOverArray' (sz,f',suff,ops) = TestCase $ - do testRS "testOverArray'" rx1 (flip runReaderT ops $ tcall3 genOverArray emptyMeta (A.Variable emptyMeta foo) func) state1 - testRS "testOverArray'" rx3 (flip runReaderT ops $ tcall3 genOverArray emptyMeta (A.Variable emptyMeta foo) func) state3 + do testRS "testOverArray'" rx1Static (flip runReaderT ops $ tcall3 genOverArray emptyMeta (A.Variable emptyMeta foo) func) state1Static + testRS "testOverArray'" rx1Dynamic (flip runReaderT ops $ tcall3 genOverArray emptyMeta (A.Variable emptyMeta foo) func) state1Dynamic + testRS "testOverArray'" rx3Static (flip runReaderT ops $ tcall3 genOverArray emptyMeta (A.Variable emptyMeta foo) func) state3Static + testRS "testOverArray'" rx3Dynamic (flip runReaderT ops $ tcall3 genOverArray emptyMeta (A.Variable emptyMeta foo) func) state3Dynamic return () where func f = Just $ call genVariableUnchecked (f $ A.Variable emptyMeta foo) >> tell [";"] - rx1 = "^for\\(int ([[:alnum:]_]+)=0;\\1 m () - state1 = defineName (simpleName "foo") $ simpleDefDecl "foo" (A.Array [A.Dimension 7] A.Int) - state3 :: CSM m => m () - state3 = defineName (simpleName "foo") $ simpleDefDecl "foo" (A.Array [A.Dimension 7, A.Dimension 8, A.Dimension 9] A.Int) + state1Static :: CSM m => m () + state1Static = defineName (simpleName "foo") $ simpleDefDecl "foo" (A.Array [A.Dimension 7] A.Int) + state1Dynamic :: CSM m => m () + state1Dynamic = defineName (simpleName "foo") $ simpleDefDecl "foo" (A.Array [A.UnknownDimension] A.Int) + state3Static :: CSM m => m () + state3Static = defineName (simpleName "foo") $ simpleDefDecl "foo" (A.Array [A.Dimension 7, A.Dimension 8, A.Dimension 9] A.Int) + state3Dynamic :: CSM m => m () + state3Dynamic = defineName (simpleName "foo") $ simpleDefDecl "foo" (A.Array [A.UnknownDimension, A.Dimension 8, A.UnknownDimension] A.Int) testReplicator :: Test testReplicator = TestList