5 ! Version for scalar coarrays
7 ! this_image(coarray) run test,
8 ! expecially for num_images > 1
10 ! Tested are values up to num_images == 8,
11 ! higher values are OK, but not tested for
14 integer :: a
[2:2, 3:4, 7:*]
17 if (this_image(A
, dim
=1) /= 2) call abort()
19 if (this_image(A
, dim
=i
) /= 2) call abort()
21 select
case (this_image())
23 if (this_image(A
, dim
=2) /= 3) call abort()
24 if (this_image(A
, dim
=3) /= 7) call abort()
26 if (this_image(A
, dim
=i
) /= 3) call abort()
28 if (this_image(A
, dim
=i
) /= 7) call abort()
29 if (any (this_image(A
) /= [2,3,7])) call abort()
32 if (this_image(A
, dim
=2) /= 4) call abort()
33 if (this_image(A
, dim
=3) /= 7) call abort()
35 if (this_image(A
, dim
=i
) /= 4) call abort()
37 if (this_image(A
, dim
=i
) /= 7) call abort()
38 if (any (this_image(A
) /= [2,4,7])) call abort()
41 if (this_image(A
, dim
=2) /= 3) call abort()
42 if (this_image(A
, dim
=3) /= 8) call abort()
44 if (this_image(A
, dim
=i
) /= 3) call abort()
46 if (this_image(A
, dim
=i
) /= 8) call abort()
47 if (any (this_image(A
) /= [2,3,8])) call abort()
50 if (this_image(A
, dim
=2) /= 4) call abort()
51 if (this_image(A
, dim
=3) /= 8) call abort()
53 if (this_image(A
, dim
=i
) /= 4) call abort()
55 if (this_image(A
, dim
=i
) /= 8) call abort()
56 if (any (this_image(A
) /= [2,4,8])) call abort()
59 if (this_image(A
, dim
=2) /= 3) call abort()
60 if (this_image(A
, dim
=3) /= 9) call abort()
62 if (this_image(A
, dim
=i
) /= 3) call abort()
64 if (this_image(A
, dim
=i
) /= 9) call abort()
65 if (any (this_image(A
) /= [2,3,9])) call abort()
68 if (this_image(A
, dim
=2) /= 4) call abort()
69 if (this_image(A
, dim
=3) /= 9) call abort()
71 if (this_image(A
, dim
=i
) /= 4) call abort()
73 if (this_image(A
, dim
=i
) /= 9) call abort()
74 if (any (this_image(A
) /= [2,4,9])) call abort()
77 if (this_image(A
, dim
=2) /= 3) call abort()
78 if (this_image(A
, dim
=3) /= 10) call abort()
80 if (this_image(A
, dim
=i
) /= 3) call abort()
82 if (this_image(A
, dim
=i
) /= 10) call abort()
83 if (any (this_image(A
) /= [2,3,10])) call abort()
86 if (this_image(A
, dim
=2) /= 4) call abort()
87 if (this_image(A
, dim
=3) /= 10) call abort()
89 if (this_image(A
, dim
=i
) /= 4) call abort()
91 if (this_image(A
, dim
=i
) /= 10) call abort()
92 if (any (this_image(A
) /= [2,4,10])) call abort()
97 subroutine test_image_index
99 integer :: index1
, index2
, index3
102 integer, save :: d(2)[-1:3, *]
103 integer, save :: e(2)[-1:-1, 3:*]
105 one
= num_images() == 1
107 index1
= image_index(d
, [-1, 1] )
108 index2
= image_index(d
, [0, 1] )
110 if (one
.and
. (index1
/= 1 .or
. index2
/= 0)) &
112 if (.not
. one
.and
. (index1
/= 1 .or
. index2
/= 2)) &
115 index1
= image_index(e
, [-1, 3] )
116 index2
= image_index(e
, [-1, 4] )
118 if (one
.and
. (index1
/= 1 .or
. index2
/= 0)) &
120 if (.not
. one
.and
. (index1
/= 1 .or
. index2
/= 2)) &
123 end subroutine test_image_index