annotate gcc/testsuite/ada/acats/tests/cxf/cxf3a08.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- CXF3A08.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that the version of Ada.Text_IO.Editing.Put with an out
kono
parents:
diff changeset
28 -- String parameter propagates Layout_Error if the edited output string
kono
parents:
diff changeset
29 -- result of Put exceeds the length of the out String parameter.
kono
parents:
diff changeset
30 --
kono
parents:
diff changeset
31 -- TEST DESCRIPTION:
kono
parents:
diff changeset
32 -- This test is structured using tables of data, consisting of
kono
parents:
diff changeset
33 -- numerical values, picture strings, and expected image
kono
parents:
diff changeset
34 -- result strings. These data tables are found in package FXF3A00.
kono
parents:
diff changeset
35 --
kono
parents:
diff changeset
36 -- This test examines the case of the out string parameter to Procedure
kono
parents:
diff changeset
37 -- Put being insufficiently long to hold the entire edited output
kono
parents:
diff changeset
38 -- string result of the procedure. In this case, Layout_Error is to be
kono
parents:
diff changeset
39 -- raised. Test failure results if Layout_Error is not raised, or if an
kono
parents:
diff changeset
40 -- exception other than Layout_Error is raised.
kono
parents:
diff changeset
41 --
kono
parents:
diff changeset
42 -- A number of data combinations are examined, using instantiations
kono
parents:
diff changeset
43 -- of Package Decimal_Output with different decimal data types and
kono
parents:
diff changeset
44 -- both default and non-default parameters as generic actual parameters.
kono
parents:
diff changeset
45 -- In addition, calls to Procedure Put are performed using default
kono
parents:
diff changeset
46 -- parameters, non-default parameters, and non-default parameters that
kono
parents:
diff changeset
47 -- override the generic actual parameters provided at the time of
kono
parents:
diff changeset
48 -- instantiation of Decimal_Output.
kono
parents:
diff changeset
49 --
kono
parents:
diff changeset
50 -- TEST FILES:
kono
parents:
diff changeset
51 -- The following files comprise this test:
kono
parents:
diff changeset
52 --
kono
parents:
diff changeset
53 -- FXF3A00.A (foundation code)
kono
parents:
diff changeset
54 -- => CXF3A08.A
kono
parents:
diff changeset
55 --
kono
parents:
diff changeset
56 --
kono
parents:
diff changeset
57 -- CHANGE HISTORY:
kono
parents:
diff changeset
58 -- 31 JAN 95 SAIC Initial prerelease version.
kono
parents:
diff changeset
59 --
kono
parents:
diff changeset
60 --!
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 with FXF3A00;
kono
parents:
diff changeset
63 with Ada.Text_IO.Editing;
kono
parents:
diff changeset
64 with Report;
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 procedure CXF3A08 is
kono
parents:
diff changeset
67 begin
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 Report.Test ("CXF3A08", "Check that the version of " &
kono
parents:
diff changeset
70 "Ada.Text_IO.Editing.Put with an out " &
kono
parents:
diff changeset
71 "String parameter propagates Layout_Error " &
kono
parents:
diff changeset
72 "if the output string exceeds the length " &
kono
parents:
diff changeset
73 "of the out String parameter");
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 Test_Block:
kono
parents:
diff changeset
76 declare
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 use Ada.Text_IO;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 -- Instantiate the Decimal_Output generic package for two
kono
parents:
diff changeset
81 -- different decimal data types.
kono
parents:
diff changeset
82 -- Uses decimal type with delta 0.01 and
kono
parents:
diff changeset
83 package Pack_2DP is -- non-default generic actual parameters.
kono
parents:
diff changeset
84 new Editing.Decimal_Output(Num => FXF3A00.Decimal_Type_2DP,
kono
parents:
diff changeset
85 Default_Currency => "$",
kono
parents:
diff changeset
86 Default_Fill => '*',
kono
parents:
diff changeset
87 Default_Separator => ',',
kono
parents:
diff changeset
88 Default_Radix_Mark => '.');
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 package Pack_NDP is -- Uses decimal type with delta 1.0.
kono
parents:
diff changeset
91 new Editing.Decimal_Output(FXF3A00.Decimal_Type_NDP);
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 TC_Picture : Editing.Picture;
kono
parents:
diff changeset
94 TC_Start_Loop : Integer := 0;
kono
parents:
diff changeset
95 TC_End_Loop : Integer := 0;
kono
parents:
diff changeset
96 TC_Offset : Integer := 0;
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 TC_Short_String : String(1..4); -- Shorter than the shortest edited
kono
parents:
diff changeset
99 -- output string result.
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 begin
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 -- Examine cases where the out string parameter is shorter than
kono
parents:
diff changeset
104 -- the length of the edited output result. Use the instantiation of
kono
parents:
diff changeset
105 -- Decimal_Output specific to data with two decimal places.
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 TC_Start_Loop := 1;
kono
parents:
diff changeset
108 TC_End_Loop := FXF3A00.Number_of_2DP_Items - -- 10
kono
parents:
diff changeset
109 FXF3A00.Number_Of_Foreign_Strings;
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 for i in TC_Start_Loop..TC_End_Loop loop -- 1..10
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 -- Create the picture object from the picture string.
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 TC_Picture :=
kono
parents:
diff changeset
116 Editing.To_Picture(Pic_String => FXF3A00.Valid_Strings(i).all,
kono
parents:
diff changeset
117 Blank_When_Zero => False);
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 -- The out parameter string provided in the call to Put is
kono
parents:
diff changeset
120 -- shorter than the edited output result of the procedure.
kono
parents:
diff changeset
121 -- This will result in a Layout_Error being raised and handled.
kono
parents:
diff changeset
122 -- Test failure results from no exception being raised, or from
kono
parents:
diff changeset
123 -- the wrong exception being raised.
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 begin
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 -- Use the instantiation of Decimal_Output specific to decimal
kono
parents:
diff changeset
128 -- data with two decimal places, as well as non-default
kono
parents:
diff changeset
129 -- parameters and named parameter association.
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 Pack_2DP.Put(To => TC_Short_String,
kono
parents:
diff changeset
132 Item => FXF3A00.Data_With_2DP(i),
kono
parents:
diff changeset
133 Pic => TC_Picture,
kono
parents:
diff changeset
134 Currency => "$",
kono
parents:
diff changeset
135 Fill => '*',
kono
parents:
diff changeset
136 Separator => ',',
kono
parents:
diff changeset
137 Radix_Mark => '.');
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 -- Test failure if exception not raised.
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 Report.Failed
kono
parents:
diff changeset
142 ("Layout_Error not raised, decimal data with two decimal " &
kono
parents:
diff changeset
143 "places, loop #" & Integer'Image(i));
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 exception
kono
parents:
diff changeset
146 when Layout_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
147 when others =>
kono
parents:
diff changeset
148 Report.Failed
kono
parents:
diff changeset
149 ("Incorrect exception raised, Layout_Error expected, " &
kono
parents:
diff changeset
150 "decimal data with two decimal places, loop #" &
kono
parents:
diff changeset
151 Integer'Image(i));
kono
parents:
diff changeset
152 end;
kono
parents:
diff changeset
153 end loop;
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 -- Perform similar evaluations as above, but use the instantiation
kono
parents:
diff changeset
157 -- of Decimal_Output specific to decimal data with no decimal places.
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 TC_Start_Loop := TC_End_Loop + 1; -- 11
kono
parents:
diff changeset
160 TC_End_Loop := TC_Start_Loop + -- 22
kono
parents:
diff changeset
161 FXF3A00.Number_of_NDP_Items - 1;
kono
parents:
diff changeset
162 TC_Offset := FXF3A00.Number_of_Foreign_Strings; -- 10
kono
parents:
diff changeset
163 -- This offset is required due to the arrangement of data within the
kono
parents:
diff changeset
164 -- tables found in FXF3A00.
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 for i in TC_Start_Loop..TC_End_Loop loop -- 11..22
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 -- Create the picture object from the picture string.
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 TC_Picture := Editing.To_Picture(FXF3A00.Valid_Strings(i).all);
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 begin
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 -- Use the instantiation of Decimal_Output specific to decimal
kono
parents:
diff changeset
175 -- data with no decimal places, as well as default parameters
kono
parents:
diff changeset
176 -- and positional parameter association.
kono
parents:
diff changeset
177
kono
parents:
diff changeset
178 Pack_NDP.Put(TC_Short_String,
kono
parents:
diff changeset
179 FXF3A00.Data_With_NDP(i-TC_Offset),
kono
parents:
diff changeset
180 TC_Picture);
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 -- Test failure if exception not raised.
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 Report.Failed
kono
parents:
diff changeset
185 ("Layout_Error not raised, decimal data with no decimal " &
kono
parents:
diff changeset
186 "places, loop #" & Integer'Image(i));
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 exception
kono
parents:
diff changeset
189 when Layout_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
190 when others =>
kono
parents:
diff changeset
191 Report.Failed
kono
parents:
diff changeset
192 ("Incorrect exception raised, Layout_Error expected, " &
kono
parents:
diff changeset
193 "decimal data with no decimal places, loop #" &
kono
parents:
diff changeset
194 Integer'Image(i));
kono
parents:
diff changeset
195 end;
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197 end loop;
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 -- Check that Layout_Error is raised by Put resulting from an
kono
parents:
diff changeset
201 -- instantiation of Decimal_Output specific to foreign currency
kono
parents:
diff changeset
202 -- representations.
kono
parents:
diff changeset
203 -- Note: Both of the following evaluation sets use decimal data with
kono
parents:
diff changeset
204 -- two decimal places.
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 declare
kono
parents:
diff changeset
207
kono
parents:
diff changeset
208 package Pack_FF is
kono
parents:
diff changeset
209 new Editing.Decimal_Output(Num => FXF3A00.Decimal_Type_2DP,
kono
parents:
diff changeset
210 Default_Currency => "FF",
kono
parents:
diff changeset
211 Default_Fill => '*',
kono
parents:
diff changeset
212 Default_Separator => '.',
kono
parents:
diff changeset
213 Default_Radix_Mark => ',');
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 begin
kono
parents:
diff changeset
216
kono
parents:
diff changeset
217 TC_Offset := FXF3A00.Number_Of_2DP_Items - -- 10
kono
parents:
diff changeset
218 FXF3A00.Number_Of_Foreign_Strings;
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220 for i in 1..FXF3A00.Number_Of_FF_Strings loop -- 1..4
kono
parents:
diff changeset
221 begin
kono
parents:
diff changeset
222
kono
parents:
diff changeset
223 -- Create the picture object from the picture string.
kono
parents:
diff changeset
224 TC_Picture :=
kono
parents:
diff changeset
225 Editing.To_Picture(FXF3A00.Foreign_Strings(i).all);
kono
parents:
diff changeset
226
kono
parents:
diff changeset
227 Pack_FF.Put(To => TC_Short_String,
kono
parents:
diff changeset
228 Item => FXF3A00.Data_With_2DP(i+TC_Offset),
kono
parents:
diff changeset
229 Pic => TC_Picture);
kono
parents:
diff changeset
230
kono
parents:
diff changeset
231 Report.Failed("Layout_Error was not raised by Put from " &
kono
parents:
diff changeset
232 "an instantiation of Decimal_Output using " &
kono
parents:
diff changeset
233 "non-default parameters specific to FF " &
kono
parents:
diff changeset
234 "currency, loop #" & Integer'Image(i));
kono
parents:
diff changeset
235
kono
parents:
diff changeset
236 exception
kono
parents:
diff changeset
237 when Layout_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
238 when others =>
kono
parents:
diff changeset
239 Report.Failed("Incorrect exception raised by Put from " &
kono
parents:
diff changeset
240 "an instantiation of Decimal_Output using " &
kono
parents:
diff changeset
241 "non-default parameters specific to FF " &
kono
parents:
diff changeset
242 "currency, loop #" & Integer'Image(i));
kono
parents:
diff changeset
243 end;
kono
parents:
diff changeset
244 end loop;
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246
kono
parents:
diff changeset
247 -- These evaluations use a version of Put resulting from a
kono
parents:
diff changeset
248 -- non-default instantiation of Decimal_Output, but which has
kono
parents:
diff changeset
249 -- specific foreign currency parameters provided in the call that
kono
parents:
diff changeset
250 -- override the generic actual parameters provided at instantiation.
kono
parents:
diff changeset
251
kono
parents:
diff changeset
252 TC_Offset := TC_Offset + FXF3A00.Number_Of_FF_Strings; -- 14
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 for i in 1..FXF3A00.Number_Of_DM_Strings loop -- 1..5
kono
parents:
diff changeset
255 begin
kono
parents:
diff changeset
256 TC_Picture :=
kono
parents:
diff changeset
257 Editing.To_Picture(FXF3A00.Foreign_Strings
kono
parents:
diff changeset
258 (i+FXF3A00.Number_Of_FF_Strings).all);
kono
parents:
diff changeset
259
kono
parents:
diff changeset
260 Pack_2DP.Put(To => TC_Short_String,
kono
parents:
diff changeset
261 Item => FXF3A00.Data_With_2DP(i+TC_Offset),
kono
parents:
diff changeset
262 Pic => TC_Picture,
kono
parents:
diff changeset
263 Currency => "DM",
kono
parents:
diff changeset
264 Fill => '*',
kono
parents:
diff changeset
265 Separator => ',',
kono
parents:
diff changeset
266 Radix_Mark => '.');
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 Report.Failed("Layout_Error was not raised by Put using " &
kono
parents:
diff changeset
269 "non-default parameters specific to DM " &
kono
parents:
diff changeset
270 "currency, loop #" & Integer'Image(i));
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 exception
kono
parents:
diff changeset
273 when Layout_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
274 when others =>
kono
parents:
diff changeset
275 Report.Failed("Incorrect exception raised by Put using " &
kono
parents:
diff changeset
276 "non-default parameters specific to DM " &
kono
parents:
diff changeset
277 "currency, loop #" & Integer'Image(i));
kono
parents:
diff changeset
278 end;
kono
parents:
diff changeset
279 end loop;
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 end;
kono
parents:
diff changeset
282
kono
parents:
diff changeset
283 exception
kono
parents:
diff changeset
284 when others => Report.Failed("Exception raised in Test_Block");
kono
parents:
diff changeset
285 end Test_Block;
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 Report.Result;
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 end CXF3A08;