1 |
720 |
jeremybenn |
-- CD2A21C.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 SIZE SPECIFICATION CAN BE GIVEN FOR AN ENUMERATION
|
27 |
|
|
-- TYPE:
|
28 |
|
|
-- IN THE VISIBLE OR PRIVATE PART OF A PACKAGE FOR A TYPE
|
29 |
|
|
-- DECLARED IN THE VISIBLE PART;
|
30 |
|
|
-- FOR A DERIVED ENUMERATION TYPE;
|
31 |
|
|
-- FOR A DERIVED PRIVATE TYPE WHOSE FULL DECLARATION IS AS
|
32 |
|
|
-- AN ENUMERATION TYPE.
|
33 |
|
|
|
34 |
|
|
-- HISTORY:
|
35 |
|
|
-- PWB 06/17/87 CREATED ORIGINAL TEST.
|
36 |
|
|
-- DHH 04/17/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED
|
37 |
|
|
-- OPERATORS ON 'SIZE TESTS, AND ADDED CHECK ON
|
38 |
|
|
-- REPRESENTATION CLAUSE.
|
39 |
|
|
-- JRL 03/26/92 REMOVED TESTING OF NONOBJECTIVE TYPES.
|
40 |
|
|
|
41 |
|
|
WITH REPORT; USE REPORT;
|
42 |
|
|
WITH LENGTH_CHECK; -- CONTAINS A CALL TO 'FAILED'.
|
43 |
|
|
PROCEDURE CD2A21C IS
|
44 |
|
|
|
45 |
|
|
TYPE BASIC_ENUM IS (A, B, C, D, E);
|
46 |
|
|
SPECIFIED_SIZE : CONSTANT := BASIC_ENUM'SIZE;
|
47 |
|
|
|
48 |
|
|
MINIMUM_SIZE : INTEGER := IDENT_INT(SPECIFIED_SIZE);
|
49 |
|
|
|
50 |
|
|
TYPE DERIVED_ENUM IS NEW BASIC_ENUM;
|
51 |
|
|
FOR DERIVED_ENUM'SIZE USE SPECIFIED_SIZE;
|
52 |
|
|
|
53 |
|
|
PACKAGE P IS
|
54 |
|
|
TYPE ENUM_IN_P IS (A1, B1, C1, D1, E1, F1, G1);
|
55 |
|
|
FOR ENUM_IN_P'SIZE USE SPECIFIED_SIZE;
|
56 |
|
|
TYPE PRIVATE_ENUM IS PRIVATE;
|
57 |
|
|
TYPE ALT_ENUM_IN_P IS (A2, B2, C2, D2, E2, F2, G2);
|
58 |
|
|
PRIVATE
|
59 |
|
|
TYPE PRIVATE_ENUM IS (A3, B3, C3, D3, E3, F3, G3);
|
60 |
|
|
FOR ALT_ENUM_IN_P'SIZE USE SPECIFIED_SIZE;
|
61 |
|
|
END P;
|
62 |
|
|
|
63 |
|
|
TYPE DERIVED_PRIVATE_ENUM IS NEW P.PRIVATE_ENUM;
|
64 |
|
|
FOR DERIVED_PRIVATE_ENUM'SIZE USE SPECIFIED_SIZE;
|
65 |
|
|
|
66 |
|
|
USE P;
|
67 |
|
|
|
68 |
|
|
PROCEDURE CHECK_1 IS NEW LENGTH_CHECK (DERIVED_ENUM);
|
69 |
|
|
PROCEDURE CHECK_2 IS NEW LENGTH_CHECK (ENUM_IN_P);
|
70 |
|
|
PROCEDURE CHECK_3 IS NEW LENGTH_CHECK (ALT_ENUM_IN_P);
|
71 |
|
|
|
72 |
|
|
BEGIN
|
73 |
|
|
|
74 |
|
|
TEST("CD2A21C", "CHECK THAT 'SIZE SPECIFICATIONS CAN BE GIVEN " &
|
75 |
|
|
"IN THE VISIBLE OR PRIVATE PART OF A PACKAGE " &
|
76 |
|
|
"FOR ENUMERATION TYPES DECLARED IN THE VISIBLE " &
|
77 |
|
|
"PART, AND FOR DERIVED ENUMERATION " &
|
78 |
|
|
"TYPES AND DERIVED PRIVATE TYPES WHOSE FULL " &
|
79 |
|
|
"DECLARATIONS ARE AS ENUMERATION TYPES");
|
80 |
|
|
|
81 |
|
|
CHECK_1 (C, SPECIFIED_SIZE, "DERIVED_ENUM");
|
82 |
|
|
CHECK_2 (C1, SPECIFIED_SIZE, "ENUM_IN_P");
|
83 |
|
|
CHECK_3 (C2, SPECIFIED_SIZE, "ALT_ENUM_IN_P");
|
84 |
|
|
|
85 |
|
|
IF DERIVED_ENUM'SIZE /= MINIMUM_SIZE THEN
|
86 |
|
|
FAILED ("DERIVED_ENUM'SIZE SHOULD NOT BE GREATER THAN" &
|
87 |
|
|
INTEGER'IMAGE(MINIMUM_SIZE) &
|
88 |
|
|
". ACTUAL SIZE IS" &
|
89 |
|
|
INTEGER'IMAGE(DERIVED_ENUM'SIZE));
|
90 |
|
|
END IF;
|
91 |
|
|
|
92 |
|
|
IF ENUM_IN_P'SIZE /= MINIMUM_SIZE THEN
|
93 |
|
|
FAILED ("ENUM_IN_P'SIZE SHOULD NOT BE GREATER THAN" &
|
94 |
|
|
INTEGER'IMAGE(MINIMUM_SIZE) &
|
95 |
|
|
". ACTUAL SIZE IS" &
|
96 |
|
|
INTEGER'IMAGE(ENUM_IN_P'SIZE));
|
97 |
|
|
END IF;
|
98 |
|
|
|
99 |
|
|
IF ALT_ENUM_IN_P'SIZE /= MINIMUM_SIZE THEN
|
100 |
|
|
FAILED ("ALT_ENUM_IN_P'SIZE SHOULD NOT BE GREATER THAN" &
|
101 |
|
|
INTEGER'IMAGE(MINIMUM_SIZE) &
|
102 |
|
|
". ACTUAL SIZE IS" &
|
103 |
|
|
INTEGER'IMAGE(ALT_ENUM_IN_P'SIZE));
|
104 |
|
|
END IF;
|
105 |
|
|
|
106 |
|
|
IF DERIVED_PRIVATE_ENUM'SIZE /= MINIMUM_SIZE THEN
|
107 |
|
|
|
108 |
|
|
FAILED ("DERIVED_PRIVATE_ENUM'SIZE SHOULD NOT BE GREATER " &
|
109 |
|
|
"THAN " & INTEGER'IMAGE(MINIMUM_SIZE) &
|
110 |
|
|
". ACTUAL SIZE IS" &
|
111 |
|
|
INTEGER'IMAGE(DERIVED_PRIVATE_ENUM'SIZE));
|
112 |
|
|
END IF;
|
113 |
|
|
|
114 |
|
|
RESULT;
|
115 |
|
|
|
116 |
|
|
END CD2A21C;
|