OSDN Git Service

2005-06-28 Thomas Koenig <Thomas.Koenig@online.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.fortran-torture / execute / intrinsic_minmax.f90
1 ! Program to test min and max intrinsics
2 program intrinsic_minmax
3    implicit none
4    integer i, j, k, m
5    real r, s, t, u
6
7    i = 1
8    j = -2
9    k = 3
10    m = 4
11    if (min (i, k) .ne. 1) call abort
12    if (min (i, j, k, m) .ne. -2) call abort
13    if (max (i, k) .ne. 3) call abort
14    if (max (i, j, k, m) .ne. 4) call abort
15    if (max (i+1, j) .ne. 2) call abort
16
17    r = 1
18    s = -2
19    t = 3
20    u = 4
21    if (min (r, t) .ne. 1) call abort
22    if (min (r, s, t, u) .ne. -2) call abort
23    if (max (r, t) .ne. 3) call abort
24    if (max (r, s, t, u) .ne. 4) call abort
25
26    if (max (4d0, r) .ne. 4d0) call abort
27    if (amax0 (i, j) .ne. 1.0) call abort
28    if (min1 (r, s) .ne. -2) call abort
29
30    ! Test simplify.
31    if (min (1, -2, 3, 4) .ne. -2) call abort
32    if (max (1, -2, 3, 4) .ne. 4) call abort
33    if (amax0 (1, -2) .ne. 1.0) call abort
34    if (min1 (1., -2.) .ne. -2) call abort
35
36 end program
37