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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cxf/] [cxf2001.a] - Blame information for rev 720

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- CXF2001.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 Divide procedure provides the following results:
28
--        Quotient = Dividend divided by Divisor  and
29
--        Remainder = Dividend - (Divisor * Quotient)
30
--      Check that the Remainder is calculated exactly.
31
--
32
-- TEST DESCRIPTION:
33
--      This test is designed to test the generic procedure Divide found in
34
--      package Ada.Decimal.
35
--
36
--      The table below attempts to portray the design approach used in this
37
--      test.  There are three "dimensions" of concern:
38
--        1) the delta value of the Quotient and Remainder types, shown as
39
--           column headers,
40
--        2) specific choices for the Dividend and Divisor numerical values
41
--           (i.e., whether they yielded a repeating/non-terminating result,
42
--            or a terminating result ["exact"]), displayed on the left side
43
--            of the tables, and
44
--        3) the delta for the Dividend and Divisor.
45
--
46
--      Each row in the tables indicates a specific test case, showing the
47
--      specific quotient and remainder (under the appropriate Delta column)
48
--      for each combination of dividend and divisor values.  Test cases
49
--      follow the top-to-bottom sequence shown in the tables.
50
--
51
--      Most of the test case sets (same dividend/divisor combinations -
52
--      indicated by dashed horizontal lines in the tables) vary the
53
--      delta of the quotient and remainder types between test cases. This
54
--      allows for an examination of how different deltas for a quotient
55
--      and/or remainder type can influence the results of a division with
56
--      identical dividend and divisor.
57
--
58
--      Note: Test cases are performed for both Radix 10 and Radix 2 types.
59
--
60
--
61
--  Divid  Divis    Delta     Delta       Delta       Delta       Delta
62
-- (Delta)(Delta)|  .1   |    .01    |   .001    |   .0001   |  .00001   |Test
63
--               |---|---|-----|-----|-----|-----|-----|-----|-----|-----|Case
64
--    quotient   | Q | R |  Q  |  R  |  Q  |  R  |  Q  |  R  |  Q  |  R  | No.
65
-- ---------------------------------------------------------------------------
66
--  .05     .3   |.1             .02                                       1,21
67
-- (.01)   (.1)  |.1   0                                                   2,22
68
--               |         .16               .002                          3,23
69
--   0.166666..  |         .16   .00                                       4,24
70
--               |                     .166             .0002              5,25
71
-- ---------------------------------------------------------------------------
72
--  .15     20   |         .00                          .1500              6,26
73
-- (.01)    (1)  |         .00               .150                          7,27
74
--               |         .00   .15                                       8,28
75
--   0.0075      |               .01   .007                                9,29
76
--               |                     .007  .010                         10,30
77
--               |                                .0075 .0000             11,31
78
-- ---------------------------------------------------------------------------
79
--  .03125   .5  |                                .0625 .0000             12,32
80
-- (.00001) (.1) |                     .062                        .00025 13,33
81
--               |                     .062             .0002             14,34
82
--   0.0625      |                     .062  .000                         15,35
83
--               |               .00   .062                               16,36
84
--               |         .06                                     .00125 17,37
85
--               |         .06                          .0012             18,38
86
--               |         .06               .001                         19,39
87
--               |         .06   .00                                      20,40
88
-- ---------------------------------------------------------------------------
89
-- Divide by Zero| Raise Constraint_Error                                 41
90
-- ---------------------------------------------------------------------------
91
--
92
--
93
-- CHANGE HISTORY:
94
--      06 Dec 94   SAIC    ACVC 2.0
95
--      29 Dec 94   SAIC    Modified Radix 2 cases to match Radix 10 cases.
96
--      03 Oct 95   RBKD    Modified to fix incorrect remainder results
97
--      15 Nov 95   SAIC    Incorporated reviewer fixes for ACVC 2.0.1.
98
--
99
--!
100
 
101
with Report;
102
with Ada.Decimal;
103
 
104
procedure CXF2001 is
105
 
106
   TC_Verbose : Boolean := False;
107
 
108
begin
109
 
110
   Report.Test ("CXF2001", "Check that the Divide procedure provides "  &
111
                           "correct results. Check that the Remainder " &
112
                           "is calculated exactly");
113
   Radix_10_Block:
114
   declare
115
 
116
 
117
      -- Declare all types and variables used in the various blocks below
118
      -- for all Radix 10 evaluations.
119
 
