OSDN Git Service

2011-09-26 Janus Weil <janus@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 ! PR47567 Small absolute values.
4 ! Test case developed from case provided by reporter.
5  REAL :: x
6  CHARACTER(80) :: str
7  x = 0.0
8  write (str,'(f0.0)') x
9  if (str.ne."0.") call abort
10  write (str,'(f0.1)') x
11  if (str.ne.".0") call abort
12  write (str,'(f0.2)') x
13  if (str.ne.".00") call abort
14  write (str,'(f0.3)') x
15  if (str.ne.".000") call abort
16  write (str,'(f0.4)') x
17  if (str.ne.".0000") call abort
18  write (str,'(F0.0)') 0.0
19  if (str.ne."0.") call abort
20  write (str,'(F0.0)') 0.001
21  if (str.ne."0.") call abort
22  write (str,'(F0.0)') 0.01
23  if (str.ne."0.") call abort
24  write (str,'(F0.0)') 0.1
25  if (str.ne."0.") call abort
26  write (str,'(F1.0)') -0.0
27  if (str.ne."*") call abort
28  write (str,'(F1.0)') 0.001
29  if (str.ne."*") call abort
30  write (str,'(F1.0)') 0.01
31  if (str.ne."*") call abort
32  write (str,'(F1.0)') 0.1
33  if (str.ne."*") call abort
34  write (str,'(F2.0)') -0.001
35  if (str.ne."**") call abort
36  write (str,'(F2.0)') -0.01
37  if (str.ne."**") call abort
38  write (str,'(F2.0)') -0.1
39  if (str.ne."**") call abort
40  write (str,'(F0.2)') 0.0
41  if (str.ne.".00") call abort
42  write (str,'(F0.0)') -0.0
43  if (str.ne."-0.") call abort
44  write (str,'(F0.1)') -0.0
45  if (str.ne."-.0") call abort
46  write (str,'(F0.2)') -0.0
47  if (str.ne."-.00") call abort
48  write (str,'(F0.3)') -0.0
49  if (str.ne."-.000") call abort
50  write (str,'(F3.0)') -0.0
51  if (str.ne."-0.") call abort
52  write (str,'(F2.0)') -0.0
53  if (str.ne."**") call abort
54  write (str,'(F1.0)') -0.0
55  if (str.ne."*") call abort
56  write (str,'(F0.1)') -0.0
57  if (str.ne."-.0") call abort
58  write (str,'(F3.1)') -0.0
59  if (str.ne."-.0") call abort
60  write (str,'(F2.1)') -0.0
61  if (str.ne."**") call abort
62  write (str,'(F1.1)') -0.0
63  if (str.ne."*") call abort
64  END