1! { dg-do run }
2! { dg-options "-std=legacy" }
3!
4! Test various uses of BZ and BN format specifiers.
5! Portions inspired by NIST F77 testsuite FM711.f
6! Contributed by jvdelisle@verizon.net
7program test_bn
8
9integer I1(2,2), I2(2,2,2)
10real A1(5)
11real(kind=8) A2(0:3)
12character*80 :: IDATA1="111 2 2 3 3. 3E-1  44 5 5 6 . 67 . 78 8. 8E-1"
13character*80 :: IDATA2="2345 1 34512 45123 51234 2345 1 34512 45123 5"
14character*80 :: IDATA3="-8.0D0  1.0D-4  0.50D0  0.250D0"
15character*80 :: ODATA=""
16character*80 :: CORRECT1=" 1110 2020 .30303E-07   44   55   6.6 70.07 .888E+01"
17character*80 :: CORRECT2="23450 10345. 12.45 1235 1234 2345  1345. 12.45 1235"
18character*80 :: CORRECT3="   -0.8000000000D+01    0.1000000000D-03&
19                         &    0.5000000000D+00    0.2500000000D+00"
20READ(IDATA1, 10) I1(1,2), IVI, A1(3), JVI, KVI, A1(2), AVS, A1(1)
2110 FORMAT (BZ,(2I4, E10.1, BN, 2I4, F5.2, BZ, F5.2, BN, E10.1))
22
23WRITE(ODATA, 20) I1(1,2), IVI, A1(3), JVI, KVI, A1(2), AVS, A1(1)
2420 FORMAT (2I5, 1X, E10.5, BN, 2I5, F6.1, BZ, F6.2, BN, 1X, E8.3, I5)
25
26if (ODATA /= CORRECT1) STOP 1
27ODATA=""
28
29READ(IDATA2, 30) I2(1,2,1), A1(3), AVS, IVI, I1(1,1), JVI, BVS, A1(2), I2(1,1,1)
3030 FORMAT (BZ, (I5, F5.0, BN, F5.2, 2I5, I5, F5.0, BN, F5.2, I5))
31
32WRITE(ODATA, 40) I2(1,2,1), A1(3), AVS, IVI, I1(1,1), JVI, BVS, A1(2), I2(1,1,1)
3340 FORMAT (I5, F7.0, BZ, 1X, F5.2, 2(1X,I4),I5, F7.0, BZ, 1X, F5.2, 1X, I4)
34
35if (ODATA /= CORRECT2) STOP 2
36ODATA=""
37
38READ(IDATA3, 50) A2
3950 FORMAT (4D8.0)
40
41WRITE(ODATA,60) A2
4260 FORMAT (4D20.10)
43
44if (ODATA /= CORRECT3) STOP 3
45
46end program test_bn
47