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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cxa/] [cxa3002.a] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CXA3002.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 conversion functions for Characters and Strings
28
--      defined in package Ada.Characters.Handling provide correct results
29
--      when given character/string input parameters.
30
--
31
-- TEST DESCRIPTION:
32
--      This test checks the output of the To_Lower, To_Upper, and
33
--      To_Basic functions for both Characters and Strings.  Each function
34
--      is called with input parameters that are within the appropriate
35
--      range of values, and also with values outside the specified
36
--      range (i.e., lower case 'a' to To_Lower).  The functions are also
37
--      used in combination with one another, with the result of one function
38
--      providing the actual input parameter value to another.
39
--
40
--
41
-- CHANGE HISTORY:
42
--      06 Dec 94   SAIC    ACVC 2.0
43
--      22 Dec 94   SAIC    Corrected evaluations of Functions In Combination.
44
--
45
--!
46
 
47
with Ada.Characters.Latin_1;
48
with Ada.Characters.Handling;
49
with Report;
50
 
51
procedure CXA3002 is
52
 
53
   package AC  renames Ada.Characters;
54
   package ACH renames Ada.Characters.Handling;
55
 
56
begin
57
 
58
   Report.Test ("CXA3002", "Check that the conversion functions for "   &
59
                           "Characters and Strings defined in package " &
60
                           "Ada.Characters.Handling provide correct "   &
61
                           "results when given character/string input " &
62
                           "parameters");
63
 
64
 
65
   Character_Block:
66
   declare
67
      Offset : constant Integer := Character'Pos('a') - Character'Pos('A');
68
   begin
69
 
70
      -- Function To_Lower for Characters
71
 
72
      if ACH.To_Lower('A') /= 'a' or  ACH.To_Lower('Z') /= 'z' then
73
         Report.Failed ("Incorrect operation of function To_Lower - 1");
74
      end if;
75
 
76
 
77
      for i in Character'Pos('A') .. Character'Pos('Z') loop
