def __init__(self): TestCase.__init__(self, 'ProgUnit Test') self.lProgram = ['''\ SUBROUTINE Test() integer a !cdir directive #ifdef COMPILER_DIRECTIVE #endif !there is an empty line following! if(a.eq.1) call sub() END SUBROUTINE Test ''']
def __init__(self, sTitle="VarUsage Test", sFormat="fixed"): TestCase.__init__(self,sTitle) self.lTests = [ (" a='xxx'" , "write: a" ), (" a(i)=b(i)" , "read: b,i; write: a" ), (" a(i)=b(i)*c(k)" , "read: b,c,i,k; write: a" ), (" a(i+j)=b(i+c(i)*d(i))" , "read: b,c,d,i,j; write: a" ), (" a(i)%p=b(i)" , "read: b,i; write: a" ), (" a(i)=(1,b)" , "read: b,i; write: a" ), (" a=(/(i+k, i=1,3)/)" , "read: i,k; write: a,i" ), (" a(i:)=b(i:n:2)" , "read: b,i,n; write: a" ), (" print *,(a(i),i=1,n)" , "read: a,i,n; write: i" ), (" a=b(i)(1:n)" , "read: b,i,n; write: a" ), (" if(a(i).eq.j) 1,2,3" , "read: a,i,j" ), (" call sub(n,a(:), b(i:n))" , "read: i,n; unknown: a,b,n" ), (" a(i)=g(b(k),c)" , "read: i,k; write: a; unknown: b,c"), (" close(unit=1,status=stat)", "unknown: stat" ), (" read(asynchronous='yes', pos=p, rec=r) a,(b(i),i=1,n)" , "read: i,n; write: a,b,i; unknown: p,r"), (" write(asynchronous='yes', pos=p, rec=r) a,(b(i),i=1,n)" , "read: a,b,i,n; write: i; unknown: p,r"), (""" do i=1, a(j)+k*b, c enddo """ , "read: a,b,c,j,k; write: i" ), (""" do while(a(i).le.b(i)) enddo """ , "read: a,b,i" ), (""" do while(a(i).le.b(i)) a(i)=a(i)+2 enddo """ , "read: a,b,i; write: a" ), (""" if(a(i).eq.b(i+j)) then endif """ , "read: a,b,i,j" ), (""" if(a(i).eq.b(i+j)) then c(j)=b(i+j) else d(j)=g(e(i)) endif """ , "read: a,b,i,j; write: c,d; unknown: e"), ]
def __init__(self, sTitle="Fixed Format Scanner", sFormat="fixed"): TestCase.__init__(self,sTitle) self.sFormat = sFormat self.lTests = [ (" %b", [ ('tok_SPECIAL','%'), ('tok_IDENTIFIER',"b"), ('tok_SEPARATOR',""), None] ), (" b=*2)", [ ('tok_IDENTIFIER','b'), ('tok_SPECIAL',"="), ('tok_OPERATOR',"*"), ('tok_NUMBER',"2"), ('tok_SPECIAL',")"), ('tok_SEPARATOR',""), None] ), (" 2_1", [ ('tok_NUMBER','2'), ('tok_SPECIAL',"_"), ('tok_NUMBER',"1"), ('tok_SEPARATOR',""), None] ), (" 2_KIND", [ ('tok_NUMBER','2'), ('tok_SPECIAL',"_"), ('tok_IDENTIFIER',"KIND"), ('tok_SEPARATOR',""), None] ), (" a;b\n c;d", [ ('tok_IDENTIFIER','a'), ('tok_SEPARATOR', ';'), ('tok_IDENTIFIER','b'), ('tok_SEPARATOR', '' ), ('tok_IDENTIFIER','c'), ('tok_SEPARATOR', ';'), ('tok_IDENTIFIER','d'), ('tok_SEPARATOR', '' ) ] ), (" integer :: a", [ ('tok_IDENTIFIER',"integer"), ('tok_SPECIAL', ":"), ('tok_SPECIAL', ":"), ('tok_IDENTIFIER',"a") ]), (" common //a", [ ('tok_IDENTIFIER',"common"), ('tok_OPERATOR', "//"), ('tok_IDENTIFIER',"a") ]), (" a.eq.12.and.b.eq.13", [ ('tok_IDENTIFIER',"a"), ('tok_OPERATOR',".eq."), ('tok_NUMBER',"12"), ('tok_OPERATOR',".and."), ('tok_IDENTIFIER',"b"), ('tok_OPERATOR',".eq."), ('tok_NUMBER',"13") ] ), (" a.eq.0. .and.b.eq.13.",[ ('tok_IDENTIFIER',"a"), ('tok_OPERATOR',".eq."), ('tok_NUMBER',"0."), ('tok_OPERATOR',".and."), ('tok_IDENTIFIER',"b"), ('tok_OPERATOR',".eq."), ('tok_NUMBER',"13.") ] ), (" 0. and. b", [ ('tok_NUMBER','0'), ('tok_OPERATOR','. and.'), ('tok_IDENTIFIER','b')] ), (" a**12", [ ('tok_IDENTIFIER',"a"), ('tok_OPERATOR',"**"), ('tok_NUMBER',"12")] ), (" i,i=1,3", [ ('tok_IDENTIFIER',"i"), ('tok_SPECIAL',","), ('tok_IDENTIFIER',"i"), ('tok_SPECIAL',"="), ('tok_NUMBER',"1"), ('tok_SPECIAL',","), ('tok_NUMBER',"3") ] ), (" a=\"TeSt\"", [ ('tok_IDENTIFIER',"a"), ('tok_SPECIAL',"="), ('tok_QUOTE','"TeSt"')] ), (" a==b", [ ('tok_IDENTIFIER',"a"), ('tok_OPERATOR',"=="), ('tok_IDENTIFIER',"b")] ), ("* Comment\n a", [ ('tok_COMMENTLINE',"* Comment"), ('tok_SEPARATOR',''), ('tok_IDENTIFIER',"a") ] ), ("! Comment\n! Com2\n a",[ ('tok_COMMENTLINE',"! Comment"), ('tok_SEPARATOR',''), ('tok_COMMENTLINE',"! Com2") , ('tok_SEPARATOR',''), ('tok_IDENTIFIER',"a") ] ), ("C Comment\n a", [ ('tok_COMMENTLINE',"C Comment"), ('tok_SEPARATOR',''), ('tok_IDENTIFIER',"a") ] ), ("12345 id", [ ('tok_LABEL',"12345"), ('tok_IDENTIFIER','id') ] ), ("1 id ", [ ('tok_LABEL',"1"), ('tok_IDENTIFIER','id') ] ), ("12345 BEGIN2345678901234567890123456789012345678901234567890123456789012COMMENT", [ ('tok_LABEL',"12345"), ('tok_IDENTIFIER','BEGIN2345678901234567890123456789012345678901234567890123456789012[COMMENT]') ] ), (" &cont", [ ('tok_IDENTIFIER','[&]cont') ] ), (" & cont", [ ('tok_IDENTIFIER','[&]cont') ] ), (" s1; s2", [ ('tok_IDENTIFIER','s1'), ('tok_SEPARATOR',';'), ('tok_IDENTIFIER','s2'), ('tok_SEPARATOR','') ]), ("""\ s1 & s2""", [ ('tok_IDENTIFIER','s1'), ('tok_IDENTIFIER','[&]s2'), ('tok_SEPARATOR','') ]), ("""\ s1 !comment & s2""", [ ('tok_IDENTIFIER','s1[!comment]'), ('tok_IDENTIFIER','[&]s2'), ('tok_SEPARATOR','') ]), ("""\ s1 !comment !CommentLine & s2""", [ ('tok_IDENTIFIER','s1[!comment]'), ('tok_IDENTIFIER','[!CommentLine, &]s2'), ('tok_SEPARATOR','') ]), ("""\ s1 !comment !CommentLine & s2""", [ ('tok_IDENTIFIER','s1[!comment]'), ('tok_IDENTIFIER','[, !CommentLine, &]s2'), ('tok_SEPARATOR','') ]), ("""\ 's1 & still string'""", [ ('tok_QUOTE_START','\'s1'), ('tok_QUOTE_END','[&] still string\'')]), ('''\ "s1 & still string"''', [ ('tok_QUOTE_START','"s1'), ('tok_QUOTE_END','[&] still string"')]), ("""\ 's1'' & still string'""", [ ('tok_QUOTE_START',"'s1''"), ('tok_QUOTE_END','[&] still string\'')]), ('''\ "s1"" & still string"''', [ ('tok_QUOTE_START','"s1""'), ('tok_QUOTE_END','[&] still string"')]), ("""\ 's1 & more string & still string'""", [ ('tok_QUOTE_START','\'s1'), ('tok_QUOTE_MIDDLE','[&] more string'), ('tok_QUOTE_END','[&] still string\'')]), ('''\ "s1 & more string & still string"''', [ ('tok_QUOTE_START','"s1'), ('tok_QUOTE_MIDDLE','[&] more string'), ('tok_QUOTE_END','[&] still string"')]), ("""\ 's1 & more string'' & still string'""", [ ('tok_QUOTE_START',"'s1"), ('tok_QUOTE_MIDDLE',"[&] more string''"), ('tok_QUOTE_END','[&] still string\'')]), ('''\ "s1 & more string"" & still string")''', [ ('tok_QUOTE_START','"s1'), ('tok_QUOTE_MIDDLE','[&] more string""'), ('tok_QUOTE_END','[&] still string"'), ('tok_SPECIAL',')')]), ('''\ s="test & still string" id ''', [ ('tok_IDENTIFIER','s'), ('tok_SPECIAL','='), ('tok_QUOTE_START','"test'), ('tok_QUOTE_END','[&] still string"'), ('tok_SEPARATOR',''), ('tok_IDENTIFIER','id')]), ('''\ s="test & more string"" & still string" id''', [ ('tok_IDENTIFIER','s'), ('tok_SPECIAL','='), ('tok_QUOTE_START','"test'), ('tok_QUOTE_MIDDLE','[&] more string""'), ('tok_QUOTE_END','[&] still string"'), ('tok_SEPARATOR',''), ('tok_IDENTIFIER','id')]), ('''\ !cdir nodep''', [ ('tok_DIRECTIVE','!cdir nodep') ]), ('''\ *cdir nodep''', [ ('tok_DIRECTIVE','*cdir nodep') ]), ('''\ end c comment''', [ ('tok_IDENTIFIER','end'), ('tok_SEPARATOR',''), ('tok_COMMENTLINE','c comment'), ('tok_SEPARATOR','') ]), ]
def __init__(self, sName, l): TestCase.__init__(self, sName) self.lTests = l