1 ! Test (non-scalar) pack for character arrays.
5 integer, parameter :: n1
= 3, n2
= 4, nv
= 10, slen
= 9
6 character (len
= slen
), dimension (n1
, n2
) :: a
7 character (len
= slen
), dimension (nv
) :: vector
8 logical, dimension (n1
, n2
) :: mask
13 a (i1
, i2
) = 'abc'(i1
:i1
) // 'defg'(i2
:i2
) // 'cantrip'
16 mask (1, :) = (/ .true
., .false
., .true
., .true
. /)
17 mask (2, :) = (/ .true
., .false
., .false
., .false
. /)
18 mask (3, :) = (/ .false
., .true
., .true
., .true
. /)
21 vector (i
) = 'crespo' // '0123456789'(i
:i
)
24 call test1 (pack (a
, mask
))
25 call test2 (pack (a
, mask
, vector
))
28 character (len
= slen
), dimension (:) :: b
33 if (mask (i1
, i2
)) then
35 if (b (i
) .ne
. a (i1
, i2
)) call abort
39 if (size (b
, 1) .ne
. i
) call abort
43 character (len
= slen
), dimension (:) :: b
45 if (size (b
, 1) .ne
. nv
) call abort
49 if (mask (i1
, i2
)) then
51 if (b (i
) .ne
. a (i1
, i2
)) call abort
56 if (b (i
) .ne
. vector (i
)) call abort