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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cd/] [cd2a53a.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CD2A53A.ADA
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
-- OBJECTIVE:
26
--     CHECK THAT WHEN SIZE AND SMALL SPECIFICATIONS ARE GIVEN FOR A
27
--     FIXED POINT TYPE, THEN OPERATIONS ON VALUES OF SUCH A TYPE ARE
28
--     NOT AFFECTED BY THE REPRESENTATION CLAUSE.
29
 
30
-- APPLICABILITY CRITERIA:
31
--      All implementations must attempt to compile this test.
32
--
33
--      For implementations validating against Systems Programming Annex (C)
34
--          and which support decimal small values:
35
--          The test must compile, bind, execute, report PASSED, and
36
--          complete normally.
37
--
38
--      For other implementations:
39
--          This test may produce at least one error message at compilation,
40
--          and the error message is associated with one of the items marked:
41
--             -- N/A => ERROR.
42
--          The test will be recorded as Not_Applicable.
43
--          Otherwise, the test must execute and report PASSED.
44
--
45
--      All other behaviors are FAILING.
46
--
47
-- HISTORY:
48
--     BCB 08/24/87  CREATED ORIGINAL TEST.
49
--     DHH 04/12/89  CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED
50
--                   OPERATORS ON 'SIZE TESTS, AND CHANGED 'SIZE CLAUSE
51
--                   SO THAT IT IS NOT A POWER OF TWO.
52
--     WMC 04/01/92  ELIMINATED TEST REDUNDANCIES.
53
--     RLB 11/24/98  Added Ada 95 applicability criteria.
54
 
55
WITH REPORT; USE REPORT;
56
PROCEDURE CD2A53A IS
57
     BASIC_SIZE : CONSTANT := 15;
58
     BASIC_SMALL : CONSTANT := 0.01;
59
 
60
     ZERO  : CONSTANT :=  0.0;
61
 
62
     TYPE CHECK_TYPE IS DELTA 1.0 RANGE -4.0 .. 4.0;
63
 
64
     FOR CHECK_TYPE'SMALL USE BASIC_SMALL;   -- N/A => ERROR.
65
     FOR CHECK_TYPE'SIZE USE BASIC_SIZE;     -- N/A => ERROR.
66
 
67
     CNEG1 : CHECK_TYPE := -2.7;
68
     CNEG2 : CHECK_TYPE := CHECK_TYPE (-1.0/3.0);
69
     CPOS1 : CHECK_TYPE := CHECK_TYPE (4.0/6.0);
70
     CPOS2 : CHECK_TYPE :=  2.7;
71
     CZERO : CHECK_TYPE;
72
 
73
     TYPE ARRAY_TYPE IS ARRAY (0 .. 3) OF CHECK_TYPE;
74
     CHARRAY : ARRAY_TYPE :=
75
          (-2.7, CHECK_TYPE (-1.0/3.0), CHECK_TYPE (4.0/6.0), 2.7);
76
 
77
     TYPE REC_TYPE IS RECORD
78
          COMPF : CHECK_TYPE := -2.7;
79
          COMPN : CHECK_TYPE := CHECK_TYPE (-1.0/3.0);
80
          COMPP : CHECK_TYPE := CHECK_TYPE (4.0/6.0);
81
          COMPL : CHECK_TYPE :=  2.7;
82
     END RECORD;
83
 
84
     CHREC : REC_TYPE;
85
 
86
     FUNCTION IDENT (FX : CHECK_TYPE) RETURN CHECK_TYPE IS
87
     BEGIN
88
          IF EQUAL (3, 3) THEN
89
               RETURN FX;
90
          ELSE
91
               RETURN 0.0;
92
          END IF;
93
     END IDENT;
94
 
95
     PROCEDURE PROC (CN1IN, CP1IN      :        CHECK_TYPE;
96
                     CN2INOUT,CP2INOUT : IN OUT CHECK_TYPE;
97
                     CZOUT             :    OUT CHECK_TYPE) IS
98
     BEGIN
99
 
100
          IF IDENT (CN1IN) + CP1IN NOT IN -2.04 .. -2.03 OR
101
             CP2INOUT  - IDENT (CP1IN) NOT IN 2.03 .. 2.04 THEN
102
               FAILED ("INCORRECT RESULTS FOR " &
103
                       "BINARY ADDING OPERATORS - 1");
104
          END IF;
105
 
106
          IF CHECK_TYPE (CN1IN * IDENT (CP1IN)) NOT IN
107
             -1.81 .. -1.78 OR
108
             CHECK_TYPE (IDENT (CN2INOUT) / CP2INOUT) NOT IN
109
             -0.13 .. -0.12 THEN
110
               FAILED ("INCORRECT RESULTS FOR " &
111
                       "MULTIPLYING OPERATORS - 1");
112
          END IF;
113
 
114
          IF IDENT (CP1IN) NOT IN 0.66 .. 0.670 OR
115
                 CN2INOUT IN -0.32 .. 0.0 OR
116
                 IDENT (CN2INOUT) IN -1.0 .. -0.35 THEN
117
               FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " &
118
                       "OPERATORS - 1");
119
          END IF;
120
 
121
          CZOUT := 0.0;
122
 
123
     END PROC;
124
 
