annotate gcc/testsuite/ada/acats/tests/cxb/cxb30041.am @ 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 -- CXB30041.AM
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 functions To_C and To_Ada map between the Ada type
kono
parents:
diff changeset
28 -- Character and the C type char.
kono
parents:
diff changeset
29 --
kono
parents:
diff changeset
30 -- Check that the function Is_Nul_Terminated returns True if the
kono
parents:
diff changeset
31 -- char_array parameter contains nul, and otherwise False.
kono
parents:
diff changeset
32 --
kono
parents:
diff changeset
33 -- Check that the function To_C produces a correct char_array result,
kono
parents:
diff changeset
34 -- with lower bound of 0, and length dependent upon the Item and
kono
parents:
diff changeset
35 -- Append_Nul parameters.
kono
parents:
diff changeset
36 --
kono
parents:
diff changeset
37 -- Check that the function To_Ada produces a correct string result, with
kono
parents:
diff changeset
38 -- lower bound of 1, and length dependent upon the Item and Trim_Nul
kono
parents:
diff changeset
39 -- parameters.
kono
parents:
diff changeset
40 --
kono
parents:
diff changeset
41 -- Check that the function To_Ada raises Terminator_Error if the
kono
parents:
diff changeset
42 -- parameter Trim_Nul is set to True, but the actual Item parameter
kono
parents:
diff changeset
43 -- does not contain the nul char.
kono
parents:
diff changeset
44 --
kono
parents:
diff changeset
45 -- TEST DESCRIPTION:
kono
parents:
diff changeset
46 -- This test uses a variety of Character, char, String, and char_array
kono
parents:
diff changeset
47 -- objects to test versions of the To_C, To_Ada, and Is_Nul_Terminated
kono
parents:
diff changeset
48 -- functions.
kono
parents:
diff changeset
49 --
kono
parents:
diff changeset
50 -- This test assumes that the following characters are all included
kono
parents:
diff changeset
51 -- in the implementation defined type Interfaces.C.char:
kono
parents:
diff changeset
52 -- ' ', ',', '.', '0'..'9', 'a'..'z' and 'A'..'Z'.
kono
parents:
diff changeset
53 --
kono
parents:
diff changeset
54 -- APPLICABILITY CRITERIA:
kono
parents:
diff changeset
55 -- This test is applicable to all implementations that provide
kono
parents:
diff changeset
56 -- package Interfaces.C. If an implementation provides
kono
parents:
diff changeset
57 -- package Interfaces.C, this test must compile, execute, and
kono
parents:
diff changeset
58 -- report "PASSED".
kono
parents:
diff changeset
59 --
kono
parents:
diff changeset
60 -- SPECIAL REQUIREMENTS:
kono
parents:
diff changeset
61 -- The file CXB30040.C must be compiled with a C compiler.
kono
parents:
diff changeset
62 -- Implementation dialects of C may require alteration of
kono
parents:
diff changeset
63 -- the C program syntax (see individual C files).
kono
parents:
diff changeset
64 --
kono
parents:
diff changeset
65 -- Note that the compiled C code must be bound with the compiled Ada
kono
parents:
diff changeset
66 -- code to create an executable image. An implementation must provide
kono
parents:
diff changeset
67 -- the necessary commands to accomplish this.
kono
parents:
diff changeset
68 --
kono
parents:
diff changeset
69 -- Note that the C code included in CXB30040.C conforms
kono
parents:
diff changeset
70 -- to ANSI-C. Modifications to these files may be required for other
kono
parents:
diff changeset
71 -- C compilers. An implementation must provide the necessary
kono
parents:
diff changeset
72 -- modifications to satisfy the function requirements.
kono
parents:
diff changeset
73 --
kono
parents:
diff changeset
74 -- TEST FILES:
kono
parents:
diff changeset
75 -- The following files comprise this test:
kono
parents:
diff changeset
76 --
kono
parents:
diff changeset
77 -- CXB30040.C
kono
parents:
diff changeset
78 -- CXB30041.AM
kono
parents:
diff changeset
79 --
kono
parents:
diff changeset
80 -- CHANGE HISTORY:
kono
parents:
diff changeset
81 -- 30 Aug 95 SAIC Initial prerelease version.
kono
parents:
diff changeset
82 -- 09 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
kono
parents:
diff changeset
83 -- 26 Oct 96 SAIC Incorporated reviewer comments.
kono
parents:
diff changeset
84 -- 13 Sep 99 RLB Replaced (bogus) Unchecked_Conversions with a
kono
parents:
diff changeset
85 -- C function character generator.
kono
parents:
diff changeset
86 --
kono
parents:
diff changeset
87 --!
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 with Report;
kono
parents:
diff changeset
90 with Interfaces.C; -- N/A => ERROR
kono
parents:
diff changeset
91 with Ada.Characters.Latin_1;
kono
parents:
diff changeset
92 with Ada.Exceptions;
kono
parents:
diff changeset
93 with Ada.Strings.Fixed;
kono
parents:
diff changeset
94 with Impdef;
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 procedure CXB30041 is
kono
parents:
diff changeset
97 begin
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 Report.Test ("CXB3004", "Check that the functions To_C and To_Ada " &
kono
parents:
diff changeset
100 "produce correct results");
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 Test_Block:
kono
parents:
diff changeset
103 declare
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 use Interfaces, Interfaces.C;
kono
parents:
diff changeset
106 use Ada.Characters, Ada.Characters.Latin_1;
kono
parents:
diff changeset
107 use Ada.Exceptions;
kono
parents:
diff changeset
108 use Ada.Strings.Fixed;
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 Start_Character,
kono
parents:
diff changeset
111 Stop_Character,
kono
parents:
diff changeset
112 TC_Character : Character := Character'First;
kono
parents:
diff changeset
113 TC_char,
kono
parents:
diff changeset
114 TC_Low_char,
kono
parents:
diff changeset
115 TC_High_char : char := char'First;
kono
parents:
diff changeset
116 TC_String : String(1..8) := (others => Latin_1.NUL);
kono
parents:
diff changeset
117 TC_char_array : char_array(0..7) := (others => C.nul);
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 -- The function Char_Gen returns a character corresponding to its
kono
parents:
diff changeset
120 -- argument.
kono
parents:
diff changeset
121 -- Value 0 .. 9 ==> '0' .. '9'
kono
parents:
diff changeset
122 -- Value 10 .. 19 ==> 'A' .. 'J'
kono
parents:
diff changeset
123 -- Value 20 .. 29 ==> 'k' .. 't'
kono
parents:
diff changeset
124 -- Value 30 ==> ' '
kono
parents:
diff changeset
125 -- Value 31 ==> '.'
kono
parents:
diff changeset
126 -- Value 32 ==> ','
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 function Char_Gen (Value : in int) return char;
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 -- Use the user-defined C function char_gen as a completion to the
kono
parents:
diff changeset
131 -- function specification above.
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 pragma Import (Convention => C,
kono
parents:
diff changeset
134 Entity => Char_Gen,
kono
parents:
diff changeset
135 External_Name => Impdef.CXB30040_External_Name);
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 begin
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 -- Check that the functions To_C and To_Ada map between the Ada type
kono
parents:
diff changeset
140 -- Character and the C type char.
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 if To_C(Ada.Characters.Latin_1.NUL) /= Interfaces.C.nul then
kono
parents:
diff changeset
143 Report.Failed("Incorrect result from To_C with NUL character input");
kono
parents:
diff changeset
144 end if;
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 Start_Character := Report.Ident_Char('k');
kono
parents:
diff changeset
147 Stop_Character := Report.Ident_Char('t');
kono
parents:
diff changeset
148 for TC_Character in Start_Character..Stop_Character loop
kono
parents:
diff changeset
149 if To_C(Item => TC_Character) /=
kono
parents:
diff changeset
150 Char_Gen(Character'Pos(TC_Character) - Character'Pos('k') + 20) then
kono
parents:
diff changeset
151 Report.Failed("Incorrect result from To_C with lower case " &
kono
parents:
diff changeset
152 "alphabetic character input");
kono
parents:
diff changeset
153 end if;
kono
parents:
diff changeset
154 end loop;
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 Start_Character := Report.Ident_Char('A');
kono
parents:
diff changeset
157 Stop_Character := Report.Ident_Char('J');
kono
parents:
diff changeset
158 for TC_Character in Start_Character..Stop_Character loop
kono
parents:
diff changeset
159 if To_C(Item => TC_Character) /=
kono
parents:
diff changeset
160 Char_Gen(Character'Pos(TC_Character) - Character'Pos('A') + 10) then
kono
parents:
diff changeset
161 Report.Failed("Incorrect result from To_C with upper case " &
kono
parents:
diff changeset
162 "alphabetic character input");
kono
parents:
diff changeset
163 end if;
kono
parents:
diff changeset
164 end loop;
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 Start_Character := Report.Ident_Char('0');
kono
parents:
diff changeset
167 Stop_Character := Report.Ident_Char('9');
kono
parents:
diff changeset
168 for TC_Character in Start_Character..Stop_Character loop
kono
parents:
diff changeset
169 if To_C(Item => TC_Character) /=
kono
parents:
diff changeset
170 Char_Gen(Character'Pos(TC_Character) - Character'Pos('0')) then
kono
parents:
diff changeset
171 Report.Failed("Incorrect result from To_C with digit " &
kono
parents:
diff changeset
172 "character input");
kono
parents:
diff changeset
173 end if;
kono
parents:
diff changeset
174 end loop;
kono
parents:
diff changeset
175 if To_C(Item => ' ') /= Char_Gen(30) then
kono
parents:
diff changeset
176 Report.Failed("Incorrect result from To_C with space " &
kono
parents:
diff changeset
177 "character input");
kono
parents:
diff changeset
178 end if;
kono
parents:
diff changeset
179 if To_C(Item => '.') /= Char_Gen(31) then
kono
parents:
diff changeset
180 Report.Failed("Incorrect result from To_C with dot " &
kono
parents:
diff changeset
181 "character input");
kono
parents:
diff changeset
182 end if;
kono
parents:
diff changeset
183 if To_C(Item => ',') /= Char_Gen(32) then
kono
parents:
diff changeset
184 Report.Failed("Incorrect result from To_C with comma " &
kono
parents:
diff changeset
185 "character input");
kono
parents:
diff changeset
186 end if;
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 if To_Ada(Interfaces.C.nul) /= Ada.Characters.Latin_1.NUL then
kono
parents:
diff changeset
189 Report.Failed("Incorrect result from To_Ada with nul char input");
kono
parents:
diff changeset
190 end if;
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 for Code in int range
kono
parents:
diff changeset
193 int(Report.Ident_Int(20)) .. int(Report.Ident_Int(29)) loop
kono
parents:
diff changeset
194 -- 'k' .. 't'
kono
parents:
diff changeset
195 if To_Ada(Item => Char_Gen(Code)) /=
kono
parents:
diff changeset
196 Character'Val (Character'Pos('k') + (Code - 20)) then
kono
parents:
diff changeset
197 Report.Failed("Incorrect result from To_Ada with lower case " &
kono
parents:
diff changeset
198 "alphabetic char input");
kono
parents:
diff changeset
199 end if;
kono
parents:
diff changeset
200 end loop;
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202 for Code in int range
kono
parents:
diff changeset
203 int(Report.Ident_Int(10)) .. int(Report.Ident_Int(19)) loop
kono
parents:
diff changeset
204 -- 'A' .. 'J'
kono
parents:
diff changeset
205 if To_Ada(Item => Char_Gen(Code)) /=
kono
parents:
diff changeset
206 Character'Val (Character'Pos('A') + (Code - 10)) then
kono
parents:
diff changeset
207 Report.Failed("Incorrect result from To_Ada with upper case " &
kono
parents:
diff changeset
208 "alphabetic char input");
kono
parents:
diff changeset
209 end if;
kono
parents:
diff changeset
210 end loop;
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 for Code in int range
kono
parents:
diff changeset
213 int(Report.Ident_Int(0)) .. int(Report.Ident_Int(9)) loop
kono
parents:
diff changeset
214 -- '0' .. '9'
kono
parents:
diff changeset
215 if To_Ada(Item => Char_Gen(Code)) /=
kono
parents:
diff changeset
216 Character'Val (Character'Pos('0') + (Code)) then
kono
parents:
diff changeset
217 Report.Failed("Incorrect result from To_Ada with digit " &
kono
parents:
diff changeset
218 "char input");
kono
parents:
diff changeset
219 end if;
kono
parents:
diff changeset
220 end loop;
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 if To_Ada(Item => Char_Gen(30)) /= ' ' then
kono
parents:
diff changeset
223 Report.Failed("Incorrect result from To_Ada with space " &
kono
parents:
diff changeset
224 "char input");
kono
parents:
diff changeset
225 end if;
kono
parents:
diff changeset
226 if To_Ada(Item => Char_Gen(31)) /= '.' then
kono
parents:
diff changeset
227 Report.Failed("Incorrect result from To_Ada with dot " &
kono
parents:
diff changeset
228 "char input");
kono
parents:
diff changeset
229 end if;
kono
parents:
diff changeset
230 if To_Ada(Item => Char_Gen(32)) /= ',' then
kono
parents:
diff changeset
231 Report.Failed("Incorrect result from To_Ada with comma " &
kono
parents:
diff changeset
232 "char input");
kono
parents:
diff changeset
233 end if;
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 -- Check that the function Is_Nul_Terminated produces correct results
kono
parents:
diff changeset
236 -- whether or not the char_array argument contains the
kono
parents:
diff changeset
237 -- Ada.Interfaces.C.nul character.
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 TC_String := "abcdefgh";
kono
parents:
diff changeset
240 if Is_Nul_Terminated(Item => To_C(TC_String, Append_Nul => False)) then
kono
parents:
diff changeset
241 Report.Failed("Incorrect result from Is_Nul_Terminated when no " &
kono
parents:
diff changeset
242 "nul char is present");
kono
parents:
diff changeset
243 end if;
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 if not Is_Nul_Terminated(To_C(TC_String, Append_Nul => True)) then
kono
parents:
diff changeset
246 Report.Failed("Incorrect result from Is_Nul_Terminated when the " &
kono
parents:
diff changeset
247 "nul char is present");
kono
parents:
diff changeset
248 end if;
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250
kono
parents:
diff changeset
251 -- Now that we've tested the character/char versions of To_Ada and To_C,
kono
parents:
diff changeset
252 -- use them to test the string versions.
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 declare
kono
parents:
diff changeset
255 i : size_t := 0;
kono
parents:
diff changeset
256 j : integer := 1;
kono
parents:
diff changeset
257 Incorrect_Conversion : Boolean := False;
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 TC_No_nul : constant char_array := To_C(TC_String, False);
kono
parents:
diff changeset
260 TC_nul_Appended : constant char_array := To_C(TC_String, True);
kono
parents:
diff changeset
261 begin
kono
parents:
diff changeset
262
kono
parents:
diff changeset
263 -- Check that the function To_C produces a char_array result with
kono
parents:
diff changeset
264 -- lower bound of 0, and length dependent upon the Item and
kono
parents:
diff changeset
265 -- Append_Nul parameters (if Append_Nul is True, length is
kono
parents:
diff changeset
266 -- Item'Length + 1; if False, length is Item'Length).
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 if TC_No_nul'First /= 0 or TC_nul_Appended'First /= 0 then
kono
parents:
diff changeset
269 Report.Failed("Incorrect lower bound from Function To_C");
kono
parents:
diff changeset
270 end if;
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 if TC_No_nul'Length /= TC_String'Length then
kono
parents:
diff changeset
273 Report.Failed("Incorrect length returned from Function To_C " &
kono
parents:
diff changeset
274 "when Append_Nul => False");
kono
parents:
diff changeset
275 end if;
kono
parents:
diff changeset
276
kono
parents:
diff changeset
277 for TC_char in Report.Ident_Char('a')..Report.Ident_Char('h') loop
kono
parents:
diff changeset
278 if TC_No_nul(i) /= To_C(TC_char) or -- Single character To_C.
kono
parents:
diff changeset
279 TC_nul_Appended(i) /= To_C(TC_char) then
kono
parents:
diff changeset
280 Incorrect_Conversion := True;
kono
parents:
diff changeset
281 end if;
kono
parents:
diff changeset
282 i := i + 1;
kono
parents:
diff changeset
283 end loop;
kono
parents:
diff changeset
284
kono
parents:
diff changeset
285 if Incorrect_Conversion then
kono
parents:
diff changeset
286 Report.Failed("Incorrect result from To_C with string input " &
kono
parents:
diff changeset
287 "and char_array result");
kono
parents:
diff changeset
288 end if;
kono
parents:
diff changeset
289
kono
parents:
diff changeset
290
kono
parents:
diff changeset
291 if TC_nul_Appended'Length /= TC_String'Length + 1 then
kono
parents:
diff changeset
292 Report.Failed("Incorrect length returned from Function To_C " &
kono
parents:
diff changeset
293 "when Append_Nul => True");
kono
parents:
diff changeset
294 end if;
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 if not Is_Nul_Terminated(TC_nul_Appended) then
kono
parents:
diff changeset
297 Report.Failed("No nul appended to the string parameter during " &
kono
parents:
diff changeset
298 "conversion to char_array by function To_C");
kono
parents:
diff changeset
299 end if;
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301
kono
parents:
diff changeset
302 -- Check that the function To_Ada produces a string result with
kono
parents:
diff changeset
303 -- lower bound of 1, and length dependent upon the Item and
kono
parents:
diff changeset
304 -- Trim_Nul parameters (if Trim_Nul is False, length is Item'Length;
kono
parents:
diff changeset
305 -- if True, length will be the length of the slice of Item prior to
kono
parents:
diff changeset
306 -- the first nul).
kono
parents:
diff changeset
307
kono
parents:
diff changeset
308 declare
kono
parents:
diff changeset
309 TC_No_NUL_String : constant String :=
kono
parents:
diff changeset
310 To_Ada(Item => TC_nul_Appended,
kono
parents:
diff changeset
311 Trim_Nul => True);
kono
parents:
diff changeset
312 TC_NUL_Appended_String : constant String :=
kono
parents:
diff changeset
313 To_Ada(TC_nul_Appended, False);
kono
parents:
diff changeset
314 begin
kono
parents:
diff changeset
315
kono
parents:
diff changeset
316 if TC_No_NUL_String'First /= 1 or
kono
parents:
diff changeset
317 TC_NUL_Appended_String'First /= 1
kono
parents:
diff changeset
318 then
kono
parents:
diff changeset
319 Report.Failed("Incorrect lower bound from Function To_Ada");
kono
parents:
diff changeset
320 end if;
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 if TC_No_NUL_String'Length /= TC_String'Length then
kono
parents:
diff changeset
323 Report.Failed("Incorrect length returned from Function " &
kono
parents:
diff changeset
324 "To_Ada when Trim_Nul => True");
kono
parents:
diff changeset
325 end if;
kono
parents:
diff changeset
326
kono
parents:
diff changeset
327 if TC_NUL_Appended_String'Length /= TC_String'Length + 1 then
kono
parents:
diff changeset
328 Report.Failed("Incorrect length returned from Function " &
kono
parents:
diff changeset
329 "To_Ada when Trim_Nul => False");
kono
parents:
diff changeset
330 end if;
kono
parents:
diff changeset
331
kono
parents:
diff changeset
332 Start_Character := Report.Ident_Char('a');
kono
parents:
diff changeset
333 Stop_Character := Report.Ident_Char('h');
kono
parents:
diff changeset
334 for TC_Character in Start_Character..Stop_Character loop
kono
parents:
diff changeset
335 if TC_No_NUL_String(j) /= TC_Character or
kono
parents:
diff changeset
336 TC_NUL_Appended_String(j) /= TC_Character
kono
parents:
diff changeset
337 then
kono
parents:
diff changeset
338 Report.Failed("Incorrect result from To_Ada with " &
kono
parents:
diff changeset
339 "char_array input, index = " &
kono
parents:
diff changeset
340 Integer'Image(j));
kono
parents:
diff changeset
341 end if;
kono
parents:
diff changeset
342 j := j + 1;
kono
parents:
diff changeset
343 end loop;
kono
parents:
diff changeset
344
kono
parents:
diff changeset
345 end;
kono
parents:
diff changeset
346
kono
parents:
diff changeset
347
kono
parents:
diff changeset
348 -- Check that the function To_Ada raises Terminator_Error if the
kono
parents:
diff changeset
349 -- parameter Trim_Nul is set to True, but the actual Item parameter
kono
parents:
diff changeset
350 -- does not contain the nul char.
kono
parents:
diff changeset
351
kono
parents:
diff changeset
352 begin
kono
parents:
diff changeset
353 TC_String := To_Ada(TC_No_nul, Trim_Nul => True);
kono
parents:
diff changeset
354 Report.Failed("Terminator_Error not raised when Item " &
kono
parents:
diff changeset
355 "parameter of To_Ada does not contain the " &
kono
parents:
diff changeset
356 "nul char, but parameter Trim_Nul => True");
kono
parents:
diff changeset
357 Report.Comment(TC_String & " printed to defeat optimization");
kono
parents:
diff changeset
358 exception
kono
parents:
diff changeset
359 when Terminator_Error => null; -- OK, expected exception.
kono
parents:
diff changeset
360 when others =>
kono
parents:
diff changeset
361 Report.Failed("Incorrect exception raised by function " &
kono
parents:
diff changeset
362 "To_Ada when the Item parameter does not " &
kono
parents:
diff changeset
363 "contain the nul char, but parameter " &
kono
parents:
diff changeset
364 "Trim_Nul => True");
kono
parents:
diff changeset
365 end;
kono
parents:
diff changeset
366
kono
parents:
diff changeset
367 end;
kono
parents:
diff changeset
368
kono
parents:
diff changeset
369 exception
kono
parents:
diff changeset
370 when The_Error : others =>
kono
parents:
diff changeset
371 Report.Failed ("The following exception was raised in the " &
kono
parents:
diff changeset
372 "Test_Block: " & Exception_Name(The_Error));
kono
parents:
diff changeset
373 end Test_Block;
kono
parents:
diff changeset
374
kono
parents:
diff changeset
375 Report.Result;
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 end CXB30041;