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/] [c7/] [c74211a.ada] - Blame information for rev 149

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C74211A.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
-- CHECK THAT WITHIN THE PACKAGE SPECIFICATION AND BODY, ANY EXPLICIT
26
-- DECLARATIONS OF OPERATORS AND SUBPROGRAMS HIDE ANY OPERATIONS WHICH
27
-- ARE IMPLICITLY DECLARED AT THE POINT OF THE FULL DECLARATION,
28
-- REGARDLESS OF THE ORDER OF OCCURENCE OF THE DECLARATIONS.
29
 
30
-- CHECK THAT IMPLICITLY DECLARED DERIVED SUBPROGRAMS HIDE IMPLICITLY
31
-- DECLARED PREDEFINED OPERATORS, REGARDLESS OF THE ORDER OF OCCURENCE
32
-- OF THE DECLARATIONS.
33
 
34
-- DSJ 4/28/83
35
-- JBG 9/23/83
36
 
37
--   A) EXPLICIT DECLARATION HIDES LATER IMPLICIT DECL OF PREDEFINED OP.
38
--   B)     "        "         "   LATER     "      "  "  DERIVED OP.
39
--   C)     "        "         "   EARLIER   "      "  "  PREDEFINED OP.
40
--   D)     "        "         "   EARLIER   "      "  "  DERIVED OP.
41
 
42
WITH REPORT;
43
PROCEDURE C74211A IS
44
 
45
     USE REPORT;
46
 
47
BEGIN
48
 
49
     TEST ("C74211A", "CHECK THAT HIDING OF IMPLICITLY DECLARED " &
50
                      "OPERATORS AND DERIVED SUBPROGRAMS IS DONE " &
51
                      "CORRECTLY REGARDLESS OF ORDER OF DECL'S");
52
 
53
     DECLARE
54
 
55
          PACKAGE P1 IS
56
               TYPE T1 IS RANGE 1 .. 50;
57
               C1 : CONSTANT T1 := T1(IDENT_INT(2));
58
               D1 : CONSTANT T1 := C1 + C1;        -- PREDEFINED "+"
59
               FUNCTION "+" (L, R : T1) RETURN T1; -- C) FOR "+".
60
               FUNCTION "-" (L, R : T1) RETURN T1; -- C) FOR "-".
61
               FUNCTION "/" (L, R : T1) RETURN T1;
62
          END P1;
63
 
64
          USE P1;
65
 
66
          PACKAGE BODY P1 IS
67
               A,B : T1 := 3;
68
 
69
               FUNCTION "+" (L, R : T1) RETURN T1 IS
70
               BEGIN
71
                    IF L = R THEN
72
                         RETURN 1;
73
                    ELSE RETURN 2;
74
                    END IF;
75
               END "+";
76
 
77
               FUNCTION "-" (L, R : T1) RETURN T1 IS
78
               BEGIN
79
                    IF L = R THEN
80
                         RETURN 3;
81
                    ELSE RETURN 4;
82
                    END IF;
83
               END "-";
84
 
85
               FUNCTION "/" (L, R : T1) RETURN T1 IS
86
               BEGIN
87
                    IF L = R THEN
88
                         RETURN T1(IDENT_INT(INTEGER(L)));
89
                    ELSE
90
                         RETURN T1(IDENT_INT(50));
91
                    END IF;
92
               END "/";
93
 
94
          BEGIN
95
               IF D1 /= 4 THEN
96
                    FAILED ("WRONG PREDEFINED OPERATION - '+' ");
97
               END IF;
98
 
99
               IF D1 + C1 /= 2 THEN
100
                    FAILED ("IMPLICIT '+' NOT HIDDEN BY EXPLICIT '+'");
101
               END IF;
102
 
103
               IF A + B /= 1 THEN
104
                    FAILED ("IMPLICIT DECLARATION NOT HIDDEN " &
105
                            "BY EXPLICIT DECLARATION - '+' ");
106
               END IF;
107
 
108
               IF A - B /= 3 THEN
109
                    FAILED ("IMPLICIT DECLARATION NOT HIDDEN " &
110
                            "BY EXPLICIT DECLARATION - '-' ");
111
               END IF;
112
 
113
               IF A * B /= 9 THEN
114
                    FAILED ("WRONG PREDEFINED OPERATION - '*' ");
115
               END IF;
116
 
117
               IF B / A  /=  T1(IDENT_INT(3)) THEN
118
                    FAILED ("NOT REDEFINED '/' ");
119
               END IF;
120
          END P1;
121
 
122
          PACKAGE P2 IS
123
               TYPE T2 IS PRIVATE;
124
               X , Y : CONSTANT T2;
125
               FUNCTION "+" (L, R : T2) RETURN T2;     -- B)
126
               FUNCTION "*" (L, R : T2) RETURN T2;     -- A)
127
          PRIVATE
128
               TYPE T2 IS NEW T1;                 -- B) +; A) *
129
               Z : T2 := T2(IDENT_INT(3))/4;      -- Z = 50 USING
130
                                                  -- DERIVED /
131
               FUNCTION "/" (L, R : T2) RETURN T2;  -- D) FOR /
132
               X , Y : CONSTANT T2 := 3;
133
          END P2;
134
 
135
          PACKAGE BODY P2 IS
136
               FUNCTION "+" (L, R : T2) RETURN T2 IS
137
               BEGIN
138
                    IF L = R THEN
139
                         RETURN T2(IDENT_INT(5));
140
                    ELSE RETURN T2(IDENT_INT(6));
141
                    END IF;
142
               END "+";
143
 
144
               FUNCTION "*" (L, R : T2) RETURN T2 IS
145
               BEGIN
146
                    IF L = R THEN
147
                         RETURN T2(IDENT_INT(7));
148
                    ELSE RETURN T2(IDENT_INT(8));
149
                    END IF;
150
               END "*";
151
 
152
               FUNCTION "/" (L, R : T2) RETURN T2 IS
153
               BEGIN
154
                    IF L = R THEN
155
                         RETURN T2(IDENT_INT(9));
156
                    ELSE RETURN T2(IDENT_INT(10));
157
                    END IF;
158
               END "/";
159
          BEGIN
160
               IF X + Y /= 5 THEN
161
                         FAILED ("DERIVED SUBPROGRAM NOT HIDDEN BY " &
162
                                 "EXPLICIT DECLARATION - '+' ");
163
               END IF;
164
 
165
               IF Y - X /= 3 THEN
166
                         FAILED ("PREDEFINED OPERATOR NOT HIDDEN BY " &
167
                                 "DERIVED SUBPROGRAM - '-' ");
168
               END IF;
169
 
170
               IF X * Y /= 7 THEN
171
                         FAILED ("PREDEFINED OPERATOR NOT HIDDEN BY " &
172
                                 "EXPLICIT DECLARATION - '*' ");
173
               END IF;
174
 
175
               IF Y / X /= T2(IDENT_INT(9)) THEN
176
                         FAILED ("DERIVED OPERATOR NOT HIDDEN BY " &
177
                                 "EXPLICIT DECLARATION - '/' ");
178
               END IF;
179
 
180
               IF Z /= 50 THEN
181
                    FAILED ("DERIVED OPERATOR HIDDEN PREMATURELY " &
182
                            " BY REDECLARED OPERATOR");
183
               END IF;
184
 
185
          END P2;
186
 
187
     BEGIN
188
 
189
          NULL;
190
 
191
     END;
192
 
193
     RESULT;
194
 
195
END C74211A;

powered by: WebSVN 2.1.0

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