OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cxa/] [cxa3001.a] - Blame information for rev 309

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CXA3001.A
2
--
3
--                             Grant of Unlimited Rights
4
--
5
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7
--     unlimited rights in the software and documentation contained herein.
8
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making
9
--     this public release, the Government intends to confer upon all
10
--     recipients unlimited rights  equal to those held by the Government.
11
--     These rights include rights to use, duplicate, release or disclose the
12
--     released technical data and computer software in whole or in part, in
13
--     any manner and for any purpose whatsoever, and to have or permit others
14
--     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 the character classification functions defined in
28
--      package Ada.Characters.Handling produce correct results when provided
29
--      constant arguments from package Ada.Characters.Latin_1.
30
--
31
-- TEST DESCRIPTION:
32
--      This test checks the character classification functions of package
33
--      Ada.Characters.Handling.  In the evaluation of each function, loops
34
--      are constructed to examine the function with as many values of type
35
--      Character (Ada.Characters.Latin_1 constants) as possible in an
36
--      amount of code that is about equal to the amount of code required
37
--      to examine the function with a few representative input values and
38
--      endpoint values.
39
--      The usage paradigm being demonstrated by this test is that of the
40
--      functions being used to assign to boolean variables, as well as
41
--      serving as boolean conditions.
42
--
43
--
44
-- CHANGE HISTORY:
45
--      06 Dec 94   SAIC    ACVC 2.0
46
--      29 Apr 95   SAIC    Fixed subtest checking Is_Graphic function.
47
--
48
--!
49
 
50
with Ada.Characters.Latin_1;
51
with Ada.Characters.Handling;
52
with Report;
53
 
54
procedure CXA3001 is
55
 
56
begin
57
 
58
   Report.Test ("CXA3001", "Check that the character classification "      &
59
                           "functions defined in package "                 &
60
                           "Ada.Characters.Handling produce "              &
61
                           "correct results when provided constant "       &
62
                           "arguments from package Ada.Characters.Latin_1");
63
 
64
   Test_Block:
65
   declare
66
 
67
      package AC  renames Ada.Characters;
68
      package ACH renames Ada.Characters.Handling;
69
 
70
      TC_Boolean : Boolean := False;
71
 
72
   begin
73
 
74
      -- Over the next six statements/blocks of code, evaluate functions
75
      -- Is_Control and Is_Graphic with control character and non-control
76
      -- character values.
77
 
78
      for i in Character'Pos(AC.Latin_1.NUL) ..
79
               Character'Pos(AC.Latin_1.US)  loop
