Debian Codegraph @

gcc/testsuite/ada/acats/tests/cxa/cxaa019.a

raw
1 -- CXAA019.A
2 --
3 -- Grant of Unlimited Rights
4 --
5 -- The Ada Conformity Assessment Authority (ACAA) holds unlimited
6 -- rights in the software and documentation contained herein. Unlimited
7 -- rights are the same as those granted by the U.S. Government for older
8 -- parts of the Ada Conformity Assessment Test Suite, and are defined
9 -- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA
10 -- intends to confer upon all recipients unlimited rights equal to those
11 -- held by the ACAA. These rights include rights to use, duplicate,
12 -- release or disclose the released technical data and computer software
13 -- in whole or in part, in any manner and for any purpose whatsoever, and
14 -- to have or permit others to do so.
15 --
16 -- DISCLAIMER
17 --
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
24 --*
25 --
26 -- OBJECTIVE:
27 -- Check that Standard_Output can be flushed. Check that 'in' parameters of
28 -- types Ada.Text_IO.File_Type and Ada.Streams.Stream_IO.File_Type can be
29 -- flushed. (Defect Report 8652/0051).
30 --
31 -- CHANGE HISTORY:
32 -- 12 FEB 2001 PHL Initial version
33 -- 16 MAR 2001 RLB Readied for release; fixed Not_Applicable check
34 -- to terminate test gracefully.
35 --
36 --!
37 with Ada.Streams.Stream_Io;
38 use Ada.Streams;
39 with Ada.Text_Io;
40 with Ada.Wide_Text_Io;
41 with Report;
42 use Report;
43 procedure CXAA019 is
44
45 procedure Check (File : in Ada.Text_Io.File_Type) is
46 begin
47 Ada.Text_Io.Put_Line
48 (File, " - CXAA019 About to flush a Text_IO file passed " &
49 "as 'in' parameter");
50 Ada.Text_Io.Flush (File);
51 end Check;
52
53 procedure Check (File : in Ada.Wide_Text_Io.File_Type) is
54 begin
55 Ada.Wide_Text_Io.Put_Line
56 (File, " - CXAA019 About to flush a Wide_Text_IO file passed " &
57 "as 'in' parameter");
58 Ada.Wide_Text_Io.Flush (File);
59 end Check;
60
61 procedure Check (File : in Stream_Io.File_Type) is
62 S : Stream_Element_Array (1 .. 10);
63 begin
64 for I in S'Range loop
65 S (I) := Stream_Element (Character'Pos ('A') + I);
66 end loop;
67 Stream_Io.Write (File, S);
68 Comment ("About to flush a Stream_IO file passed as 'in' parameter");
69 Stream_Io.Flush (File);
70 end Check;
71
72
73 begin
74 Test ("CXAA019",
75 "Check that Standard_Output can be flushed; check that " &
76 "'in' Ada.Text_IO.File_Type and Ada.Streams.Stream_IO.File_Type" &
77 "parameters can be flushed");
78
79 Ada.Text_Io.Put_Line (Ada.Text_Io.Standard_Output,
80 " - CXAA019 About to flush Standard_Output");
81 Ada.Text_Io.Flush (Ada.Text_Io.Standard_Output);
82
83 Check (Ada.Text_Io.Current_Output);
84
85 declare
86 TC_OK : Boolean := False;
87 F : Ada.Text_Io.File_Type;
88 begin
89 begin
90 Ada.Text_Io.Create (F, Name => Legal_File_Name (X => 1));
91 TC_OK := True;
92 exception
93 when others =>
94 Not_Applicable ("Unable to create Out mode Text_IO file");
95 end;
96 if TC_OK then
97 Check (F);
98 Ada.Text_Io.Delete (F);
99 end if;
100 end;
101
102 declare
103 TC_OK : Boolean := False;
104 F : Ada.Wide_Text_Io.File_Type;
105 begin
106 begin
107 Ada.Wide_Text_Io.Create (F, Name => Legal_File_Name (X => 2));
108 TC_OK := True;
109 exception
110 when others =>
111 Not_Applicable ("Unable to create Out mode Wide_Text_IO file");
112 end;
113 if TC_OK then
114 Check (F);
115 Ada.Wide_Text_Io.Delete (F);
116 end if;
117 end;
118
119 declare
120 TC_OK : Boolean := False;
121 F : Stream_Io.File_Type;
122 begin
123 begin
124 Stream_Io.Create (F, Name => Legal_File_Name (X => 3));
125 TC_OK := True;
126 exception
127 when others =>
128 Not_Applicable ("Unable to create Out mode Stream_IO file");
129 end;
130 if TC_OK then
131 Check (F);
132 Stream_Io.Delete (F);
133 end if;
134 end;
135
136 Result;
137 end CXAA019;
138