125
BEGIN
126
     TEST ("CD2A53A", "CHECK THAT WHEN SIZE AND SMALL SPECIFICATIONS " &
127
                      "ARE GIVEN FOR A FIXED POINT TYPE, THEN " &
128
                      "OPERATIONS ON VALUES OF SUCH A TYPE ARE NOT " &
129
                      "AFFECTED BY THE REPRESENTATION CLAUSE");
130
 
131
     PROC (CNEG1, CPOS1, CNEG2, CPOS2, CZERO);
132
 
133
     IF CNEG1'SIZE < IDENT_INT(BASIC_SIZE) THEN
134
          FAILED ("INCORRECT VALUE FOR CNEG1'SIZE");
135
     END IF;
136
 
137
     IF IDENT (CZERO) /= ZERO THEN
138
          FAILED ("INCORRECT VALUE FOR OUT PARAMETER");
139
     END IF;
140
 
141
     IF CHECK_TYPE'FIRST > IDENT (-3.99) THEN
142
          FAILED ("INCORRECT VALUE FOR CHECK_TYPE'FIRST");
143
     END IF;
144
 
145
     IF CHECK_TYPE'SIZE /= IDENT_INT (BASIC_SIZE) THEN
146
          FAILED ("INCORRECT VALUE FOR CHECK_TYPE'SIZE");
147
     END IF;
148
 
149
     IF CHECK_TYPE'SMALL /= BASIC_SMALL THEN
150
          FAILED ("INCORRECT VALUE FOR CHECK_TYPE'SMALL");
151
     END IF;
152
 
153
     IF CHECK_TYPE'FORE /= 2 THEN
154
          FAILED ("INCORRECT VALUE FOR CHECK_TYPE'FORE");
155
     END IF;
156
 
157
     IF +IDENT (CNEG2) NOT IN -0.34 .. -0.33 OR
158
        IDENT (-CPOS1) NOT IN -0.67 .. -0.66 THEN
159
          FAILED ("INCORRECT RESULTS FOR UNARY ADDING OPERATORS - 2");
160
     END IF;
161
 
162
     IF ABS IDENT (CNEG2) NOT IN 0.33 .. 0.34 OR
163
        IDENT (ABS CPOS1) NOT IN 0.66 .. 0.670 THEN
164
          FAILED ("INCORRECT RESULTS FOR ABSOLUTE VALUE " &
165
                  "OPERATORS - 2");
166
     END IF;
167
 
168
     IF CHARRAY(1)'SIZE < IDENT_INT (BASIC_SIZE) THEN
169
          FAILED ("INCORRECT VALUE FOR CHARRAY(1)'SIZE");
170
     END IF;
171
 
172
     IF IDENT (CHARRAY (0)) + CHARRAY (2) NOT IN
173
             -2.04 .. -2.03 OR
174
        CHARRAY (3)  - IDENT (CHARRAY (2)) NOT IN
175
             2.03 .. 2.04 THEN
176
          FAILED ("INCORRECT RESULTS FOR BINARY ADDING OPERATORS - 3");
177
     END IF;
178
 
179
     IF CHECK_TYPE (CHARRAY (0) * IDENT (CHARRAY (2))) NOT IN
180
          -1.81 .. -1.78 OR
181
        CHECK_TYPE (IDENT (CHARRAY (1)) / CHARRAY (3)) NOT IN
182
          -0.13 .. -0.12 THEN
183
          FAILED ("INCORRECT RESULTS FOR MULTIPLYING OPERATORS - 3");
184
     END IF;
185
 
186
     IF IDENT (CHARRAY (2)) NOT IN 0.66 .. 0.670 OR
187
            CHARRAY (1) IN -0.32 .. 0.0 OR
188
            IDENT (CHARRAY (1)) IN -1.0 .. -0.35 THEN
189
          FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " &
190
                  "OPERATORS - 3");
191
     END IF;
192
 
193
     IF CHREC.COMPP'SIZE < IDENT_INT (BASIC_SIZE) THEN
194
          FAILED ("INCORRECT VALUE FOR CHREC.COMPP'SIZE");
195
     END IF;
196
 
197
     IF +IDENT (CHREC.COMPN) NOT IN -0.34 .. -0.33 OR
198
        IDENT (-CHREC.COMPP) NOT IN -0.67 .. -0.66 THEN
199
          FAILED ("INCORRECT RESULTS FOR UNARY ADDING OPERATORS - 4");
200
     END IF;
201
 
202
     IF ABS IDENT (CHREC.COMPN) NOT IN 0.33 .. 0.34 OR
203
        IDENT (ABS CHREC.COMPP) NOT IN 0.66 .. 0.670 THEN
204
          FAILED ("INCORRECT RESULTS FOR ABSOLUTE VALUE " &
205
                  "OPERATORS - 4");
206
     END IF;
207
 
208
     IF IDENT (CHREC.COMPP) NOT IN 0.66 .. 0.670 OR
209
            CHREC.COMPN IN -0.32 .. 0.0 OR
210
            IDENT (CHREC.COMPN) IN -1.0 .. -0.35 THEN
211
          FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " &
212
                  "OPERATORS - 4");
213
     END IF;
214
 
215
     RESULT;
216
 
217
END CD2A53A;

powered by: WebSVN 2.1.0

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