OSDN Git Service

2011-02-19 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / fmt_f0_1.f90
1 ! { dg-do run )
2 ! PR39304 write of  0.0 with F0.3 gives  **
3 ! Test case developed from case provided by reporter.
4  REAL :: x
5  CHARACTER(80) :: str
6  x = 0.0
7  write (str,'(f0.0)') x
8  if (str.ne."0.") call abort
9  write (str,'(f0.1)') x
10  if (str.ne."0.0") call abort
11  write (str,'(f0.2)') x
12  if (str.ne."0.00") call abort
13  write (str,'(f0.3)') x
14  if (str.ne."0.000") call abort
15  write (str,'(f0.4)') x
16  if (str.ne."0.0000") call abort
17  write (str,'(F0.0)') 0.0
18  if (str.ne."0.") call abort
19  write (str,'(F0.0)') 0.001
20  if (str.ne."0.") call abort
21  write (str,'(F0.0)') 0.01
22  if (str.ne."0.") call abort
23  write (str,'(F0.0)') 0.1
24  if (str.ne."0.") call abort
25  write (str,'(F1.0)') -0.0
26  if (str.ne."0") call abort
27  write (str,'(F1.0)') 0.001
28  if (str.ne."*") call abort
29  write (str,'(F1.0)') 0.01
30  if (str.ne."*") call abort
31  write (str,'(F1.0)') 0.1
32  if (str.ne."*") call abort
33  write (str,'(F2.0)') -0.001
34  if (str.ne."*") call abort
35  write (str,'(F2.0)') -0.01
36  if (str.ne."**") call abort
37  write (str,'(F2.0)') -0.1
38  if (str.ne."**") call abort
39  write (str,'(F0.2)') 0.0
40  if (str.ne.".00") call abort
41  write (str,'(F0.0)') -0.0
42  if (str.ne."-0.") call abort
43  write (str,'(F0.1)') -0.0
44  if (str.ne."-.0") call abort
45  write (str,'(F0.2)') -0.0
46  if (str.ne."-.00") call abort
47  write (str,'(F0.3)') -0.0
48  if (str.ne."-.000") call abort
49  END