test_general_expr Subroutine

subroutine test_general_expr()

logs=.true. logs=.false.

Arguments

None

Contents

Source Code


Source Code

subroutine test_general_expr()
   !!logs=.true.
   if(logs)call lala( 'diary(''test_general_expr.log'');')
   call lala( [ character(len=256) :: &
   & 'display(ones(80,1)''*61);display(''general expression tests'');              ', &
   & 'tally=[0];                                                                   ', &
   & 'a=3+4;                                                                       ', &
   & 'if a=7,tally=[tally,0],else,tally=[tally,1];                                 ', &
   & 'if a<7,tally=[tally,2],else,tally=[tally,0];                                 ', &
   & 'if a>7,tally=[tally,3],else,tally=[tally,0];                                 ', &
   & 'if a=>7,tally=[tally,0],else,tally=[tally,4];                                ', &
   & 'if a<=7,tally=[tally,0],else,tally=[tally,5];                                ', &
   & 'if a<>7,tally=[tally,6],else,tally=[tally,0];                                ', &
   & 'if a=7,tally=[tally,0],else,tally=[tally,7];                                 ', &
   & 'if a=7,tally=[tally,0],else,tally=[tally,8];                                 ', &
   & 'b=44-30.0;                                                                   ', &
   & 'if b=14,tally=[tally,0],else,tally=[tally,9];                                ', &
   & 'c=7*8;                                                                       ', &
   & 'if c=56,tally=[tally,0],else,tally=[tally,10];                               ', &
   & 'd=90/30;                                                                     ', &
   & 'if d=3,tally=[tally,0],else,tally=[tally,11];                                ', &
   & 'e=2**8;                                                                      ', &
   & 'if e=256,tally=[tally,0],else,tally=[tally,12];                              ', &
   & '                                                                             ', &
   & 'answers=[   a, b, c,d,  e]                                                   ', &
   & 'expected=[7d0,14,56,3,256]                                                   ', &
   & 'tally=[tally,answers-expected];                                              ', &
   & '[rows,cols]=shape(tally);                                                     ', &
   & 'for i=1:cols, if abs(tally(i)) < 2*eps,tally(i)=0;else,tally(i)=1;           ', &
   & 'if sum(abs(tally)) = 0,display(''general expr  PASSED''),else,display(''general expr  FAILED'');tally', &
   & 'tally'])
   !!logs=.false.
end subroutine test_general_expr