1-- CC3235A.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 A PRIVATE OR LIMITED PRIVATE FORMAL TYPE DENOTES ITS
27--      ACTUAL PARAMETER AN ACCESS TYPE, AND OPERATIONS OF THE FORMAL
28--      TYPE ARE IDENTIFIED WITH CORRESPONDING OPERATIONS OF THE ACTUAL
29--      TYPE.
30
31-- HISTORY:
32--      TBN 09/15/88  CREATED ORIGINAL TEST.
33
34WITH REPORT; USE REPORT;
35PROCEDURE CC3235A IS
36
37     GENERIC
38          TYPE T IS PRIVATE;
39     PACKAGE P IS
40          SUBTYPE SUB_T IS T;
41          PAC_VAR : T;
42     END P;
43
44     GENERIC
45          TYPE T IS LIMITED PRIVATE;
46     PACKAGE LP IS
47          SUBTYPE SUB_T IS T;
48          PAC_VAR : T;
49     END LP;
50
51BEGIN
52     TEST ("CC3235A", "CHECK THAT A PRIVATE OR LIMITED PRIVATE " &
53                      "FORMAL TYPE DENOTES ITS ACTUAL PARAMETER AN " &
54                      "ACCESS TYPE, AND OPERATIONS OF THE " &
55                      "FORMAL TYPE ARE IDENTIFIED WITH CORRESPONDING " &
56                      "OPERATIONS OF THE ACTUAL TYPE");
57
58     DECLARE  -- PRIVATE TYPE.
59          TYPE ENUM IS (RED, YELLOW, GREEN, BLUE);
60
61          TYPE ACCESS_TYPE IS ACCESS ENUM;
62
63          OBJ_ACC : ACCESS_TYPE := NEW ENUM'(RED);
64
65          PACKAGE P1 IS NEW P (ACCESS_TYPE);
66          USE P1;
67
68          TYPE NEW_T IS NEW SUB_T;
69          OBJ_NEWT : NEW_T;
70     BEGIN
71          PAC_VAR := NEW ENUM'(RED);
72          IF (PAC_VAR.ALL < OBJ_ACC.ALL) OR
73             (PAC_VAR.ALL > OBJ_ACC.ALL) THEN
74               FAILED ("INCORRECT RESULTS - 1");
75          END IF;
76          IF PAC_VAR NOT IN ACCESS_TYPE THEN
77               FAILED ("INCORRECT RESULTS - 2");
78          END IF;
79          IF OBJ_ACC NOT IN SUB_T THEN
80               FAILED ("INCORRECT RESULTS - 3");
81          END IF;
82          OBJ_ACC := NEW ENUM'(ENUM'SUCC(PAC_VAR.ALL));
83          IF OBJ_ACC.ALL /= YELLOW THEN
84               FAILED ("INCORRECT RESULTS - 4");
85          END IF;
86          OBJ_NEWT := NEW ENUM'(BLUE);
87          OBJ_NEWT := NEW ENUM'(ENUM'PRED(OBJ_NEWT.ALL));
88          IF OBJ_NEWT NOT IN NEW_T THEN
89               FAILED ("INCORRECT RESULTS - 5");
90          END IF;
91     END;
92
93     DECLARE  -- LIMITED PRIVATE TYPE.
94          TYPE ENUM IS (RED, YELLOW, GREEN, BLUE);
95
96          TYPE ACCESS_TYPE IS ACCESS ENUM;
97
98          OBJ_ACC : ACCESS_TYPE := NEW ENUM'(RED);
99
100          PACKAGE P1 IS NEW LP (ACCESS_TYPE);
101          USE P1;
102
103          TYPE NEW_T IS NEW SUB_T;
104          OBJ_NEWT : NEW_T;
105     BEGIN
106          PAC_VAR := NEW ENUM'(RED);
107          IF (PAC_VAR.ALL < OBJ_ACC.ALL) OR
108             (PAC_VAR.ALL > OBJ_ACC.ALL) THEN
109               FAILED ("INCORRECT RESULTS - 6");
110          END IF;
111          IF PAC_VAR NOT IN ACCESS_TYPE THEN
112               FAILED ("INCORRECT RESULTS - 7");
113          END IF;
114          IF OBJ_ACC NOT IN SUB_T THEN
115               FAILED ("INCORRECT RESULTS - 8");
116          END IF;
117          OBJ_ACC := NEW ENUM'(ENUM'SUCC(PAC_VAR.ALL));
118          IF OBJ_ACC.ALL /= YELLOW THEN
119               FAILED ("INCORRECT RESULTS - 9");
120          END IF;
121          OBJ_NEWT := NEW ENUM'(BLUE);
122          OBJ_NEWT := NEW ENUM'(ENUM'PRED(OBJ_NEWT.ALL));
123          IF OBJ_NEWT NOT IN NEW_T THEN
124               FAILED ("INCORRECT RESULTS - 10");
125          END IF;
126     END;
127
128     RESULT;
129END CC3235A;
130