120
      type DT_1       is delta 1.0     digits 5;
121
      type DT_0_1     is delta 0.1     digits 10;
122
      type DT_0_01    is delta 0.01    digits 10;
123
      type DT_0_001   is delta 0.001   digits 10;
124
      type DT_0_0001  is delta 0.0001  digits 10;
125
      type DT_0_00001 is delta 0.00001 digits 10;
126
 
127
      for DT_1'Machine_Radix       use 10;
128
      for DT_0_1'Machine_Radix     use 10;
129
      for DT_0_01'Machine_Radix    use 10;
130
      for DT_0_001'Machine_Radix   use 10;
131
      for DT_0_0001'Machine_Radix  use 10;
132
      for DT_0_00001'Machine_Radix use 10;
133
 
134
      Dd_1,       Dv_1,       Quot_1,       Rem_1       : DT_1       := 0.0;
135
      Dd_0_1,     Dv_0_1,     Quot_0_1,     Rem_0_1     : DT_0_1     := 0.0;
136
      Dd_0_01,    Dv_0_01,    Quot_0_01,    Rem_0_01    : DT_0_01    := 0.0;
137
      Dd_0_001,   Dv_0_001,   Quot_0_001,   Rem_0_001   : DT_0_001   := 0.0;
138
      Dd_0_0001,  Dv_0_0001,  Quot_0_0001,  Rem_0_0001  : DT_0_0001  := 0.0;
139
      Dd_0_00001, Dv_0_00001, Quot_0_00001, Rem_0_00001 : DT_0_00001 := 0.0;
140
 
141
   begin
142
 
143
 
144
      declare
145
         procedure Div is
146
            new Ada.Decimal.Divide(Dividend_Type  => DT_0_01,
147
                                   Divisor_Type   => DT_0_1,
148
                                   Quotient_Type  => DT_0_1,
149
                                   Remainder_Type => DT_0_01);
150
      begin
151
         if TC_Verbose then Report.Comment("Case 1"); end if;
152
         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);
153
         Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_01);
154
         if Quot_0_1 /= DT_0_1(0.1)  or  Rem_0_01 /= DT_0_01(0.02) then
155
            Report.Failed("Incorrect values returned, Case 1");
156
         end if;
157
      end;
158
 
159
 
160
      declare
161
         procedure Div is
162
            new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_1, DT_0_1);
163
      begin
164
         if TC_Verbose then Report.Comment("Case 2"); end if;
165
         Dd_0_01 := DT_0_01(0.05);   Dv_0_1 := DT_0_1(0.3);
166
         Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_1);
167
         if Quot_0_1 /= DT_0_1(0.1) or  Rem_0_1 /= DT_0_1(0.0) then
168
            Report.Failed("Incorrect values returned, Case 2");
169
         end if;
170
      end;
171
 
172
 
173
      declare
174
         procedure Div is
175
            new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_001);
176
      begin
177
         if TC_Verbose then Report.Comment("Case 3"); end if;
178
         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);
179
         Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_001);
180
         if Quot_0_01 /= DT_0_01(0.16) or  Rem_0_001 /= DT_0_001(0.002) then
181
            Report.Failed("Incorrect values returned, Case 3");
182
         end if;
183
      end;
184
 
185
 
186
      declare
187
         procedure Div is
188
            new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_01);
189
      begin
190
         if TC_Verbose then Report.Comment("Case 4"); end if;
191
         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);
192
         Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_01);
193
         if Quot_0_01 /= DT_0_01(0.16) or  Rem_0_01 /= DT_0_01(0.0) then
194
            Report.Failed("Incorrect values returned, Case 4");
195
         end if;
196
      end;
197
 
198
 
199
      declare
200
         procedure Div is
201
            new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_001, DT_0_0001);
202
      begin
203
         if TC_Verbose then Report.Comment("Case 5"); end if;
204
         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);
205
         Div(Dd_0_01, Dv_0_1, Quot_0_001, Rem_0_0001);
206
         if Quot_0_001 /= DT_0_001(0.166)   or
207
            Rem_0_0001 /= DT_0_0001(0.0002)
208
         then
209
            Report.Failed("Incorrect values returned, Case 5");
210
         end if;
211
      end;
212
 
213
 
214
      declare
215
         procedure Div is
216
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_0001);
217
      begin
218
         if TC_Verbose then Report.Comment("Case 6"); end if;
219
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
220
         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_0001);
221
         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_0001 /= DT_0_0001(0.1500) then
