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/] [cxf/] [cxf3a05.a] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CXF3A05.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 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.
32
--
33
-- TEST DESCRIPTION:
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.
37
--
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.
46
--
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.
52
--
53
-- TEST FILES:
54
--      The following files comprise this test:
55
--
56
--         FXF3A00.A   (foundation code)
57
--      => CXF3A05.A
58
--
59
--
60
-- CHANGE HISTORY:
61
--      26 JAN 95   SAIC    Initial prerelease version.
62
--      17 FEB 97   PWB.CTA Correct array indices for Foreign_Strings array
63
--                          references.
64
--!
65
 
66
with FXF3A00;
67
with Ada.Text_IO.Editing;
68
with Report;
69
 
70
procedure CXF3A05 is
71
begin
72
 
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");
78
 
79
   Test_Block:
80
   declare
81
 
82
      use Ada.Text_IO;
83
 
84
      -- Instantiate the Decimal_Output generic package for the several
85
      -- combinations of Default_Currency, Default_Fill, Default_Separator,
86
      -- and Default_Radix_Mark.
87
 
88
      package Pack_Def is                   -- Uses default parameter values.
89
        new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP);
90
 
91
      package Pack_FF  is
92
        new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP,
93
                                   Default_Currency   => "FF",
94
                                   Default_Fill       => '*',
95
                                   Default_Separator  => '.',
96
                                   Default_Radix_Mark => ',');
97
 
98
      package Pack_DM  is
99
        new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP,
100
                                   Default_Currency   => "DM",
101
                                   Default_Fill       => '*',
102
                                   Default_Separator  => ',',
103
                                   Default_Radix_Mark => '.');
104
 
105
      package Pack_CHF  is
106
        new Editing.Decimal_Output(FXF3A00.Decimal_Type_2DP,
107
                                   Default_Currency   => "CHF",
108
                                   Default_Fill       => '*',
109
                                   Default_Separator  => ',',
110
                                   Default_Radix_Mark => '.');
111
 
112
 
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;
117
 
118
   begin
119
 
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.
128
 
129
      for i in TC_Start_Loop..TC_End_Loop loop
130
 
131
         -- Create the picture object from the picture string.
132
 
133
         TC_Picture := Editing.To_Picture
134
                         (FXF3A00.Foreign_Strings(i - TC_Start_Loop + 1).all);
135
 
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.
140
 
141
         if i < TC_Start_Loop + FXF3A00.Number_Of_FF_Strings then -- (11-14)
142
            -- Process the FF picture strings.
143
 
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.
148
 
149
            if Pack_FF.Image(Item => FXF3A00.Data_With_2DP(i),
150
                             Pic  => TC_Picture)  /=
151
               FXF3A00.Edited_Output(i).all
152
            then
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);
158
            end if;
159
 
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.
164
 
165
            if Pack_Def.Image(Item       => FXF3A00.Data_With_2DP(i),
166
                              Pic        => TC_Picture,
167
                              Currency   => "FF",
168
                              Fill       => '*',
169
                              Separator  => '.',
170
                              Radix_Mark => ',')  /=
171
               FXF3A00.Edited_Output(i).all
172
            then
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");
179
            end if;
180
 
181
 
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.
186
 
187
            -- Non-default instantiation parameters, default function call
188
            -- parameters.
189
 
190
            if Pack_DM.Image(Item => FXF3A00.Data_With_2DP(i),
191
                             Pic  => TC_Picture)  /=
192
               FXF3A00.Edited_Output(i).all
193
            then
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);
199
            end if;
200
 
201
            -- Default instantiation parameters, non-default function call
202
            -- parameters.
203
 
204
            if Pack_Def.Image(Item       => FXF3A00.Data_With_2DP(i),
205
                              Pic        => TC_Picture,
206
                              Currency   => "DM",
207
                              Fill       => '*',
208
                              Separator  => ',',
209
                              Radix_Mark => '.')  /=
210
               FXF3A00.Edited_Output(i).all
211
            then
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");
218
            end if;
219
 
220
 
221
         else                                                     -- (i=20)
222
            -- Process the CHF string.
223
 
224
            -- Non-default instantiation parameters, default function call
225
            -- parameters.
226
 
227
            if Pack_CHF.Image(FXF3A00.Data_With_2DP(i), TC_Picture)  /=
228
               FXF3A00.Edited_Output(i).all
229
            then
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);
235
            end if;
236
 
237
            -- Default instantiation parameters, non-default function call
238
            -- parameters.
239
 
240
            if Pack_Def.Image(FXF3A00.Data_With_2DP(i),
241
                              TC_Picture,
242
                              "CHF",
243
                              '*',
244
                              ',',
245
                              '.')  /=
246
               FXF3A00.Edited_Output(i).all
247
            then
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");
254
            end if;
255
 
256
         end if;
257
 
258
      end loop;
259
 
260
   exception
261
      when others => Report.Failed ("Exception raised in Test_Block");
262
   end Test_Block;
263
 
264
   Report.Result;
265
 
266
end CXF3A05;

powered by: WebSVN 2.1.0

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