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/] [c8/] [c83031a.ada] - Blame information for rev 309

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

Line No. Rev Author Line
1 294 jeremybenn
-- C83031A.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 AN IMPLICIT DECLARATION OF A PREDEFINED OPERATOR OR
27
--     AN ENUMERATION LITERAL IS HIDDEN BY A SUBPROGRAM DECLARATION OR
28
--     A RENAMING DECLARATION WHICH DECLARES A HOMOGRAPH OF THE
29
--     OPERATOR OR LITERAL.
30
 
31
-- HISTORY:
32
--     VCL  08/10/88  CREATED ORIGINAL TEST.
33
--     JRL  03/20/92  ELIMINATED REDUNDANT TESTING.
34
 
35
WITH REPORT;  USE REPORT;
36
PROCEDURE C83031A IS
37
BEGIN
38
     TEST ("C83031A", "AN IMPLICIT DECLARATION OF A PREDEFINED " &
39
                      "OPERATOR OR AN ENUMERATION LITERAL IS HIDDEN " &
40
                      "BY A SUBPROGRAM DECLARATION OR A RENAMING " &
41
                      "DECLARATION WHICH DECLARES A HOMOGRAPH OF THE " &
42
                      "OPERATOR OR LITERAL");
43
 
44
     DECLARE             -- CHECK SUBPROGRAM DECLARATIONS OF OPERATORS
45
          PACKAGE P IS
46
               TYPE INT IS RANGE -20 .. 20;
47
 
48
               M : INT := 3 * INT(IDENT_INT(3));
49
               N : INT := 4 + INT(IDENT_INT(4));
50
 
51
               FUNCTION "*" (LEFT, RIGHT : INT) RETURN INT;
52
               TYPE INT2 IS PRIVATE;
53
               FUNCTION "+" (LEFT, RIGHT : INT2) RETURN INT2;
54
          PRIVATE
55
               FUNCTION "+" (LEFT, RIGHT : INT) RETURN INT
56
                            RENAMES "/" ;
57
 
58
               TYPE INT2 IS RANGE -20 .. 20;
59
          END P;
60
          USE P;
61
 
62
          PACKAGE BODY P IS
63
               FUNCTION "*" (LEFT, RIGHT : INT) RETURN INT IS
64
               BEGIN
65
                    RETURN LEFT / RIGHT;
66
               END "*";
67
 
68
               FUNCTION "+" (LEFT, RIGHT : INT2) RETURN INT2 IS
69
               BEGIN
70
                    RETURN LEFT - RIGHT;
71
               END "+";
72
 
73
          BEGIN
74
               IF 2 * INT(IDENT_INT(2)) /= 1 THEN
75
                    FAILED ("INCORRECT VALUE RETURNED IN CALL TO " &
76
                            "EXPLICIT '*' OPERATOR - 1");
77
               END IF;
78
 
79
               IF N /= 8 THEN
80
                    FAILED ("INCORRECT INITIAL VALUE FOR N - 1");
81
               END IF;
82
               N := 2 + 2;
83
               IF N /= INT(IDENT_INT (1)) THEN
84
               FAILED ("INCORRECT VALUE FOR N AFTER CALL TO " &
85
                       "EXPLICIT '+' OPERATOR - 1");
86
               END IF;
87
 
88
               DECLARE
89
                    Q : INT2 := 8 + 9;
90
               BEGIN
91
                    IF Q /= -1 THEN
92
                         FAILED ("INCORRECT VALUE FOR Q");
93
                    END IF;
94
               END;
95
          END P;
96
     BEGIN
97
          IF M /= 9 THEN
98
               FAILED ("INCORRECT INITIAL VALUE FOR M - 2");
99
          END IF;
100
          IF 2 * INT(IDENT_INT(2)) /= 1 THEN
101
               FAILED ("INCORRECT VALUE RETURNED IN CALL TO " &
102
                       "EXPLICIT '*' OPERATOR - 2");
103
          END IF;
104
 
105
          N := 2 + 2;
106
          IF N /= INT(IDENT_INT (4)) THEN
107
               FAILED ("INCORRECT VALUE FOR N AFTER CALL TO " &
108
                       "IMPLICIT '+' OPERATOR - 2");
109
          END IF;
110
 
111
     END;
112
 
113
     DECLARE   -- CHECK SUBPROGRAM DECLARATIONS OF ENUMERATION LITERALS.
114
 
115
          PACKAGE P1 IS
116
               TYPE ENUM1 IS (E11, E12, E13);
117
               TYPE PRIV1 IS PRIVATE;
118
               FUNCTION E11 RETURN PRIV1;
119
          PRIVATE
120
               TYPE PRIV1 IS NEW ENUM1;
121
               FUNCTION E12 RETURN PRIV1 RENAMES E13;
122
          END P1;
123
          USE P1;
124
 
125
          E13 : INTEGER := IDENT_INT (5);
126
 
127
          FUNCTION E12 RETURN ENUM1 RENAMES E11 ;
128
 
129
          FUNCTION CHECK (E: ENUM1) RETURN INTEGER IS
130
          BEGIN
131
               RETURN ENUM1'POS (E);
132
          END CHECK;
133
 
134
          FUNCTION CHECK (E: INTEGER) RETURN INTEGER IS
135
          BEGIN
136
               RETURN INTEGER'POS (E);
137
          END CHECK;
138
 
139
          PACKAGE BODY P1 IS
140
               FUNCTION E11 RETURN PRIV1 IS
141
               BEGIN
142
                    RETURN E13;
143
               END E11;
144
          BEGIN
145
               IF PRIV1'(E11) /= E13 THEN
146
                    FAILED ("INCORRECT VALUE FOR E11");
147
               END IF;
148
 
149
               IF E12 /= PRIV1'LAST THEN
150
                    FAILED ("INCORRECT VALUE FOR E12 - 1");
151
               END IF;
152
          END P1;
153
     BEGIN
154
          IF E12 /= ENUM1'FIRST THEN
155
               FAILED ("INCORRECT VALUE FOR E12 - 2");
156
          END IF;
157
 
158
          IF CHECK (E13) /= 5 THEN
159
               FAILED ("INCORRECT VALUE FOR E13");
160
          END IF;
161
     END;
162
     RESULT;
163
END C83031A;

powered by: WebSVN 2.1.0

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