222
            Report.Failed("Incorrect values returned, Case 6");
223
         end if;
224
      end;
225
 
226
 
227
      declare
228
         procedure Div is
229
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_001);
230
      begin
231
         if TC_Verbose then Report.Comment("Case 7"); end if;
232
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
233
         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_001);
234
         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_001 /= DT_0_001(0.150) then
235
            Report.Failed("Incorrect values returned, Case 7");
236
         end if;
237
      end;
238
 
239
 
240
      declare
241
         procedure Div is
242
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_01);
243
      begin
244
         if TC_Verbose then Report.Comment("Case 8"); end if;
245
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
246
         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_01);
247
         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_01 /= DT_0_01(0.15) then
248
            Report.Failed("Incorrect values returned, Case 8");
249
         end if;
250
      end;
251
 
252
 
253
      declare
254
         procedure Div is
255
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_001);
256
      begin
257
         if TC_Verbose then Report.Comment("Case 9"); end if;
258
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
259
         Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_001);
260
         if Quot_0_001 /= DT_0_001(0.007) or  Rem_0_001 /= DT_0_001(0.01) then
261
            Report.Failed("Incorrect values returned, Case 9");
262
         end if;
263
      end;
264
 
265
 
266
      declare
267
         procedure Div is
268
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_01);
269
      begin
270
         if TC_Verbose then Report.Comment("Case 10"); end if;
271
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
272
         Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_01);
273
         if Quot_0_001 /= DT_0_001(0.007) or  Rem_0_01 /= DT_0_01(0.01) then
274
            Report.Failed("Incorrect values returned, Case 10");
275
         end if;
276
      end;
277
 
278
 
279
      declare
280
         procedure Div is
281
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_0001, DT_0_0001);
282
      begin
283
         if TC_Verbose then Report.Comment("Case 11"); end if;
284
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
285
         Div(Dd_0_01, Dv_1, Quot_0_0001, Rem_0_0001);
286
         if Quot_0_0001 /= DT_0_0001(0.0075) or
287
            Rem_0_0001  /= DT_0_0001(0.0)
288
         then
289
            Report.Failed("Incorrect values returned, Case 11");
290
         end if;
291
      end;
292
 
293
 
294
      declare
295
         procedure Div is
296
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_0001, DT_0_0001);
297
      begin
298
         if TC_Verbose then Report.Comment("Case 12"); end if;
299
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
300
         Div(Dd_0_00001, Dv_0_1, Quot_0_0001, Rem_0_0001);
301
         if Quot_0_0001 /= DT_0_0001(0.0625) or
302
            Rem_0_0001  /= DT_0_0001(0.0)
303
         then
304
            Report.Failed("Incorrect values returned, Case 12");
305
         end if;
306
      end;
307
 
308
 
309
      declare
310
         procedure Div is
311
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_00001);
312
      begin
313
         if TC_Verbose then Report.Comment("Case 13"); end if;
314
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
315
         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_00001);
316
         if Quot_0_001 /= DT_0_001(0.062) or
317
            Rem_0_00001  /= DT_0_00001(0.00025)
318
         then
319
            Report.Failed("Incorrect values returned, Case 13");
320
         end if;
321
      end;
322
 
323
 
324
      declare
325
         procedure Div is
326
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_0001);
327
      begin
328
         if TC_Verbose then Report.Comment("Case 14"); end if;
329
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
330
         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_0001);
331
         if Quot_0_001 /= DT_0_001(0.062) or
332
            Rem_0_0001  /= DT_0_0001(0.0002)
333
         then
334
            Report.Failed("Incorrect values returned, Case 14");
335
         end if;
336
      end;
337
 
338
 
339
      declare
340
         procedure Div is
341
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_001);
342
      begin
343
         if TC_Verbose then Report.Comment("Case 15"); end if;
344
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
345
         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_001);
346
         if Quot_0_001 /= DT_0_001(0.062) or Rem_0_001 /= DT_0_001(0.000)
347
         then
348
            Report.Failed("Incorrect values returned, Case 15");
349
         end if;
350
      end;
351
 
352
 
353
      declare
354
         procedure Div is
355
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_01);
356
      begin
357
         if TC_Verbose then Report.Comment("Case 16"); end if;
358
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
359
         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_01);
360
         if Quot_0_001 /= DT_0_001(0.062) or Rem_0_01 /= DT_0_01(0.00) then
361
            Report.Failed("Incorrect values returned, Case 16");