80
         if not ACH.Is_Control(Character'Val(i)) then
81
            Report.Failed ("Incorrect result from function Is_Control - 1");
82
         end if;
83
         if ACH.Is_Graphic(Character'Val(i)) then
84
            Report.Failed ("Incorrect result from function Is_Graphic - 1");
85
         end if;
86
      end loop;
87
 
88
 
89
      for i in Character'Pos(AC.Latin_1.Space) ..
90
               Character'Pos(AC.Latin_1.Tilde) loop
91
         if not ACH.Is_Graphic(Character'Val(i)) then
92
            Report.Failed ("Incorrect result from function Is_Graphic - 2");
93
         end if;
94
         if ACH.Is_Control(Character'Val(i)) then
95
            Report.Failed ("Incorrect result from function Is_Control - 2");
96
         end if;
97
      end loop;
98
 
99
 
100
      for i in Character'Pos(AC.Latin_1.Reserved_128) ..
101
               Character'Pos(AC.Latin_1.APC)  loop
102
         if not ACH.Is_Control(Character'Val(i)) then
103
            Report.Failed ("Incorrect result from function Is_Control - 3");
104
         end if;
105
         TC_Boolean := ACH.Is_Graphic(Character'Val(i));
106
         if TC_Boolean then
107
            Report.Failed ("Incorrect result from function Is_Graphic - 3");
108
            TC_Boolean := False;
109
         end if;
110
      end loop;
111
 
112
      for i in Character'Pos(AC.Latin_1.No_Break_Space) ..
113
               Character'Pos(AC.Latin_1.LC_Y_Diaeresis) loop
114
         TC_Boolean := ACH.Is_Control(Character'Val(i));
115
         if TC_Boolean then
116
            Report.Failed ("Incorrect result from function Is_Control - 4");
117
            TC_Boolean := False;
118
         end if;
119
         if not ACH.Is_Graphic(Character'Val(i)) then
120
            Report.Failed ("Incorrect result from function Is_Graphic - 4");
121
         end if;
122
      end loop;
123
 
124
      -- Check renamed constants.
125
 
126
      if not (ACH.Is_Control(AC.Latin_1.IS4) and
127
              ACH.Is_Control(AC.Latin_1.IS3) and
128
              ACH.Is_Control(AC.Latin_1.IS2) and
129
              ACH.Is_Control(AC.Latin_1.IS1))       or
130
         (ACH.Is_Control(AC.Latin_1.NBSP)           or
131
          ACH.Is_Control(AC.Latin_1.Paragraph_Sign) or
132
          ACH.Is_Control(AC.Latin_1.Minus_Sign)     or
133
          ACH.Is_Control(AC.Latin_1.Ring_Above))
134
      then
135
         Report.Failed ("Incorrect result from function Is_Control - 5");
136
      end if;
137
 
138
      if (ACH.Is_Graphic(AC.Latin_1.IS4)  or
139
          ACH.Is_Graphic(AC.Latin_1.IS3)  or
140
          ACH.Is_Graphic(AC.Latin_1.IS2)  or
141
          ACH.Is_Graphic(AC.Latin_1.IS1)) or
142
         not (ACH.Is_Graphic(AC.Latin_1.NBSP)           and
143
              ACH.Is_Graphic(AC.Latin_1.Paragraph_Sign) and
144
              ACH.Is_Graphic(AC.Latin_1.Minus_Sign)     and
145
              ACH.Is_Graphic(AC.Latin_1.Ring_Above))
146
      then
147
         Report.Failed ("Incorrect result from function Is_Graphic - 5");
148
      end if;
149
 
150
 
151
      -- Evaluate function Is_Letter with letter/non-letter inputs.
152
 
153
      for i in Character'Pos('A') .. Character'Pos('Z') loop
154
         if not ACH.Is_Letter(Character'Val(i)) then
155
            Report.Failed ("Incorrect Is_Letter result - 1");
156
         end if;
157
      end loop;
158
 
159
      for i in Character'Pos(AC.Latin_1.LC_A) ..
160
               Character'Pos(AC.Latin_1.LC_Z) loop
161
         if not ACH.Is_Letter(Character'Val(i)) then
162
            Report.Failed ("Incorrect Is_Letter result - 2");
163
         end if;
164
      end loop;
165
 
166
      for i in Character'Pos(AC.Latin_1.UC_A_Grave) ..
167
               Character'Pos(AC.Latin_1.UC_O_Diaeresis) loop
168
         if not ACH.Is_Letter(Character'Val(i)) then
169
            Report.Failed ("Incorrect Is_Letter result - 3");
170
         end if;
171
      end loop;
172
 
173
      for i in Character'Pos(AC.Latin_1.UC_O_Oblique_Stroke) ..
174
               Character'Pos(AC.Latin_1.LC_O_Diaeresis) loop
175
         if not ACH.Is_Letter(Character'Val(i)) then
176
            Report.Failed ("Incorrect Is_Letter result - 4");
177
         end if;
178
      end loop;
179
 
180
      for i in Character'Pos(AC.Latin_1.LC_O_Oblique_Stroke) ..
181
               Character'Pos(AC.Latin_1.LC_Y_Diaeresis) loop
182
         if not ACH.Is_Letter(Character'Val(i)) then
183
            Report.Failed ("Incorrect Is_Letter result - 5");
184
         end if;
185
      end loop;
186
 
187
      -- Check for rejection of non-letters.
188
      for i in Character'Pos(AC.Latin_1.NUL) ..
189
               Character'Pos(AC.Latin_1.Commercial_At) loop
190
         if ACH.Is_Letter(Character'Val(i)) then
191
            Report.Failed ("Incorrect Is_Letter result - 6");
192
         end if;
193
      end loop;
194
 
195
 
196
      -- Evaluate function Is_Lower with lower case/non-lower case inputs.
197
 
198
      for i in Character'Pos(AC.Latin_1.LC_A) ..
199
               Character'Pos(AC.Latin_1.LC_Z) loop
200
         if not ACH.Is_Lower(Character'Val(i)) then
201
            Report.Failed ("Incorrect Is_Lower result - 1");
202
         end if;
203
      end loop;
204
 
205
      for i in Character'Pos(AC.Latin_1.LC_A_Grave) ..
206
               Character'Pos(AC.Latin_1.LC_O_Diaeresis) loop
207
         if not ACH.Is_Lower(Character'Val(i)) then
208
            Report.Failed ("Incorrect Is_Lower result - 2");
209
         end if;
210
      end loop;
211
 
212
      for i in Character'Pos(AC.Latin_1.LC_O_Oblique_Stroke) ..
213
               Character'Pos(AC.Latin_1.LC_Y_Diaeresis) loop
214
         if not ACH.Is_Lower(Character'Val(i)) then
215
            Report.Failed ("Incorrect Is_Lower result - 3");
216
         end if;
217
      end loop;
218
 
219
      if ACH.Is_Lower('A')                         or
220
         ACH.Is_Lower(AC.Latin_1.UC_Icelandic_Eth) or
221
         ACH.Is_Lower(AC.Latin_1.Number_Sign)      or
222
         ACH.Is_Lower(AC.Latin_1.Cedilla)          or
223
         ACH.Is_Lower(AC.Latin_1.SYN)              or
224
         ACH.Is_Lower(AC.Latin_1.ESA)
225
      then
226
         Report.Failed ("Incorrect Is_Lower result - 4");
227
      end if;
228
 
229
 
230
      -- Evaluate function Is_Upper with upper case/non-upper case inputs.
231
 
232
      for i in Character'Pos('A') .. Character'Pos('Z') loop
233
         if not ACH.Is_Upper(Character'Val(i)) then
234
            Report.Failed ("Incorrect Is_Upper result - 1");
235
         end if;
236
      end loop;
237
 
238
      for i in Character'Pos(AC.Latin_1.UC_A_Grave) ..
239
               Character'Pos(AC.Latin_1.UC_O_Diaeresis) loop
240
         if not ACH.Is_Upper(Character'Val(i)) then
241
            Report.Failed ("Incorrect Is_Upper result - 2");
242
         end if;
243
      end loop;
244
 
245
      for i in Character'Pos(AC.Latin_1.UC_O_Oblique_Stroke) ..
246
               Character'Pos(AC.Latin_1.UC_Icelandic_Thorn) loop
247
         if not ACH.Is_Upper(Character'Val(i)) then
248
            Report.Failed ("Incorrect Is_Upper result - 3");
249
         end if;
250
      end loop;
251
 
252
      if ACH.Is_Upper('8')                    or
253
         ACH.Is_Upper(AC.Latin_1.LC_A_Ring  ) or
254
         ACH.Is_Upper(AC.Latin_1.Dollar_Sign) or
255
         ACH.Is_Upper(AC.Latin_1.Broken_Bar)  or
256
         ACH.Is_Upper(AC.Latin_1.ETB)         or
257
         ACH.Is_Upper(AC.Latin_1.VTS)
258
      then
259
         Report.Failed ("Incorrect Is_Upper result - 4");
260
      end if;
261
 
262
 
263
      for i in Character'Pos('a') .. Character'Pos('z') loop
264
         if ACH.Is_Upper(Character'Val(i)) then
265
            Report.Failed ("Incorrect Is_Upper result - 5");
266
         end if;
267
      end loop;
268
 
269
 
270
      -- Evaluate function Is_Basic with basic/non-basic inputs.
271
      -- (Note: Basic letters are those without diacritical marks.)
272
 
273
      for i in Character'Pos('A') .. Character'Pos('Z') loop
274
         if not ACH.Is_Basic(Character'Val(i)) then
275
            Report.Failed ("Incorrect Is_Basic result - 1");
276
         end if;
277
      end loop;
278
 
279
      for i in Character'Pos(AC.Latin_1.LC_A) ..
280
               Character'Pos(AC.Latin_1.LC_Z) loop
281
         if not ACH.Is_Basic(Character'Val(i)) then
282
            Report.Failed ("Incorrect Is_Basic result - 2");
283
         end if;
284
      end loop;
285
 
286
 
287
      if not (ACH.Is_Basic(AC.Latin_1.UC_AE_Diphthong)     and
288
              ACH.Is_Basic(AC.Latin_1.LC_AE_Diphthong)     and
289
              ACH.Is_Basic(AC.Latin_1.LC_German_Sharp_S)   and
290
              ACH.Is_Basic(AC.Latin_1.LC_Icelandic_Eth)    and
291
              ACH.Is_Basic(AC.Latin_1.LC_Icelandic_Thorn)  and
292
              ACH.Is_Basic(AC.Latin_1.UC_Icelandic_Eth)    and
293
              ACH.Is_Basic(AC.Latin_1.UC_Icelandic_Thorn))
294
      then
295
         Report.Failed ("Incorrect Is_Basic result - 3");
296
      end if;
297
 
298
      -- Check for rejection of non-basics.
299
      if ACH.Is_Basic(AC.Latin_1.UC_A_Tilde) or
300
         ACH.Is_Basic(AC.Latin_1.LC_A_Grave) or
301
         ACH.Is_Basic(AC.Latin_1.Ampersand)  or
302
         ACH.Is_Basic(AC.Latin_1.Yen_Sign)   or
303
         ACH.Is_Basic(AC.Latin_1.NAK)        or
304
         ACH.Is_Basic(AC.Latin_1.SS2)
305
      then
306
         Report.Failed ("Incorrect Is_Basic result - 4");
307
      end if;
308
 
309
 
310
 
311
      for i in Character'Pos(AC.Latin_1.NUL) ..
312
               Character'Pos(AC.Latin_1.Commercial_At) loop
313
         if ACH.Is_Basic(Character'Val(i)) then
314
            Report.Failed ("Incorrect Is_Basic result - 5");
315
         end if;
316
      end loop;
317
 
318
 
319
      -- Evaluate functions Is_Digit and Is_Decimal_Digit (a rename of
320
      -- Is_Digit) with decimal digit/non-digit inputs.
321
 
322
 
323
      if not (ACH.Is_Digit('0')          and
324
              ACH.Is_Decimal_Digit('9')) or
325
         ACH.Is_Digit ('a')              or     -- Hex digits.
326
         ACH.Is_Decimal_Digit ('f')      or
327
         ACH.Is_Decimal_Digit ('A')      or
328
         ACH.Is_Digit ('F')
329
      then
330
         Report.Failed ("Incorrect Is_Digit/Is_Decimal_Digit result - 1");
331
      end if;
332
 
333
      if ACH.Is_Digit         (AC.Latin_1.Full_Stop)         or
334
         ACH.Is_Decimal_Digit (AC.Latin_1.Dollar_Sign)       or
335
         ACH.Is_Digit         (AC.Latin_1.Number_Sign)       or
336
         ACH.Is_Decimal_Digit (AC.Latin_1.Left_Parenthesis)  or
337
         ACH.Is_Digit         (AC.Latin_1.Right_Parenthesis)
338
      then
339
         Report.Failed ("Incorrect Is_Digit/Is_Decimal_Digit result - 2");
340
      end if;
341
 
342
 
343
      -- Evaluate functions Is_Hexadecimal_Digit with hexadecimal digit and
344
      -- non-hexadecimal digit inputs.
345
 
346
      for i in Character'Pos('0') .. Character'Pos('9') loop
347
         if not ACH.Is_Hexadecimal_Digit(Character'Val(i)) then
348
            Report.Failed ("Incorrect Is_Hexadecimal_Digit result - 1");
349
         end if;
350
      end loop;
351
 
352
      for i in Character'Pos('A') .. Character'Pos('F') loop
353
         if not ACH.Is_Hexadecimal_Digit(Character'Val(i)) then
354
            Report.Failed ("Incorrect Is_Hexadecimal_Digit result - 2");
355
         end if;
356
      end loop;
357
 
358
      for i in Character'Pos(AC.Latin_1.LC_A) ..
359
               Character'Pos(AC.Latin_1.LC_F) loop
360
         if not ACH.Is_Hexadecimal_Digit(Character'Val(i)) then
361
            Report.Failed ("Incorrect Is_Hexadecimal_Digit result - 3");
362
         end if;
363
      end loop;
364
 
365
 
366
      if ACH.Is_Hexadecimal_Digit (AC.Latin_1.Minus_Sign)        or
367
         ACH.Is_Hexadecimal_Digit (AC.Latin_1.Hyphen)            or
368
         ACH.Is_Hexadecimal_Digit (AC.Latin_1.LC_G)              or
369
         ACH.Is_Hexadecimal_Digit (AC.Latin_1.LC_Z)              or
370
         ACH.Is_Hexadecimal_Digit ('G')                          or
371
         ACH.Is_Hexadecimal_Digit (AC.Latin_1.Cent_Sign)         or
372
         ACH.Is_Hexadecimal_Digit (AC.Latin_1.Pound_Sign)
373
      then
374
         Report.Failed ("Incorrect Is_HexaDecimal_Digit result - 4");
375
      end if;
376
 
377
 
378
      -- Evaluate functions Is_Alphanumeric and Is_Special with
379
      -- letters, digits, and non-alphanumeric inputs.
380
 
381
      for i in Character'Pos(AC.Latin_1.NUL) ..
382
               Character'Pos(AC.Latin_1.US)  loop
383
         if ACH.Is_Alphanumeric(Character'Val(i)) then
384
            Report.Failed ("Incorrect Is_Alphanumeric result - 1");
385
         end if;
386
         TC_Boolean := ACH.Is_Special(Character'Val(i));
387
         if TC_Boolean then
388
            Report.Failed ("Incorrect Is_Special result - 1");
389
            TC_Boolean := False;
390
         end if;
391
      end loop;
392
 
393
      for i in Character'Pos(AC.Latin_1.Reserved_128) ..
394
               Character'Pos(AC.Latin_1.APC)  loop
395
         TC_Boolean := ACH.Is_Alphanumeric(Character'Val(i));
396
         if TC_Boolean then
397
            Report.Failed ("Incorrect Is_Alphanumeric result - 2");
398
            TC_Boolean := False;
399
         end if;
400
         if ACH.Is_Special(Character'Val(i)) then
401
            Report.Failed ("Incorrect Is_Special result - 2");
402
         end if;
403
      end loop;
404
 
405
      for i in Character'Pos(AC.Latin_1.Space) ..
406
               Character'Pos(AC.Latin_1.Solidus) loop
407
         TC_Boolean := ACH.Is_Alphanumeric(Character'Val(i));
408
         if TC_Boolean then
409
            Report.Failed ("Incorrect Is_Alphanumeric result - 3");
410
            TC_Boolean := False;
411
         end if;
412
         if not ACH.Is_Special(Character'Val(i)) then
413
            Report.Failed ("Incorrect Is_Special result - 3");
414
         end if;
415
      end loop;
416
 
417
      for i in Character'Pos('A') .. Character'Pos('Z') loop
418
         if not ACH.Is_Alphanumeric(Character'Val(i)) then
419
            Report.Failed ("Incorrect Is_Alphanumeric result - 4");
420
         end if;
421
         TC_Boolean := ACH.Is_Special(Character'Val(i));
422
         if TC_Boolean then
423
            Report.Failed ("Incorrect Is_Special result - 4");
424
            TC_Boolean := False;
425
         end if;
426
      end loop;
427
 
428
      for i in Character'Pos('0') .. Character'Pos('9') loop
429
         if not ACH.Is_Alphanumeric(Character'Val(i)) then
430
            Report.Failed ("Incorrect Is_Alphanumeric result - 5");
431
         end if;
432
         TC_Boolean := ACH.Is_Special(Character'Val(i));
433
         if TC_Boolean then
434
            Report.Failed ("Incorrect Is_Special result - 5");
435
            TC_Boolean := False;
436
         end if;
437
      end loop;
438
 
439
      for i in Character'Pos(AC.Latin_1.LC_A) ..
440
               Character'Pos(AC.Latin_1.LC_Z) loop
441
         if not ACH.Is_Alphanumeric(Character'Val(i)) then
442
            Report.Failed ("Incorrect Is_Alphanumeric result - 6");
443
         end if;
444
         TC_Boolean := ACH.Is_Special(Character'Val(i));
445
         if TC_Boolean then
446
            Report.Failed ("Incorrect Is_Special result - 6");
447
            TC_Boolean := False;
448
         end if;
449
      end loop;
450
 
451
      for i in Character'Pos(AC.Latin_1.No_Break_Space) ..
452
               Character'Pos(AC.Latin_1.Inverted_Question) loop
453
         TC_Boolean := ACH.Is_Alphanumeric(Character'Val(i));
454
         if TC_Boolean then
455
            Report.Failed ("Incorrect Is_Alphanumeric result - 7");
456
            TC_Boolean := False;
457
         end if;
458
         if not ACH.Is_Special(Character'Val(i)) then
459
            Report.Failed ("Incorrect Is_Special result - 7");
460
         end if;
461
      end loop;
462
 
463
      for i in Character'Pos(AC.Latin_1.UC_A_Grave) ..
464
               Character'Pos(AC.Latin_1.UC_O_Diaeresis) loop
465
         if not ACH.Is_Alphanumeric(Character'Val(i)) then
466
            Report.Failed ("Incorrect Is_Alphanumeric result - 8");
467
         end if;
468
         TC_Boolean := ACH.Is_Special(Character'Val(i));
469
         if TC_Boolean then
470
            Report.Failed ("Incorrect Is_Special result - 8");
471
            TC_Boolean := False;
472
         end if;
473
      end loop;
474
 
475
      for i in Character'Pos(AC.Latin_1.UC_O_Oblique_Stroke) ..
476
               Character'Pos(AC.Latin_1.LC_O_Diaeresis) loop
477
         if not ACH.Is_Alphanumeric(Character'Val(i)) then
478
            Report.Failed ("Incorrect Is_Alphanumeric result - 9");
479
         end if;
480
         TC_Boolean := ACH.Is_Special(Character'Val(i));
481
         if TC_Boolean then
482
            Report.Failed ("Incorrect Is_Special result - 9");
483
            TC_Boolean := False;
484
         end if;
485
      end loop;
486
 
487
      for i in Character'Pos(AC.Latin_1.LC_O_Oblique_Stroke) ..
488
               Character'Pos(AC.Latin_1.LC_Y_Diaeresis) loop
489
         if not ACH.Is_Alphanumeric(Character'Val(i)) then
490
            Report.Failed ("Incorrect Is_Alphanumeric result - 10");
491
         end if;
492
         TC_Boolean := ACH.Is_Special(Character'Val(i));
493
         if TC_Boolean then
494
            Report.Failed ("Incorrect Is_Special result - 10");
495
            TC_Boolean := False;
496
         end if;
497
      end loop;
498
 
499
 
500
   exception
501
      when others => Report.Failed ("Exception raised during processing");
502
   end Test_Block;
503
 
504
 
505
   Report.Result;
506
 
507
end CXA3001;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.