summaryrefslogtreecommitdiff
path: root/gcc/testsuite/ada/acats/tests/c7/c74407b.ada
blob: d8f65084ce5fbdc05146e3992342abbebab7f590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
-- C74407B.ADA

--                             Grant of Unlimited Rights
--
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained 
--     unlimited rights in the software and documentation contained herein.
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making 
--     this public release, the Government intends to confer upon all 
--     recipients unlimited rights  equal to those held by the Government.  
--     These rights include rights to use, duplicate, release or disclose the 
--     released technical data and computer software in whole or in part, in 
--     any manner and for any purpose whatsoever, and to have or permit others 
--     to do so.
--
--                                    DISCLAIMER
--
--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED 
--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE 
--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--     PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
--     CHECK, FOR A LIMITED PRIVATE TYPE, THAT PRE-DEFINED EQUALITY AND
--     ASSIGNMENT ARE DEFINED AND AVAILABLE WITHIN THE PRIVATE PART AND
--     THE BODY OF A PACKAGE, AFTER THE FULL DECLARATION, IF THE FULL
--     DECLARATION IS NOT LIMITED.

-- HISTORY:
--     BCB 07/15/88  CREATED ORIGINAL TEST.

WITH REPORT; USE REPORT;

PROCEDURE C74407B IS

     PACKAGE PP IS
          TYPE PRIV IS PRIVATE;
          C1 : CONSTANT PRIV;
          C2 : CONSTANT PRIV;
     PRIVATE
          TYPE PRIV IS (ONE, TWO, THREE, FOUR, FIVE, SIX);
          C1 : CONSTANT PRIV := ONE;
          C2 : CONSTANT PRIV := TWO;
     END PP;

     USE PP;

     PACKAGE P IS
          TYPE INT IS LIMITED PRIVATE;
          TYPE COMP IS LIMITED PRIVATE;
          TYPE DER IS LIMITED PRIVATE;
     PRIVATE
          TYPE INT IS RANGE 1 .. 100;
          TYPE COMP IS ARRAY(1..5) OF INTEGER;
          TYPE DER IS NEW PRIV;
          D, E : INT := 10;
          F : INT := 20;
          CONS_INT1 : CONSTANT INT := 30;
          G : BOOLEAN := D = E;
          H : BOOLEAN := D /= F;
          CONS_BOOL1 : CONSTANT BOOLEAN := D = E;
          CONS_BOOL2 : CONSTANT BOOLEAN := D /= F;
          I : COMP := (1,2,3,4,5);
          CONS_COMP1 : CONSTANT COMP := (6,7,8,9,10);
          J : DER := DER(C1);
          CONS_DER1 : CONSTANT DER := DER(C2);
     END P;

     PACKAGE BODY P IS
          A, B, C : INT;
          X, Y, Z : COMP;
          L, M, N : DER;
          CONS_INT2 : CONSTANT INT := 10;
          CONS_COMP2 : CONSTANT COMP := (1,2,3,4,5);
          CONS_DER2 : CONSTANT DER := DER(C1);
     BEGIN
          TEST ("C74407B", "CHECK, FOR A LIMITED PRIVATE TYPE, THAT " &
                           "PRE-DEFINED EQUALITY AND ASSIGNMENT ARE " &
                           "DEFINED AND AVAILABLE WITHIN THE PRIVATE " &
                           "PART AND THE BODY OF A PACKAGE, AFTER " &
                           "THE FULL DECLARATION, IF THE FULL " &
                           "DECLARATION IS NOT LIMITED");

          A := 10;

          B := 10;

          C := 20;

          IF A = C THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED EQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 1");
          END IF;

          IF A /= B THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED INEQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 1");
          END IF;

          IF CONS_INT2 = C THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED EQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 2");
          END IF;

          IF CONS_INT2 /= B THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED INEQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 2");
          END IF;

          IF NOT G THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED EQUALITY " &
                       "OPERATION WITHIN THE PRIVATE PART OF THE " &
                       "PACKAGE - 1");
          END IF;

          IF NOT H THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED INEQUALITY " &
                       "OPERATION WITHIN THE PRIVATE PART OF THE " &
                       "PACKAGE - 1");
          END IF;

          IF NOT CONS_BOOL1 THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED EQUALITY " &
                       "OPERATION WITHIN THE PRIVATE PART OF THE " &
                       "PACKAGE - 2");
          END IF;

          IF NOT CONS_BOOL2 THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED INEQUALITY " &
                       "OPERATION WITHIN THE PRIVATE PART OF THE " &
                       "PACKAGE - 2");
          END IF;

          X := (1,2,3,4,5);

          Y := (1,2,3,4,5);

          Z := (5,4,3,2,1);

          IF X = Z THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED EQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 3");
          END IF;

          IF X /= Y THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED INEQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 3");
          END IF;

          IF CONS_COMP2 = Z THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED EQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 4");
          END IF;

          IF CONS_COMP2 /= Y THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED INEQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 4");
          END IF;

          L := DER(C1);

          M := DER(C1);

          N := DER(C2);

          IF L = N THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED EQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 5");
          END IF;

          IF L /= M THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED INEQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 5");
          END IF;

          IF CONS_DER2 = N THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED EQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 6");
          END IF;

          IF CONS_DER2 /= M THEN
               FAILED ("IMPROPER RESULT FROM PRE-DEFINED INEQUALITY " &
                       "OPERATION WITHIN THE PACKAGE BODY - 6");
          END IF;

          RESULT;
     END P;

     USE P;

BEGIN
     NULL;
END C74407B;