362
         end if;
363
      end;
364
 
365
 
366
      declare
367
         procedure Div is
368
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_00001);
369
      begin
370
         if TC_Verbose then Report.Comment("Case 17"); end if;
371
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
372
         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_00001);
373
         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_00001 /= DT_0_00001(0.00125)
374
         then
375
            Report.Failed("Incorrect values returned, Case 17");
376
         end if;
377
      end;
378
 
379
 
380
      declare
381
         procedure Div is
382
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_0001);
383
      begin
384
         if TC_Verbose then Report.Comment("Case 18"); end if;
385
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
386
         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_0001);
387
         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_0001 /= DT_0_0001(0.0012)
388
         then
389
            Report.Failed("Incorrect values returned, Case 18");
390
         end if;
391
      end;
392
 
393
 
394
      declare
395
         procedure Div is
396
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_001);
397
      begin
398
         if TC_Verbose then Report.Comment("Case 19"); end if;
399
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
400
         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_001);
401
         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_001 /= DT_0_001(0.001) then
402
            Report.Failed("Incorrect values returned, Case 19");
403
         end if;
404
      end;
405
 
406
 
407
      declare
408
         procedure Div is
409
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_01);
410
      begin
411
         if TC_Verbose then Report.Comment("Case 20"); end if;
412
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
413
         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_01);
414
         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_01 /= DT_0_01(0.0) then
415
            Report.Failed("Incorrect values returned, Case 20");
416
         end if;
417
      end;
418
 
419
 
420
   exception
421
      when others => Report.Failed("Exception raised in Radix_10_Block");
422
   end Radix_10_Block;
423
 
424
 
425
 
426
   Radix_2_Block:
427
   declare
428
 
429
      -- Declare all types and variables used in the various blocks below
430
      -- for all Radix 2 evaluations.
431
 
432
      type DT_1       is delta 1.0     digits 5;
433
      type DT_0_1     is delta 0.1     digits 10;
434
      type DT_0_01    is delta 0.01    digits 10;
435
      type DT_0_001   is delta 0.001   digits 10;
436
      type DT_0_0001  is delta 0.0001  digits 10;
437
      type DT_0_00001 is delta 0.00001 digits 10;
438
 
439
      for DT_1'Machine_Radix       use 2;
440
      for DT_0_1'Machine_Radix     use 2;
441
      for DT_0_01'Machine_Radix    use 2;
442
      for DT_0_001'Machine_Radix   use 2;
443
      for DT_0_0001'Machine_Radix  use 2;
444
      for DT_0_00001'Machine_Radix use 2;
445
 
446
      Dd_1,       Dv_1,       Quot_1,       Rem_1       : DT_1       := 0.0;
447
      Dd_0_1,     Dv_0_1,     Quot_0_1,     Rem_0_1     : DT_0_1     := 0.0;
448
      Dd_0_01,    Dv_0_01,    Quot_0_01,    Rem_0_01    : DT_0_01    := 0.0;
449
      Dd_0_001,   Dv_0_001,   Quot_0_001,   Rem_0_001   : DT_0_001   := 0.0;
450
      Dd_0_0001,  Dv_0_0001,  Quot_0_0001,  Rem_0_0001  : DT_0_0001  := 0.0;
451
      Dd_0_00001, Dv_0_00001, Quot_0_00001, Rem_0_00001 : DT_0_00001 := 0.0;
452
 
453
   begin
454
 
455
 
456
      declare
457
         procedure Div is
458
            new Ada.Decimal.Divide(Dividend_Type  => DT_0_01,
459
                                   Divisor_Type   => DT_0_1,
460
                                   Quotient_Type  => DT_0_1,
461
                                   Remainder_Type => DT_0_01);
462
      begin
463
         if TC_Verbose then Report.Comment("Case 21"); end if;
464
         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);
465
         Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_01);
466
         if Quot_0_1 /= DT_0_1(0.1)  or  Rem_0_01 /= DT_0_01(0.02) then
467
            Report.Failed("Incorrect values returned, Case 21");
468
         end if;
469
      end;
470
 
471
 
472
      declare
473
         procedure Div is
474
            new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_1, DT_0_1);
475
      begin
476
         if TC_Verbose then Report.Comment("Case 22"); end if;
477
         Dd_0_01 := DT_0_01(0.05);   Dv_0_1 := DT_0_1(0.3);
478
         Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_1);
