summaryrefslogtreecommitdiff
path: root/gcc/testsuite/ada/acats/support/fxf3a00.a
blob: 645010ecfccd5f0c52f1eef59d3ed7ac8abc66eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
-- FXF3A00.A
--
--                             Grant of Unlimited Rights
--
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained 
--     unlimited rights in the software and documentation contained herein.
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making 
--     this public release, the Government intends to confer upon all 
--     recipients unlimited rights  equal to those held by the Government.  
--     These rights include rights to use, duplicate, release or disclose the 
--     released technical data and computer software in whole or in part, in 
--     any manner and for any purpose whatsoever, and to have or permit others 
--     to do so.
--
--                                    DISCLAIMER
--
--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED 
--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE 
--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--     PARTICULAR PURPOSE OF SAID MATERIAL.
--*
--
-- FOUNDATION DESCRIPTION:
--      This foundation contains decimal data values, valid and invalid
--      Picture strings, and Edited Output result strings that will be used
--      in tests of Appendix F.3.
--      Note:  In this foundation package, the effect of "Table Driven Data"
--      is achieved using a series of arrays to hold the various data items.
--      Since the data items (Picture strings, Edited Output) are often of
--      different lengths, the arrays are defined to contain pointers to 
--      string values, thereby allowing the "tables" to hold string data of
--      different sizes.
--
-- CHANGE HISTORY:
--      06 Dec 94   SAIC    ACVC 2.0
--      15 Feb 95   SAIC    Picture string, decimal data, and edited_output
--                          modifications.
--      23 Feb 95   SAIC    Picture string modification.
--      10 Mar 95   SAIC    Added explanatory comments.
--      15 Nov 95   SAIC    Corrected picture string for ACVC 2.0.1.
--      06 Oct 96   SAIC    Corrected invalid picture strings.
--      13 Feb 97   PWB.CTA Deleted invalid picture string.
--      17 Feb 97   PWB.CTA Added leading blank to two picture strings
--!

with Ada.Text_IO.Editing;