78
         if ACH.To_Lower(Character'Val(i)) /= Character'Val(i + Offset) then
79
            Report.Failed ("Incorrect operation of function To_Lower - 2");
80
         end if;
81
      end loop;
82
 
83
 
84
      if (ACH.To_Lower(AC.Latin_1.UC_A_Grave)         /=
85
          AC.Latin_1.LC_A_Grave)                     or
86
         (ACH.To_Lower(AC.Latin_1.UC_Icelandic_Thorn) /=
87
          AC.Latin_1.LC_Icelandic_Thorn)
88
      then
89
         Report.Failed ("Incorrect operation of function To_Lower - 3");
90
      end if;
91
 
92
 
93
      if ACH.To_Lower('c')                 /= 'c'                 or
94
         ACH.To_Lower('w')                 /= 'w'                 or
95
         ACH.To_Lower(AC.Latin_1.CR)       /= AC.Latin_1.CR       or
96
         ACH.To_Lower(AC.Latin_1.LF)       /= AC.Latin_1.LF       or
97
         ACH.To_Lower(AC.Latin_1.Comma)    /= AC.Latin_1.Comma    or
98
         ACH.To_Lower(AC.Latin_1.Question) /= AC.Latin_1.Question or
99
         ACH.To_Lower('0')                 /= '0'                 or
100
         ACH.To_Lower('9')                 /= '9'
101
      then
102
         Report.Failed ("Incorrect operation of function To_Lower - 4");
103
      end if;
104
 
105
 
106
      --- Function To_Upper for Characters
107
 
108
 
109
      if not (ACH.To_Upper('b') = 'B') and (ACH.To_Upper('y') = 'Y') then
110
         Report.Failed ("Incorrect operation of function To_Upper - 1");
111
      end if;
112
 
113
 
114
      for i in Character'Pos(AC.Latin_1.LC_A) ..
115
               Character'Pos(AC.Latin_1.LC_Z) loop
116
         if ACH.To_Upper(Character'Val(i)) /= Character'Val(i - Offset) then
117
            Report.Failed ("Incorrect operation of function To_Upper - 2");
118
         end if;
119
      end loop;
120
 
121
 
122
      if (ACH.To_Upper(AC.Latin_1.LC_U_Diaeresis) /=
123
          AC.Latin_1.UC_U_Diaeresis)                 or
124
         (ACH.To_Upper(AC.Latin_1.LC_A_Ring)      /=
125
          AC.Latin_1.UC_A_Ring)
126
      then
127
         Report.Failed ("Incorrect operation of function To_Upper - 3");
128
      end if;
129
 
130
 
131
      if not (ACH.To_Upper('F') = 'F'                       and
132
              ACH.To_Upper('U') = 'U'                       and
133
              ACH.To_Upper(AC.Latin_1.LC_German_Sharp_S) =
134
                AC.Latin_1.LC_German_Sharp_S                and
135
              ACH.To_Upper(AC.Latin_1.LC_Y_Diaeresis) =
136
                AC.Latin_1.LC_Y_Diaeresis)
137
      then
138
         Report.Failed ("Incorrect operation of function To_Upper - 4");
139
      end if;
140
 
141
 
142
      --- Function To_Basic for Characters
143
 
144
 
145
      if ACH.To_Basic(AC.Latin_1.LC_A_Circumflex) /=
146
         ACH.To_Basic(AC.Latin_1.LC_A_Tilde)         or
147
         ACH.To_Basic(AC.Latin_1.LC_E_Grave)      /=
148
         ACH.To_Basic(AC.Latin_1.LC_E_Acute)         or
149
         ACH.To_Basic(AC.Latin_1.LC_I_Circumflex) /=
150
         ACH.To_Basic(AC.Latin_1.LC_I_Diaeresis)     or
151
         ACH.To_Basic(AC.Latin_1.UC_O_Tilde)      /=
152
         ACH.To_Basic(AC.Latin_1.UC_O_Acute)         or
153
         ACH.To_Basic(AC.Latin_1.UC_U_Grave)      /=
154
         ACH.To_Basic(AC.Latin_1.UC_U_Acute)         or
155
         ACH.To_Basic(AC.Latin_1.LC_Y_Acute)      /=
156
         ACH.To_Basic(AC.Latin_1.LC_Y_Diaeresis)
157
      then
158
         Report.Failed ("Incorrect operation of function To_Basic - 1");
159
      end if;
160
 
161
 
162
      if ACH.To_Basic('Y') /= 'Y'                   or
163
         ACH.To_Basic(AC.Latin_1.LC_E_Acute) /= 'e' or
164
         ACH.To_Basic('6') /= '6'                   or
165
         ACH.To_Basic(AC.Latin_1.LC_R) /= 'r'
166
      then
167
         Report.Failed ("Incorrect operation of function To_Basic - 2");
168
      end if;
169
 
170
 
171
      -- Using Functions (for Characters) in Combination
172
 
173
 
174
      if (ACH.To_Upper(ACH.To_Lower('A')) /= 'A' ) or
175
         (ACH.To_Upper(ACH.To_Lower(AC.Latin_1.UC_A_Acute)) /=
176
          AC.Latin_1.UC_A_Acute )
177
      then
178
         Report.Failed("Incorrect operation of functions in combination - 1");
179
      end if;
180
 
181
 
182
      if ACH.To_Basic(ACH.To_Lower(ACH.To_Upper(AC.Latin_1.LC_U_Grave))) /=
183
         'u'
184
      then
185
         Report.Failed("Incorrect operation of functions in combination - 2");
186
      end if;
187
 
188
 
189
      if ACH.To_Lower (ACH.To_Basic
190
                         (ACH.To_Upper(AC.Latin_1.LC_O_Diaeresis))) /= 'o'
191
      then
192
         Report.Failed("Incorrect operation of functions in combination - 3");
193
      end if;
194
 
195
 
196
   exception
197
      when others => Report.Failed ("Exception raised in Character_Block");
198
   end Character_Block;
199
 
200
 
201
   String_Block:
202
   declare
203
 
204
      LC_String : constant String := "az" &
205
                                      AC.Latin_1.LC_A_Grave &
206
                                      AC.Latin_1.LC_C_Cedilla;
207
 
208
      UC_String : constant String := "AZ" &
209
                                      AC.Latin_1.UC_A_Grave &
210
                                      AC.Latin_1.UC_C_Cedilla;
211
 
212
      LC_Basic_String    : constant String := "aei" & 'o' & 'u';
213
 
214
      LC_NonBasic_String : constant String := AC.Latin_1.LC_A_Diaeresis  &
215
                                              AC.Latin_1.LC_E_Circumflex &
216
                                              AC.Latin_1.LC_I_Acute      &
217
                                              AC.Latin_1.LC_O_Tilde      &
218
                                              AC.Latin_1.LC_U_Grave;
219
 
220
      UC_Basic_String    : constant String := "AEIOU";
221
 
222
      UC_NonBasic_String : constant String := AC.Latin_1.UC_A_Tilde      &
223
                                              AC.Latin_1.UC_E_Acute      &
224
                                              AC.Latin_1.UC_I_Grave      &
225
                                              AC.Latin_1.UC_O_Diaeresis  &
226
                                              AC.Latin_1.UC_U_Circumflex;
227
 
228
      LC_Special_String  : constant String := "ab"                         &
229
                                              AC.Latin_1.LC_German_Sharp_S &
230
                                              AC.Latin_1.LC_Y_Diaeresis;
231
 
232
      UC_Special_String  : constant String := "AB"                         &
233
                                              AC.Latin_1.LC_German_Sharp_S &
234
                                              AC.Latin_1.LC_Y_Diaeresis;
235
 
236
   begin
237
 
238
      -- Function To_Lower for Strings
239
 
240
 
241
      if ACH.To_Lower (UC_String) /= LC_String  or
242
         ACH.To_Lower (LC_String) /= LC_String
243
      then
244
         Report.Failed ("Incorrect result from To_Lower for strings - 1");
245
      end if;
246
 
247
 
248
      if ACH.To_Lower (UC_Basic_String) /= LC_Basic_String then
249
         Report.Failed ("Incorrect result from To_Lower for strings - 2");
250
      end if;
251
 
252
 
253
      -- Function To_Upper for Strings
254
 
255
 
256
      if not (ACH.To_Upper (LC_String) = UC_String) then
257
         Report.Failed ("Incorrect result from To_Upper for strings - 1");
258
      end if;
259
 
260
 
261
      if ACH.To_Upper (LC_Basic_String) /= UC_Basic_String or
262
         ACH.To_Upper (UC_String)       /= UC_String
263
      then
264
         Report.Failed ("Incorrect result from To_Upper for strings - 2");
265
      end if;
266
 
267
 
268
      if ACH.To_Upper (LC_Special_String) /= UC_Special_String then
269
         Report.Failed ("Incorrect result from To_Upper for strings - 3");
270
      end if;
271
 
272
 
273
 
274
      -- Function To_Basic for Strings
275
 
276
 
277
      if (ACH.To_Basic (LC_String) /= "azac") or
278
         (ACH.To_Basic (UC_String) /= "AZAC")
279
      then
280
         Report.Failed ("Incorrect result from To_Basic for Strings - 1");
281
      end if;
282
 
283
 
284
      if ACH.To_Basic (LC_NonBasic_String) /= LC_Basic_String then
285
         Report.Failed ("Incorrect result from To_Basic for Strings - 2");
286
      end if;
287
 
288
 
289
      if ACH.To_Basic (UC_NonBasic_String) /= UC_Basic_String then
290
         Report.Failed ("Incorrect result from To_Basic for Strings - 3");
291
      end if;
292
 
293
 
294
      -- Using Functions (for Strings) in Combination
295
 
296
 
297
      if ACH.To_Upper(ACH.To_Lower(UC_Basic_String)) /= UC_Basic_String or
298
         ACH.To_Lower(ACH.To_Upper(LC_Basic_String)) /= LC_Basic_String
299
      then
300
         Report.Failed ("Incorrect operation of functions in combination - 4");
301
      end if;
302
 
303
 
304
      if (ACH.To_Basic(ACH.To_Lower(UC_NonBasic_String)) /= LC_Basic_String) or
305
         (ACH.To_Basic(ACH.To_Upper(LC_NonBasic_String)) /= UC_Basic_String)
306
      then
307
         Report.Failed ("Incorrect operation of functions in combination - 5");
308
      end if;
309
 
310
 
311
   exception
312
      when others => Report.Failed ("Exception raised in String_Block");
313
   end String_Block;
314
 
315
 
316
   Report.Result;
317
 
318
end CXA3002;

powered by: WebSVN 2.1.0

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