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/] [cc/] [cc1221d.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CC1221D.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
--     FOR A FORMAL INTEGER TYPE, CHECK THAT THE FOLLOWING BASIC
27
--     OPERATIONS ARE IMPLICITLY DECLARED AND ARE THEREFORE AVAILABLE
28
--     WITHIN THE GENERIC UNIT:  EXPLICIT CONVERSION TO AND FROM REAL
29
--     TYPES AND IMPLICIT CONVERSION FROM INTEGER LITERALS.
30
 
31
-- HISTORY:
32
--     BCB 11/12/87  CREATED ORIGINAL TEST FROM SPLIT OF CC1221A.ADA
33
 
34
WITH SYSTEM; USE SYSTEM;
35
WITH REPORT; USE REPORT;
36
PROCEDURE CC1221D IS
37
 
38
     SUBTYPE SUBINT IS INTEGER RANGE -100 .. 100;
39
     TYPE INT IS RANGE -300 .. 300;
40
     SUBTYPE SINT1 IS INT
41
          RANGE INT (IDENT_INT (-4)) .. INT (IDENT_INT (4));
42
     TYPE INT1 IS RANGE -6 .. 6;
43
 
44
BEGIN
45
     TEST ( "CC1221D", "FOR A FORMAL INTEGER TYPE, CHECK THAT THE " &
46
                       "FOLLOWING BASIC OPERATIONS ARE IMPLICITLY " &
47
                       "DECLARED AND ARE THEREFORE AVAILABLE " &
48
                       "WITHIN THE GENERIC UNIT:  EXPLICIT " &
49
                       "CONVERSION TO AND FROM REAL TYPES AND " &
50
                       "IMPLICIT CONVERSION FROM INTEGER LITERALS");
51
 
52
     DECLARE -- (D) CHECKS FOR EXPLICIT CONVERSION TO AND FROM OTHER
53
             --     NUMERIC TYPES, AND IMPLICIT CONVERSION FROM
54
             --     INTEGER LITERALS.
55
 
56
          GENERIC
57
               TYPE T IS RANGE <>;
58
          PROCEDURE P (STR : STRING);
59
 
60
          PROCEDURE P (STR : STRING) IS
61
 
62
               TYPE FIXED IS DELTA 0.1 RANGE -100.0 .. 100.0;
63
               FI0  : FIXED := 0.0;
64
               FI2  : FIXED := 2.0;
65
               FIN2 : FIXED := -2.0;
66
 
67
               FL0  : FLOAT := 0.0;
68
               FL2  : FLOAT := 2.0;
69
               FLN2 : FLOAT := -2.0;
70
 
71
               T0  : T := 0;
72
               T2  : T := 2;
73
               TN2 : T := -2;
74
 
75
               FUNCTION IDENT (X : T) RETURN T IS
76
               BEGIN
77
                    IF EQUAL (3, 3) THEN
78
                         RETURN X;
79
                    ELSE
80
                         RETURN T'FIRST;
81
                    END IF;
82
               END IDENT;
83
 
84
          BEGIN
85
               IF T0 + 1 /= 1 THEN
86
                    FAILED ( "INCORRECT RESULTS FOR IMPLICIT " &
87
                             "CONVERSION WITH TYPE " & STR & " - 1" );
88
               END IF;
89
 
90
               IF T2 + 1 /= 3 THEN
91
                    FAILED ( "INCORRECT RESULTS FOR IMPLICIT " &
92
                             "CONVERSION WITH TYPE " & STR & " - 2" );
93
               END IF;
94
 
95
               IF TN2 + 1 /= -1 THEN
96
                    FAILED ( "INCORRECT RESULTS FOR IMPLICIT " &
97
                             "CONVERSION WITH TYPE " & STR & " - 3" );
98
               END IF;
99
 
100
               IF T (FI0) /= T0 THEN
101
                    FAILED ( "INCORRECT CONVERSION FROM " &
102
                             "FIXED VALUE 0.0 WITH TYPE " & STR);
103
               END IF;
104
 
105
               IF T (FI2) /= IDENT (T2) THEN
106
                    FAILED ( "INCORRECT CONVERSION FROM " &
107
                             "FIXED VALUE 2.0 WITH TYPE " & STR);
108
               END IF;
109
 
110
               IF T (FIN2) /= TN2 THEN
111
                    FAILED ( "INCORRECT CONVERSION FROM " &
112
                             "FIXED VALUE -2.0 WITH TYPE " & STR);
113
               END IF;
114
 
115
               IF T (FL0) /= IDENT (T0) THEN
116
                    FAILED ( "INCORRECT CONVERSION FROM " &
117
                             "FLOAT VALUE 0.0 WITH TYPE " & STR);
118
               END IF;
119
 
120
               IF T (FL2) /= T2 THEN
121
                    FAILED ( "INCORRECT CONVERSION FROM " &
122
                             "FLOAT VALUE 2.0 WITH TYPE " & STR);
123
               END IF;
124
 
125
               IF T (FLN2) /= IDENT (TN2) THEN
126
                    FAILED ( "INCORRECT CONVERSION FROM " &
127
                             "FLOAT VALUE -2.0 WITH TYPE " & STR);
128
               END IF;
129
 
130
               IF FIXED (T0) /= FI0 THEN
131
                    FAILED ( "INCORRECT CONVERSION TO " &
132
                             "FIXED VALUE 0.0 WITH TYPE " & STR);
133
               END IF;
134
 
135
               IF FIXED (IDENT (T2)) /= FI2 THEN
136
                    FAILED ( "INCORRECT CONVERSION TO " &
137
                             "FIXED VALUE 2.0 WITH TYPE " & STR);
138
               END IF;
139
 
140
               IF FIXED (TN2) /= FIN2 THEN
141
                    FAILED ( "INCORRECT CONVERSION TO " &
142
                             "FIXED VALUE -2.0 WITH TYPE " & STR);
143
               END IF;
144
 
145
               IF FLOAT (IDENT (T0)) /= FL0 THEN
146
                    FAILED ( "INCORRECT CONVERSION TO " &
147
                             "FLOAT VALUE 0.0 WITH TYPE " & STR);
148
               END IF;
149
 
150
               IF FLOAT (T2) /= FL2 THEN
151
                    FAILED ( "INCORRECT CONVERSION TO " &
152
                             "FLOAT VALUE 2.0 WITH TYPE " & STR);
153
               END IF;
154
 
155
               IF FLOAT (IDENT (TN2)) /= FLN2 THEN
156
                    FAILED ( "INCORRECT CONVERSION TO " &
157
                             "FLOAT VALUE -2.0 WITH TYPE " & STR);
158
               END IF;
159
 
160
          END P;
161
 
162
          PROCEDURE P1 IS NEW P (SUBINT);
163
          PROCEDURE P2 IS NEW P (SINT1);
164
          PROCEDURE P3 IS NEW P (INT1);
165
 
166
     BEGIN
167
           P1 ( "SUBINT" );
168
           P2 ( "SINT" );
169
           P3 ( "INT1" );
170
     END; -- (D).
171
 
172
     RESULT;
173
END CC1221D;

powered by: WebSVN 2.1.0

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