home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adaptor.zip / adapt.zip / adaptor / examples / dalib / reduct / integer.f < prev    next >
Text File  |  1993-06-25  |  2KB  |  77 lines

  1.       program test
  2.  
  3.       integer k
  4.       parameter (k = 3)
  5.  
  6.       integer a(k)
  7.  
  8.       a(1) = 7
  9.       a(2) = 3
  10.       a(3) = 10
  11.  
  12.       call sumtest (a, k, 20)
  13.       call prodtest (a, k, 210)
  14.       call mintest (a, k, 3)
  15.       call maxtest (a, k, 10)
  16.       call andtest (a, k, 2)
  17.       call ortest (a, k, 15)
  18.       call eortest (a, k, 14)
  19.  
  20.       end
  21.  
  22.       subroutine sumtest (a, N, result)
  23.       integer a(n), s, result
  24.  
  25.       s = sum (a)
  26.       print *, 'SUM: Result is ', s, ' should be ', result
  27.  
  28.       end
  29.  
  30.       subroutine prodtest (a, N, result)
  31.       integer a(n), s, result
  32.  
  33.       s = product (a)
  34.       print *, 'PRODUCT: Result is ', s, ' should be ', result
  35.  
  36.       end
  37.  
  38.       subroutine mintest (a, N, result)
  39.       integer a(n), s, result
  40.  
  41.       s = minval (a)
  42.       print *, 'MINVAL: Result is ', s, ' should be ', result
  43.  
  44.       end
  45.  
  46.       subroutine maxtest (a, N, result)
  47.       integer a(n), s, result
  48.  
  49.       s = maxval (a)
  50.       print *, 'MAXVAL: Result is ', s, ' should be ', result
  51.  
  52.       end
  53.  
  54.       subroutine andtest (a, N, result)
  55.       integer a(n), s, result
  56.  
  57.       s = iall (a)
  58.       print *, 'IALL: Result is ', s, ' should be ', result
  59.  
  60.       end
  61.  
  62.       subroutine ortest (a, N, result)
  63.       integer a(n), s, result
  64.  
  65.       s = iany (a)
  66.       print *, 'IANY: Result is ', s, ' should be ', result
  67.  
  68.       end
  69.  
  70.       subroutine eortest (a, N, result)
  71.       integer a(n), s, result
  72.  
  73.       s = iparity (a)
  74.       print *, 'IPARITY: Result is ', s, ' should be ', result
  75.  
  76.       end
  77.