annotate gcc/testsuite/ada/acats/tests/c4/c45532h.ada @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- C45532H.ADA
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 -- OBJECTIVE:
kono
parents:
diff changeset
26 -- CHECK THAT THE OPERATOR "/" PRODUCES CORRECT RESULTS
kono
parents:
diff changeset
27 -- FOR FIXED POINT TYPES USING 3 SUBTESTS.
kono
parents:
diff changeset
28 -- THIS TEST REQUIRES MIN_WORD_LENGTH = 16.
kono
parents:
diff changeset
29 -- THIS TEST USES VALUES OF DELTA WHICH ARE GREATER THAN OR
kono
parents:
diff changeset
30 -- EQUAL TO 0.5.
kono
parents:
diff changeset
31 --
kono
parents:
diff changeset
32 -- TEST CASES ARE:
kono
parents:
diff changeset
33 -- A) THE OPERATOR /, A, B, AND A / B ALL MODEL NUMBERS.
kono
parents:
diff changeset
34 -- B) THE OPERATOR /, A, B MODEL NUMBERS A / B NOT.
kono
parents:
diff changeset
35 -- C) THE OPERATOR /, USING NO MODEL NUMBERS.
kono
parents:
diff changeset
36 --
kono
parents:
diff changeset
37 -- REPEAT FOR MINIMUM REQUIRED WORD LENGTHS OF 12, 16, 32 AND 48,
kono
parents:
diff changeset
38 -- WITH RANGE <, =, AND > THAN 1.0 AND
kono
parents:
diff changeset
39 -- WITH DELTA <, =, AND > THAN 1.0.
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 -- HISTORY:
kono
parents:
diff changeset
42 -- NTW 09/08/86 CREATED ORIGINAL TEST.
kono
parents:
diff changeset
43 -- RJW 11/05/86 REVISED COMMENTS.
kono
parents:
diff changeset
44 -- DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
kono
parents:
diff changeset
45 -- RDH 04/27/90 REVISED APPLICABILITY CRITERIA.
kono
parents:
diff changeset
46 -- BCB 10/03/90 REMOVED APPLICABILITY CRITERIA AND N/A => ERROR
kono
parents:
diff changeset
47 -- LINE. CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 WITH REPORT;
kono
parents:
diff changeset
50 PROCEDURE C45532H IS
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 USE REPORT;
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 MIN_WORD_LENGTH : CONSTANT := 16;
kono
parents:
diff changeset
55 FULL_SCALE : CONSTANT := 2 ** (MIN_WORD_LENGTH - 1);
kono
parents:
diff changeset
56 A_THIRD : CONSTANT := FULL_SCALE / 3;
kono
parents:
diff changeset
57 RNG1 : CONSTANT := FULL_SCALE * 0.5;
kono
parents:
diff changeset
58 TYPE FX_0P5 IS DELTA 0.5 RANGE -RNG1 * 1 .. RNG1 * 1 - 0.5;
kono
parents:
diff changeset
59 TYPE FX_1 IS DELTA 1.0 RANGE -RNG1 * 2 .. RNG1 * 2 - 1.0;
kono
parents:
diff changeset
60 TYPE FX_RNG1 IS DELTA RNG1
kono
parents:
diff changeset
61 RANGE -RNG1 * FULL_SCALE .. RNG1 * (FULL_SCALE - 1);
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 BEGIN TEST ("C45532H", "FIXED POINT OPERATOR ""/""" );
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 --------------------------------------------------
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 -- CASE A) THE OPERATOR /, A, B, AND A / B ALL MODEL NUMBERS.
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 A: DECLARE
kono
parents:
diff changeset
70 A : FX_RNG1 := 0.0;
kono
parents:
diff changeset
71 B : FX_0P5 := 0.0;
kono
parents:
diff changeset
72 RESULT_VALUE : FX_0P5 := 0.0;
kono
parents:
diff changeset
73 LOWEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (RNG1 / 2);
kono
parents:
diff changeset
74 HIGHEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (RNG1 / 2);
kono
parents:
diff changeset
75 BEGIN
kono
parents:
diff changeset
76 IF EQUAL (3, 3) THEN
kono
parents:
diff changeset
77 A := FX_RNG1 (RNG1 * RNG1 / 4); -- A MODEL NUMBER
kono
parents:
diff changeset
78 B := FX_0P5 (RNG1 / 2); -- A MODEL NUMBER
kono
parents:
diff changeset
79 END IF;
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 RESULT_VALUE := FX_0P5 (A / B);
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
kono
parents:
diff changeset
84 OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
kono
parents:
diff changeset
85 FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
kono
parents:
diff changeset
86 & "WHEN A, B, AND A / B ARE ALL MODEL NUMBERS");
kono
parents:
diff changeset
87 END IF;
kono
parents:
diff changeset
88 END A;
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 --------------------------------------------------
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 -- CASE B) THE OPERATOR /, A, B MODEL NUMBERS A / B NOT.
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 B: DECLARE
kono
parents:
diff changeset
95 A : FX_RNG1 := 0.0;
kono
parents:
diff changeset
96 B : FX_1 := 0.0;
kono
parents:
diff changeset
97 RESULT_VALUE : FX_0P5 := 0.0;
kono
parents:
diff changeset
98 LOWEST_ACCEPTABLE_VALUE : FX_0P5
kono
parents:
diff changeset
99 := FX_0P5 (0.5 * A_THIRD);
kono
parents:
diff changeset
100 HIGHEST_ACCEPTABLE_VALUE : FX_0P5
kono
parents:
diff changeset
101 := FX_0P5 (0.5 * (A_THIRD + 1) );
kono
parents:
diff changeset
102 BEGIN
kono
parents:
diff changeset
103 IF EQUAL (3, 3) THEN
kono
parents:
diff changeset
104 A := FX_RNG1 (RNG1); -- A MODEL NUMBER
kono
parents:
diff changeset
105 B := FX_1 (3.0); -- A MODEL NUMBER
kono
parents:
diff changeset
106 END IF;
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 RESULT_VALUE := FX_0P5 (A / B);
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
kono
parents:
diff changeset
111 OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
kono
parents:
diff changeset
112 FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
kono
parents:
diff changeset
113 & "WHEN A, B MODEL NUMBERS A / B NOT");
kono
parents:
diff changeset
114 END IF;
kono
parents:
diff changeset
115 END B;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 --------------------------------------------------
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 -- CASE C) THE OPERATOR /, USING NO MODEL NUMBERS
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 C: DECLARE
kono
parents:
diff changeset
122 A : FX_RNG1 := 0.0;
kono
parents:
diff changeset
123 B : FX_1 := 0.0;
kono
parents:
diff changeset
124 RESULT_VALUE : FX_1 := 0.0;
kono
parents:
diff changeset
125 LOWEST_ACCEPTABLE_VALUE : FX_1
kono
parents:
diff changeset
126 := FX_1 ( RNG1 - 3.0);
kono
parents:
diff changeset
127 HIGHEST_ACCEPTABLE_VALUE : FX_1
kono
parents:
diff changeset
128 := FX_1 ( RNG1 + 4.0);
kono
parents:
diff changeset
129 BEGIN
kono
parents:
diff changeset
130 IF EQUAL (3, 3) THEN
kono
parents:
diff changeset
131 A := FX_RNG1 (RNG1 * RNG1 / 3); -- NOT A MODEL NUMBER
kono
parents:
diff changeset
132 B := FX_1 (RNG1 / 3); -- NOT A MODEL NUMBER
kono
parents:
diff changeset
133 END IF;
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 RESULT_VALUE := FX_1 (A / B);
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
kono
parents:
diff changeset
138 OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
kono
parents:
diff changeset
139 FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
kono
parents:
diff changeset
140 & "WHEN USING NO MODEL NUMBERS");
kono
parents:
diff changeset
141 END IF;
kono
parents:
diff changeset
142 END C;
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 --------------------------------------------------
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 RESULT;
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 END C45532H;