From 4c20f99ac33eeea8f7537bae6b1e9b08e73ef568 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 28 Nov 2007 14:30:56 +0000 Subject: [PATCH] Changed some tests to use the new mSeq matching helpers --- frontends/RainPassesTest.hs | 25 +++++++++++++------------ frontends/RainTypesTest.hs | 5 +++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/frontends/RainPassesTest.hs b/frontends/RainPassesTest.hs index 6bf236f..51c31b4 100644 --- a/frontends/RainPassesTest.hs +++ b/frontends/RainPassesTest.hs @@ -41,6 +41,7 @@ import Errors import Pattern import RainPasses import RainTypes +import TagAST import TestUtil import TreeUtil @@ -66,19 +67,19 @@ testEachPass0 = TestCase $ testPassWithItemsStateCheck "testEachPass0" exp (tran (A.ForEach m (simpleName "c") (makeLiteralStringRain "1")) (A.OnlyP m (makeAssign (variable "c") (intLiteral 7))) ) - exp = tag2 A.Seq DontCare - (tag3 A.Spec DontCare - (tag3 A.Specification DontCare listVarName - (tag4 A.IsExpr DontCare A.ValAbbrev (A.List A.Byte) (makeLiteralStringRain "1")) + exp = mSeq + (mSpec + (mSpecification listVarName + (mIsExpr A.ValAbbrev (A.List A.Byte) (makeLiteralStringRain "1")) ) - (tag3 A.Rep DontCare - (tag4 A.For DontCare indexVar (intLiteral 0) (tag2 A.SizeVariable DontCare listVar)) - (tag3 A.Spec DontCare - (tag3 A.Specification DontCare (simpleName "c") + (mRep + (mFor indexVar (intLiteral 0) (tag2 A.SizeVariable DontCare listVar)) + (mSpec + (mSpecification (simpleName "c") --ValAbbrev because we are abbreviating an expression: - (tag4 A.Is DontCare A.ValAbbrev A.Byte - (tag3 A.SubscriptedVariable DontCare - (tag2 A.Subscript DontCare (tag2 A.ExprVariable DontCare (tag2 A.Variable DontCare indexVar))) + (mIs A.ValAbbrev A.Byte + (mSubscriptedVariable + (mSubscript (mExprVariable (mVariable indexVar))) listVar ) ) @@ -89,7 +90,7 @@ testEachPass0 = TestCase $ testPassWithItemsStateCheck "testEachPass0" exp (tran ) indexVar = Named "indexVar" DontCare listVarName = Named "listVarName" DontCare - listVar = tag2 A.Variable DontCare listVarName + listVar = mVariable listVarName --Need to also check the names were recorded properly in CompState, so that later passes will work properly: check :: (Items,CompState) -> Assertion diff --git a/frontends/RainTypesTest.hs b/frontends/RainTypesTest.hs index b37e048..08e9204 100644 --- a/frontends/RainTypesTest.hs +++ b/frontends/RainTypesTest.hs @@ -30,6 +30,7 @@ import Errors import Pass import Pattern import RainTypes +import TagAST import TestUtil import TreeUtil import Types @@ -286,11 +287,11 @@ checkExpressionTest = TestList passWhileIf n exp src = TestList [ TestCase $ testPass ("checkExpressionTest/if " ++ show n) - (tag2 A.If DontCare $ tag2 A.OnlyC DontCare $ tag3 A.Choice DontCare (buildExprPattern exp) (tag1 A.Skip DontCare)) + (mIf $ tag2 A.OnlyC DontCare $ tag3 A.Choice DontCare (buildExprPattern exp) (tag1 A.Skip DontCare)) (checkConditionalTypes $ A.If m $ A.OnlyC m $ A.Choice m (buildExpr src) (A.Skip m)) state ,TestCase $ testPass ("checkExpressionTest/while " ++ show n) - (tag3 A.While DontCare (buildExprPattern exp) (tag1 A.Skip DontCare)) + (mWhile (buildExprPattern exp) (tag1 A.Skip DontCare)) (checkConditionalTypes $ A.While m (buildExpr src) (A.Skip m)) state ]