479
         if Quot_0_1 /= DT_0_1(0.1) or  Rem_0_1 /= DT_0_1(0.0) then
480
            Report.Failed("Incorrect values returned, Case 22");
481
         end if;
482
      end;
483
 
484
 
485
      declare
486
         procedure Div is
487
            new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_001);
488
      begin
489
         if TC_Verbose then Report.Comment("Case 23"); end if;
490
         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);
491
         Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_001);
492
         if Quot_0_01 /= DT_0_01(0.16) or  Rem_0_001 /= DT_0_001(0.002) then
493
            Report.Failed("Incorrect values returned, Case 23");
494
         end if;
495
      end;
496
 
497
 
498
      declare
499
         procedure Div is
500
            new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_01);
501
      begin
502
         if TC_Verbose then Report.Comment("Case 24"); end if;
503
         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);
504
         Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_01);
505
         if Quot_0_01 /= DT_0_01(0.16) or  Rem_0_01 /= DT_0_01(0.0) then
506
            Report.Failed("Incorrect values returned, Case 24");
507
         end if;
508
      end;
509
 
510
 
511
      declare
512
         procedure Div is
513
            new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_001, DT_0_0001);
514
      begin
515
         if TC_Verbose then Report.Comment("Case 25"); end if;
516
         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);
517
         Div(Dd_0_01, Dv_0_1, Quot_0_001, Rem_0_0001);
518
         if Quot_0_001 /= DT_0_001(0.166)   or
519
            Rem_0_0001 /= DT_0_0001(0.0002)
520
         then
521
            Report.Failed("Incorrect values returned, Case 25");
522
         end if;
523
      end;
524
 
525
 
526
      declare
527
         procedure Div is
528
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_0001);
529
      begin
530
         if TC_Verbose then Report.Comment("Case 26"); end if;
531
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
532
         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_0001);
533
         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_0001 /= DT_0_0001(0.1500) then
534
            Report.Failed("Incorrect values returned, Case 26");
535
         end if;
536
      end;
537
 
538
 
539
      declare
540
         procedure Div is
541
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_001);
542
      begin
543
         if TC_Verbose then Report.Comment("Case 27"); end if;
544
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
545
         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_001);
546
         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_001 /= DT_0_001(0.150) then
547
            Report.Failed("Incorrect values returned, Case 27");
548
         end if;
549
      end;
550
 
551
 
552
      declare
553
         procedure Div is
554
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_01);
555
      begin
556
         if TC_Verbose then Report.Comment("Case 28"); end if;
557
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
558
         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_01);
559
         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_01 /= DT_0_01(0.15) then
560
            Report.Failed("Incorrect values returned, Case 28");
561
         end if;
562
      end;
563
 
564
 
565
      declare
566
         procedure Div is
567
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_001);
568
      begin
569
         if TC_Verbose then Report.Comment("Case 29"); end if;
570
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
571
         Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_001);
572
         if Quot_0_001 /= DT_0_001(0.007) or  Rem_0_001 /= DT_0_001(0.01) then
573
            Report.Failed("Incorrect values returned, Case 29");
574
         end if;
575
      end;
576
 
577
 
578
      declare
579
         procedure Div is
580
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_01);
581
      begin
582
         if TC_Verbose then Report.Comment("Case 30"); end if;
583
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
584
         Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_01);
585
         if Quot_0_001 /= DT_0_001(0.007) or  Rem_0_01 /= DT_0_01(0.01) then
586
            Report.Failed("Incorrect values returned, Case 30");
587
         end if;
588
      end;
589
 
590
 
591
      declare
592
         procedure Div is
593
            new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_0001, DT_0_0001);
594
      begin
595
         if TC_Verbose then Report.Comment("Case 31"); end if;
596
         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);
597
         Div(Dd_0_01, Dv_1, Quot_0_0001, Rem_0_0001);
598
         if Quot_0_0001 /= DT_0_0001(0.0075) or
599
            Rem_0_0001  /= DT_0_0001(0.0)
600
         then
601
            Report.Failed("Incorrect values returned, Case 31");
602
         end if;
603
      end;
604
 
605
 
606
      declare
607
         procedure Div is
608
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_0001, DT_0_0001);
609
      begin
610
         if TC_Verbose then Report.Comment("Case 32"); end if;
611
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
612
         Div(Dd_0_00001, Dv_0_1, Quot_0_0001, Rem_0_0001);
613
         if Quot_0_0001 /= DT_0_0001(0.0625) or