package FXF3A00 is

   Number_Of_NDP_Items            : constant :=  12; -- No Decimal Places.
   Number_Of_2DP_Items            : constant :=  20; -- Two Decimal Places.
   Number_Of_Valid_Strings        : constant :=  40;
   Number_Of_FF_Strings           : constant :=   4; -- French Francs
   Number_Of_DM_Strings           : constant :=   5; -- Deutchemarks
   Number_Of_CHF_Strings          : constant :=   1; -- Swiss Francs
   Number_Of_Foreign_Strings      : constant :=   Number_Of_FF_Strings +
                                                  Number_Of_DM_Strings +
                                                  Number_Of_CHF_Strings; 
   Number_Of_Invalid_Strings       : constant :=  25;
   Number_Of_Erroneous_Conditions  : constant :=   3;
   Number_Of_Edited_Output_Strings : constant :=  32;

   -- The following string is to be used as a picture string with length 
   -- beyond the maximum (Max_Picture_Length) that is supported by the 
   -- implementation.  

   A_Picture_String_Too_Long       : constant 
     String (1..Ada.Text_IO.Editing.Max_Picture_Length + 1) := (others => '9');


   type Str_Ptr is access String;

   type Decimal_Type_NDP is delta 1.0  digits 16;  -- no decimal places
   type Decimal_Type_2DP is delta 0.01 digits 16;  -- two decimal places

   type Data_Array_Type_1 is array (Integer range <>) of Decimal_Type_NDP;
   type Data_Array_Type_2 is array (Integer range <>) of Decimal_Type_2DP;


   type Picture_String_Array_Type        is 
     array (Integer range <>) of Str_Ptr;

   type Edited_Output_Results_Array_Type is 
     array (Integer range <>) of Str_Ptr;



  Data_With_NDP : Data_Array_Type_1 (1..Number_Of_NDP_Items) := 
                     ( 1 => 1234.0,
                       2 => 51234.0,
                       3 => -1234.0,
                       4 => 1234.0,
                       5 => 1.0,
                       6 => 0.0,
                       7 => -10.0,
                       8 => -1.0,
                       9 => 1234.0,
                      10 => 1.0,
                      11 => 36.0,
                      12 => 0.0
                     );


   Data_With_2DP : Data_Array_Type_2 (1..Number_Of_2DP_Items) := 
                     ( 1 => 123456.78,
                       2 => 123456.78,
                       3 => 0.0,
                       4 => 0.20,
                       5 => 123456.00,
                       6 => -123456.78,
                       7 => 123456.78,
                       8 => -12.34,
                       9 => 1.23,
                      10 => 12.34,

        -- Items 11-20 are used with picture strings in evaluating use of
        -- foreign currency symbols.

                      11 => 123456.78,
                      12 => 123456.78,
                      13 => 32.10,
                      14 => -5432.10,
                      15 => -1234.57,
                      16 => 123456.78,
                      17 => 12.34,
                      18 => 12.34,
                      19 => 1.23,
                      20 => 12345.67
                     );



   Valid_Strings   : Picture_String_Array_Type 
                       (1..Number_Of_Valid_Strings) := 

        -- Items 1-10 are used in conjunction with Data_With_2DP values
        -- to produce edited output strings, as well as in tests of
        -- function Valid.

                       ( 1 => new String'("-###**_***_**9.99"),
                         2 => new String'("-$**_***_**9.99"),
                         3 => new String'("-$$$$$$.$$"),
                         4 => new String'("-$$$$$$.$$"),
                         5 => new String'("+BBBZZ_ZZZ_ZZZ.ZZ"),
                         6 => new String'("--_---_---_--9"),
                         7 => new String'("-$_$$$_$$$_$$9.99"),
                         8 => new String'("<$$_$$$9.99>"),
                         9 => new String'("$_$$9.99"),
                        10 => new String'("$$9.99"),

        -- Items 11-22 are used in conjunction with Data_With_NDP values
        -- to produce edited output strings.

                        11 => new String'("ZZZZ9"),
                        12 => new String'("ZZZZ9"),
                        13 => new String'("<#Z_ZZ9>"),
                        14 => new String'("<#Z_ZZ9>"),
                        15 => new String'("ZZZ.ZZ"),
                        16 => new String'("ZZZ.ZZ"),
                        17 => new String'("<###99>"),
                        18 => new String'("ZZZZZ-"),
                        19 => new String'("$$$$9"),
                        20 => new String'("$$$$$"),
                        21 => new String'("<###99>"),
                        22 => new String'("$$$$9"),

        -- Items 23-40 are used in validation of the Valid, To_Picture, and
        -- Pic_String subprograms of package Text_IO.Editing, and are not
        -- used to generate edited output.

                        23 => new String'("zZzZzZzZzZzZzZzZzZ"),
                        24 => new String'("999999999999999999"),
                        25 => new String'("******************"),
                        26 => new String'("$$$$$$$$$$$$$$$$$$"),
                        27 => new String'("9999/9999B9999_999909999"),
                        28 => new String'("+999999999999999999"),
                        29 => new String'("-999999999999999999"),
                        30 => new String'("999999999999999999+"),
                        31 => new String'("999999999999999999-"),
                        32 => new String'("<<<_<<<_<<<_<<<_<<<_<<9>"),
                        33 => new String'("++++++++++++++++++++"),
                        34 => new String'("--------------------"),
                        35 => new String'("zZzZzZzZzZzZzZzZzZ.zZ"),
                        36 => new String'("******************.99"),
                        37 => new String'("$$$$$$$$$$$$$$$$$$.99"),

       -- The following string has length 30, which is the minimum value 
       -- that must be supported for Max_Picture_Length.

                        38 => new String'("9_999_999_999_999_999_999BB.99"),
                        39 => new String'("<<<_<<<_<<<_<<<.99>"),
                        40 => new String'("ZZZZZZZZZZZZZZZZZ+")
                       );



   Foreign_Strings : Picture_String_Array_Type 
                       (1..Number_Of_Foreign_Strings) :=

       -- These strings are going to be used in conjunction with non-default
       -- values for Currency string, Radix mark, and Separator in calls to
       -- Image and Put, as well as in tests of function Valid.

                       ( 1 => new String'("-###**_***_**9.99"),    -- FF
                         2 => new String'("-$**_***_**9.99"),      -- FF
                         3 => new String'("<###z_ZZ9.99>"),        -- FF
                         4 => new String'("<###Z_ZZ9.99>"),        -- FF
                         5 => new String'("<<<<_<<<.<<###>"),      -- DM
                         6 => new String'("-$_$$$_$$$_$$9.99"),    -- DM
                         7 => new String'("$z99.99"),              -- DM
                         8 => new String'("$$$9.99"),              -- DM
                         9 => new String'("$_$$9.99"),             -- DM
                        10 => new String'("###_###_##9.99")        -- CHF
                       );



   Invalid_Strings : Picture_String_Array_Type 
                       (1..Number_Of_Invalid_Strings) := 
       --
       -- The RM references to the right of these invalid picture strings
       -- indicates which of the composition constraints of picture strings
       -- is violated by the particular string (and all following strings
       -- until another reference is presented).  However, certain strings
       -- violate multiple of the constraints.
       --
                       ( 1 => new String'("<<<"),        
                         2 => new String'("<<>>"),       
                         3 => new String'("<<<9_B0/$DB"),
                         4 => new String'("+BB"),        
                         5 => new String'("<-"),
                         6 => new String'("<CR"),
                         7 => new String'("<db"),
                         8 => new String'("<<BBBcr"),    
                         9 => new String'("<<__DB"),
                        10 => new String'("<<<++++_++-"),
                        11 => new String'("-999.99>"),   
                        12 => new String'("+++9.99+"),
                        13 => new String'("++++>>"),     
                        14 => new String'("->"),
                        15 => new String'("++9-"),  
                        16 => new String'("---999999->"),
                        17 => new String'("+++-"),       
                        18 => new String'("+++_+++_+.--"),
                        19 => new String'("--B.BB+>"),
                        20 => new String'("$$#$"),       
                        21 => new String'("#B$$$$"),
                        22 => new String'("**Z"),        
                        23 => new String'("ZZZzzz*"),
                        24 => new String'("9.99DB(2)"), 
                        25 => new String'(A_Picture_String_Too_Long)
                       );


   Edited_Output : Edited_Output_Results_Array_Type
                     (1..Number_Of_Edited_Output_Strings) :=   

        -- The following 10 edited output strings result from the first 10
        -- valid strings when used with the first 10 Data_With_2DP numeric 
        -- values.
                           ( 1 => new String'("   $***123,456.78"),
                             2 => new String'(" $***123,456.78"),
                             3 => new String'("          "),
                             4 => new String'("      $.20"),
                             5 => new String'("+      123,456.00"),
                             6 => new String'("      -123,457"),
                             7 => new String'("      $123,456.78"),
                             8 => new String'("(    $12.34)"),
                             9 => new String'("   $1.23"),
                            10 => new String'("$12.34"),

        -- The following 10 edited output strings correspond to the 10 foreign
        -- currency picture strings (the currency string is supplied at the
        -- time of the call to Editing.Image or Editing.Put), when used in
        -- conjunction with Data_With_2DP items 11-20

                            11 => new String'("  FF***123.456,78"),
                            12 => new String'(" FF***123.456,78"),
                            13 => new String'("  FF   32,10 "),
                            14 => new String'("( FF5.432,10)"), 
                            15 => new String'("  (1,234.57DM )"),
                            16 => new String'("      DM123,456.78"), 
                            17 => new String'("DM 12.34"),
                            18 => new String'(" DM12.34"),
                            19 => new String'("   DM1.23"),
                            20 => new String'("  CHF12,345.67"),

        -- The following 12 edited output strings correspond to the 12 
        -- Data_With_NDP items formatted using Valid_String items 11-22.
        -- This combination shows decimal data with no decimal places 
        -- formatted using picture strings.

                            21 => new String'(" 1234"),
                            22 => new String'("51234"),
                            23 => new String'("($1,234)"),
                            24 => new String'(" $1,234 "),
                            25 => new String'("  1.00"),
                            26 => new String'("      "),
                            27 => new String'("(  $10)"),
                            28 => new String'("    1-"),
                            29 => new String'("$1234"),
                            30 => new String'("   $1"),
                            31 => new String'("   $36 "),
                            32 => new String'("   $0")
                           );



   -- The following data is used to create exception situations in tests of
   -- the Edited Output capabilities of package Ada.Text_IO.Editing.  The data
   -- are not themselves erroneous, but will produce exceptions based on the
   -- data/picture string combination used.

   Erroneous_Data : Data_Array_Type_2 (1..Number_Of_Erroneous_Conditions) :=
                     ( 1 => 12.34,
                       2 => -12.34,
                       3 => 51234.0
                     );

   Erroneous_Strings : Picture_String_Array_Type 
                         (1..Number_Of_Erroneous_Conditions) :=
                           ( 1 => new String'("9.99"),
                             2 => new String'("99.99"),
                             3 => new String'("$$$$9")
                           );

end FXF3A00;