1-- CC3230A.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 ENUMERATION TYPE, AND OPERATIONS OF THE
28--      FORMAL TYPE ARE IDENTIFIED WITH CORRESPONDING OPERATIONS OF THE
29--      ACTUAL TYPE.
30
31-- HISTORY:
32--      TBN 09/14/88  CREATED ORIGINAL TEST.
33
34WITH REPORT; USE REPORT;
35PROCEDURE CC3230A 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 ("CC3230A", "CHECK THAT A PRIVATE OR LIMITED PRIVATE " &
53                      "FORMAL TYPE DENOTES ITS ACTUAL PARAMETER AN " &
54                      "ENUMERATION TYPE, AND OPERATIONS OF THE " &
55                      "FORMAL TYPE ARE IDENTIFIED WITH CORRESPONDING " &
56                      "OPERATIONS OF THE ACTUAL TYPE");
57
58     DECLARE
59          TYPE ENUM IS (RED, YELLOW, GREEN, BLUE);
60          OBJ_ENU : ENUM := RED;
61
62          PACKAGE P2 IS NEW P (ENUM);
63          USE P2;
64
65          TYPE NEW_T IS NEW SUB_T;
66          OBJ_NEWT : NEW_T;
67     BEGIN
68          PAC_VAR := SUB_T'(RED);
69          IF (PAC_VAR < OBJ_ENU) OR (PAC_VAR > OBJ_ENU) THEN
70               FAILED ("INCORRECT RESULTS - 1");
71          END IF;
72          IF PAC_VAR NOT IN ENUM THEN
73               FAILED ("INCORRECT RESULTS - 2");
74          END IF;
75          IF OBJ_ENU NOT IN SUB_T THEN
76               FAILED ("INCORRECT RESULTS - 3");
77          END IF;
78          IF ENUM'VAL(0) /= SUB_T'VAL(0) THEN
79               FAILED ("INCORRECT RESULTS - 4");
80          END IF;
81          OBJ_ENU := SUB_T'SUCC(PAC_VAR);
82          IF SUB_T'POS(RED) /= 0 AND THEN OBJ_ENU /= BLUE THEN
83               FAILED ("INCORRECT RESULTS - 5");
84          END IF;
85          OBJ_NEWT := BLUE;
86          OBJ_NEWT := NEW_T'PRED(OBJ_NEWT);
87          IF OBJ_NEWT NOT IN NEW_T THEN
88               FAILED ("INCORRECT RESULTS - 6");
89          END IF;
90          IF NEW_T'WIDTH /= 6 THEN
91               FAILED ("INCORRECT RESULTS - 7");
92          END IF;
93     END;
94
95     DECLARE
96          TYPE ENUM IS (RED, YELLOW, GREEN, BLUE);
97          OBJ_ENU : ENUM := RED;
98
99          PACKAGE P2 IS NEW LP (ENUM);
100          USE P2;
101
102          TYPE NEW_T IS NEW SUB_T;
103          OBJ_NEWT : NEW_T;
104     BEGIN
105          PAC_VAR := SUB_T'(RED);
106          IF (PAC_VAR < OBJ_ENU) OR (PAC_VAR > OBJ_ENU) THEN
107               FAILED ("INCORRECT RESULTS - 8");
108          END IF;
109          IF PAC_VAR NOT IN ENUM THEN
110               FAILED ("INCORRECT RESULTS - 9");
111          END IF;
112          IF OBJ_ENU NOT IN SUB_T THEN
113               FAILED ("INCORRECT RESULTS - 10");
114          END IF;
115          IF ENUM'VAL(0) /= SUB_T'VAL(0) THEN
116               FAILED ("INCORRECT RESULTS - 11");
117          END IF;
118          OBJ_ENU := SUB_T'SUCC(PAC_VAR);
119          IF SUB_T'POS(RED) /= 0 AND THEN OBJ_ENU /= BLUE THEN
120               FAILED ("INCORRECT RESULTS - 12");
121          END IF;
122          OBJ_NEWT := BLUE;
123          OBJ_NEWT := NEW_T'PRED(OBJ_NEWT);
124          IF OBJ_NEWT NOT IN NEW_T THEN
125               FAILED ("INCORRECT RESULTS - 13");
126          END IF;
127          IF NEW_T'WIDTH /= 6 THEN
128               FAILED ("INCORRECT RESULTS - 14");
129          END IF;
130     END;
131
132     RESULT;
133END CC3230A;
134