3 -- Grant of Unlimited Rights
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
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.
27 -- Check that Function Image produces correct results when provided
28 -- non-default parameters for Currency, Fill, Separator, and
29 -- Radix_Mark at either the time of package Decimal_Output instantiation,
30 -- or in a call to Image. Check non-default parameters that are
31 -- appropriate for foreign currency representations.
34 -- This test is structured using tables of data, consisting of
35 -- numerical values, picture strings, and expected image
36 -- result strings. These data tables are found in package FXF3A00.
38 -- The results of the Image function, resulting from several different
39 -- instantiations of Decimal_Output, are compared with expected
40 -- edited output string results. The primary focus of this test is to
41 -- examine the effect of non-default parameters, provided during the
42 -- instantiation of package Decimal_Output, or provided as part of a
43 -- call to Function Image (that resulted from an instantiation of
44 -- Decimal_Output that used default parameters). The non-default
45 -- parameters provided correspond to foreign currency representations.
47 -- For each picture string/decimal data combination examined, two
48 -- evaluations of Image are performed. These correspond to the two
49 -- methods of providing the appropriate non-default parameters described
50 -- above. Both forms of Function Image should produce the same expected
51 -- edited output string.
54 -- The following files comprise this test:
56 -- FXF3A00.A (foundation code)
61 -- 26 JAN 95 SAIC Initial prerelease version.
62 -- 17 FEB 97 PWB.CTA Correct array indices for Foreign_Strings array
67 with Ada
.Text_IO
.Editing
;
73 Report
.Test
("CXF3A05", "Check that Function Image produces " &
74 "correct results when provided non-default " &
75 "parameters for Currency, Fill, Separator, " &
76 "and Radix_Mark, appropriate to foreign " &
77 "currency representations");
84 -- Instantiate the Decimal_Output generic package for the several
85 -- combinations of Default_Currency, Default_Fill, Default_Separator,
86 -- and Default_Radix_Mark.
88 package Pack_Def
is -- Uses default parameter values.
89 new Editing
.Decimal_Output
(FXF3A00
.Decimal_Type_2DP
);
92 new Editing
.Decimal_Output
(FXF3A00
.Decimal_Type_2DP
,
93 Default_Currency
=> "FF",
95 Default_Separator
=> '.',
96 Default_Radix_Mark
=> ',');
99 new Editing
.Decimal_Output
(FXF3A00
.Decimal_Type_2DP
,
100 Default_Currency
=> "DM",
102 Default_Separator
=> ',',
103 Default_Radix_Mark
=> '.');
106 new Editing
.Decimal_Output
(FXF3A00
.Decimal_Type_2DP
,
107 Default_Currency
=> "CHF",
109 Default_Separator
=> ',',
110 Default_Radix_Mark
=> '.');
113 TC_Picture
: Editing
.Picture
;
114 TC_Start_Loop
: constant := 11;
115 TC_End_Loop
: constant := TC_Start_Loop
+ -- 20
116 FXF3A00
.Number_Of_Foreign_Strings
- 1;
120 -- In the case of each particular type of foreign string examined,
121 -- two versions of Function Image are examined. First, a version of
122 -- the function that originated from an instantiation of Decimal_Output
123 -- with non-default parameters is checked. This version of Image is
124 -- called making use of default parameters in the actual function call.
125 -- In addition, a version of Function Image is checked that resulted
126 -- from an instantiation of Decimal_Output using default parameters,
127 -- but which uses non-default parameters in the function call.
129 for i
in TC_Start_Loop
..TC_End_Loop
loop
131 -- Create the picture object from the picture string.
133 TC_Picture
:= Editing
.To_Picture
134 (FXF3A00
.Foreign_Strings
(i
- TC_Start_Loop
+ 1).all);
136 -- Based on the ordering of the specific foreign picture strings
137 -- in the FXF3A00.Foreign_Strings table, the following conditional
138 -- is used to determine which type of currency is being examined
139 -- as the loop executes.
141 if i
< TC_Start_Loop
+ FXF3A00
.Number_Of_FF_Strings
then -- (11-14)
142 -- Process the FF picture strings.
144 -- Check the result of Function Image from an instantiation
145 -- of Decimal_Output that provided non-default actual
146 -- parameters at the time of package instantiation, and uses
147 -- default parameters in the call of Image.
149 if Pack_FF
.Image
(Item
=> FXF3A00
.Data_With_2DP
(i
),
150 Pic
=> TC_Picture
) /=
151 FXF3A00
.Edited_Output
(i
).all
153 Report
.Failed
("Incorrect output from Function Image " &
154 "from package instantiated with FF " &
155 "related parameters, using picture string " &
156 FXF3A00
.Foreign_Strings
157 (i
- TC_Start_Loop
+ 1).all);
160 -- Check the result of Function Image that originated from
161 -- an instantiation of Decimal_Output where default parameters
162 -- were used at the time of package Instantiation, but where
163 -- non-default parameters are provided in the call of Image.
165 if Pack_Def
.Image
(Item
=> FXF3A00
.Data_With_2DP
(i
),
170 Radix_Mark
=> ',') /=
171 FXF3A00
.Edited_Output
(i
).all
173 Report
.Failed
("Incorrect output from Function Image " &
174 "from package instantiated with default " &
175 "parameters, using picture string " &
176 FXF3A00
.Foreign_Strings
177 (i
- TC_Start_Loop
+ 1).all &
178 ", and FF related parameters in call to Image");
182 elsif i
< TC_Start_Loop
+ -- (15-19)
183 FXF3A00
.Number_Of_FF_Strings
+
184 FXF3A00
.Number_Of_DM_Strings
then
185 -- Process the DM picture strings.
187 -- Non-default instantiation parameters, default function call
190 if Pack_DM
.Image
(Item
=> FXF3A00
.Data_With_2DP
(i
),
191 Pic
=> TC_Picture
) /=
192 FXF3A00
.Edited_Output
(i
).all
194 Report
.Failed
("Incorrect output from Function Image " &
195 "from package instantiated with DM " &
196 "related parameters, using picture string " &
197 FXF3A00
.Foreign_Strings
198 (i
- TC_Start_Loop
+ 1).all);
201 -- Default instantiation parameters, non-default function call
204 if Pack_Def
.Image
(Item
=> FXF3A00
.Data_With_2DP
(i
),
209 Radix_Mark
=> '.') /=
210 FXF3A00
.Edited_Output
(i
).all
212 Report
.Failed
("Incorrect output from Function Image " &
213 "from package instantiated with default " &
214 "parameters, using picture string " &
215 FXF3A00
.Foreign_Strings
216 (i
- TC_Start_Loop
+ 1).all &
217 ", and DM related parameters in call to Image");
222 -- Process the CHF string.
224 -- Non-default instantiation parameters, default function call
227 if Pack_CHF
.Image
(FXF3A00
.Data_With_2DP
(i
), TC_Picture
) /=
228 FXF3A00
.Edited_Output
(i
).all
230 Report
.Failed
("Incorrect output from Function Image " &
231 "from package instantiated with CHF " &
232 "related parameters, using picture string " &
233 FXF3A00
.Foreign_Strings
234 (i
- TC_Start_Loop
+ 1).all);
237 -- Default instantiation parameters, non-default function call
240 if Pack_Def
.Image
(FXF3A00
.Data_With_2DP
(i
),
246 FXF3A00
.Edited_Output
(i
).all
248 Report
.Failed
("Incorrect output from Function Image " &
249 "from package instantiated with default " &
250 "parameters, using picture string " &
251 FXF3A00
.Foreign_Strings
252 (i
- TC_Start_Loop
+ 1).all &
253 ", and CHF related parameters in call to Image");
261 when others => Report
.Failed
("Exception raised in Test_Block");