614
            Rem_0_0001  /= DT_0_0001(0.0)
615
         then
616
            Report.Failed("Incorrect values returned, Case 32");
617
         end if;
618
      end;
619
 
620
 
621
      declare
622
         procedure Div is
623
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_00001);
624
      begin
625
         if TC_Verbose then Report.Comment("Case 33"); end if;
626
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
627
         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_00001);
628
         if Quot_0_001 /= DT_0_001(0.062) or
629
            Rem_0_00001  /= DT_0_00001(0.00025)
630
         then
631
            Report.Failed("Incorrect values returned, Case 33");
632
         end if;
633
      end;
634
 
635
 
636
      declare
637
         procedure Div is
638
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_0001);
639
      begin
640
         if TC_Verbose then Report.Comment("Case 34"); end if;
641
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
642
         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_0001);
643
         if Quot_0_001 /= DT_0_001(0.062) or
644
            Rem_0_0001  /= DT_0_0001(0.0002)
645
         then
646
            Report.Failed("Incorrect values returned, Case 34");
647
         end if;
648
      end;
649
 
650
 
651
      declare
652
         procedure Div is
653
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_001);
654
      begin
655
         if TC_Verbose then Report.Comment("Case 35"); end if;
656
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
657
         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_001);
658
         if Quot_0_001 /= DT_0_001(0.062) or Rem_0_001 /= DT_0_001(0.000)
659
         then
660
            Report.Failed("Incorrect values returned, Case 35");
661
         end if;
662
      end;
663
 
664
 
665
      declare
666
         procedure Div is
667
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_01);
668
      begin
669
         if TC_Verbose then Report.Comment("Case 36"); end if;
670
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
671
         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_01);
672
         if Quot_0_001 /= DT_0_001(0.062) or Rem_0_01 /= DT_0_01(0.00) then
673
            Report.Failed("Incorrect values returned, Case 36");
674
         end if;
675
      end;
676
 
677
 
678
      declare
679
         procedure Div is
680
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_00001);
681
      begin
682
         if TC_Verbose then Report.Comment("Case 37"); end if;
683
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
684
         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_00001);
685
         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_00001 /= DT_0_00001(0.00125)
686
         then
687
            Report.Failed("Incorrect values returned, Case 37");
688
         end if;
689
      end;
690
 
691
 
692
      declare
693
         procedure Div is
694
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_0001);
695
      begin
696
         if TC_Verbose then Report.Comment("Case 38"); end if;
697
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
698
         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_0001);
699
         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_0001 /= DT_0_0001(0.0012)
700
         then
701
            Report.Failed("Incorrect values returned, Case 38");
702
         end if;
703
      end;
704
 
705
 
706
      declare
707
         procedure Div is
708
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_001);
709
      begin
710
         if TC_Verbose then Report.Comment("Case 39"); end if;
711
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
712
         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_001);
713
         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_001 /= DT_0_001(0.001) then
714
            Report.Failed("Incorrect values returned, Case 39");
715
         end if;
716
      end;
717
 
718
 
719
      declare
720
         procedure Div is
721
            new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_01);
722
      begin
723
         if TC_Verbose then Report.Comment("Case 40"); end if;
724
         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);
725
         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_01);
726
         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_01 /= DT_0_01(0.0) then
727
            Report.Failed("Incorrect values returned, Case 40");
728
         end if;
729
      end;
730
 
731
      declare
732
         procedure Div is
733
            new Ada.Decimal.Divide(DT_0_0001, DT_1, DT_0_0001, DT_0_0001);
734
      begin
735
         if TC_Verbose then Report.Comment("Case 41"); end if;
736
         Dd_0_0001 := (DT_0_0001(6062.0) / DT_0_0001(16384.0));
737
         Dv_1 := DT_1(0.0);
738
         Div(Dd_0_0001, Dv_1, Quot_0_0001, Rem_0_0001);
739
         Report.Failed("Divide by Zero didn't raise Constraint_Error, " &
740
                       "Case 41");
741
      exception
742
         when Constraint_Error =>  null;  -- OK, expected exception.
743
         when others =>
744
            Report.Failed("Unexpected exception raised by Divide by Zero," &
745
                          "Case 41");
746
      end;
747
 
748
   exception
749
      when others => Report.Failed("Exception raised in Radix_10_Block");
750
   end Radix_2_Block;
751
 
752
 
753
   Report.Result;
754
 
755
end CXF2001;

powered by: WebSVN 2.1.0

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