1 |
149 |
jeremybenn |
-- CD2A31C.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 INTEGER 'SIZE SPECIFICATIONS CAN BE GIVEN:
|
27 |
|
|
-- IN THE VISIBLE OR PRIVATE PART OF A PACKAGE FOR A TYPE
|
28 |
|
|
-- DECLARED IN THE VISIBLE PART;
|
29 |
|
|
-- FOR A DERIVED INTEGER TYPE;
|
30 |
|
|
-- FOR A DERIVED PRIVATE TYPE WHOSE FULL DECLARATION IS AS
|
31 |
|
|
-- AN INTEGER TYPE;
|
32 |
|
|
-- FOR AN INTEGER TYPE IN A GENERIC UNIT.
|
33 |
|
|
|
34 |
|
|
-- HISTORY:
|
35 |
|
|
-- PWB 06/17/87 CREATED ORIGINAL TEST.
|
36 |
|
|
-- DHH 04/06/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED
|
37 |
|
|
-- SIZE CLAUSE VALUE TO 9, AND ADDED REPRESENTAION
|
38 |
|
|
-- CLAUSE CHECK AND INCLUDED TEST FOR INTEGER IN A
|
39 |
|
|
-- GENERIC UNIT.
|
40 |
|
|
-- JRL 03/27/92 REMOVED TESTING OF NONOBJECTIVE TYPES.
|
41 |
|
|
-- DTN 06/17/92 REMOVED THE LENGTH CLAUSE FOR TYPE PRIVATE_INT.
|
42 |
|
|
|
43 |
|
|
WITH REPORT; USE REPORT;
|
44 |
|
|
WITH LENGTH_CHECK; -- CONTAINS A CALL TO 'FAILED'.
|
45 |
|
|
PROCEDURE CD2A31C IS
|
46 |
|
|
|
47 |
|
|
TYPE BASIC_INT IS RANGE -60 .. 80;
|
48 |
|
|
SPECIFIED_SIZE : CONSTANT := 9;
|
49 |
|
|
|
50 |
|
|
TYPE DERIVED_INT IS NEW BASIC_INT;
|
51 |
|
|
FOR DERIVED_INT'SIZE USE SPECIFIED_SIZE;
|
52 |
|
|
|
53 |
|
|
PACKAGE P IS
|
54 |
|
|
TYPE INT_IN_P IS RANGE -125 .. 125;
|
55 |
|
|
FOR INT_IN_P'SIZE USE SPECIFIED_SIZE;
|
56 |
|
|
TYPE PRIVATE_INT IS PRIVATE;
|
57 |
|
|
TYPE ALT_INT_IN_P IS RANGE -125 .. 125;
|
58 |
|
|
PRIVATE
|
59 |
|
|
TYPE PRIVATE_INT IS RANGE -125 .. 125;
|
60 |
|
|
FOR ALT_INT_IN_P'SIZE USE SPECIFIED_SIZE;
|
61 |
|
|
END P;
|
62 |
|
|
|
63 |
|
|
USE P;
|
64 |
|
|
TYPE DERIVED_PRIVATE_INT IS NEW PRIVATE_INT;
|
65 |
|
|
FOR DERIVED_PRIVATE_INT'SIZE USE SPECIFIED_SIZE;
|
66 |
|
|
MINIMUM_SIZE : INTEGER := IDENT_INT(SPECIFIED_SIZE);
|
67 |
|
|
|
68 |
|
|
-- SIZE SPECIFICATION GIVEN IN A GENERIC PROCEDURE.
|
69 |
|
|
|
70 |
|
|
GENERIC
|
71 |
|
|
PROCEDURE GENPROC;
|
72 |
|
|
|
73 |
|
|
PROCEDURE GENPROC IS
|
74 |
|
|
TYPE CHECK_INT IS RANGE -125 .. 125;
|
75 |
|
|
FOR CHECK_INT'SIZE USE SPECIFIED_SIZE;
|
76 |
|
|
|
77 |
|
|
PROCEDURE CHECK_4 IS NEW LENGTH_CHECK (CHECK_INT);
|
78 |
|
|
|
79 |
|
|
BEGIN
|
80 |
|
|
|
81 |
|
|
IF CHECK_INT'SIZE /= MINIMUM_SIZE THEN
|
82 |
|
|
FAILED ("GENERIC CHECK_INT'SIZE IS INCORRECT");
|
83 |
|
|
END IF;
|
84 |
|
|
CHECK_4 (-60, 9, "GENERIC CHECK_INT");
|
85 |
|
|
|
86 |
|
|
END GENPROC;
|
87 |
|
|
|
88 |
|
|
PROCEDURE NEWPROC IS NEW GENPROC;
|
89 |
|
|
|
90 |
|
|
PROCEDURE CHECK_1 IS NEW LENGTH_CHECK (DERIVED_INT);
|
91 |
|
|
PROCEDURE CHECK_2 IS NEW LENGTH_CHECK (INT_IN_P);
|
92 |
|
|
PROCEDURE CHECK_3 IS NEW LENGTH_CHECK (ALT_INT_IN_P);
|
93 |
|
|
|
94 |
|
|
BEGIN
|
95 |
|
|
|
96 |
|
|
TEST("CD2A31C", "CHECK THAT 'SIZE SPECIFICATIONS CAN BE GIVEN IN " &
|
97 |
|
|
"VISIBLE OR PRIVATE PART OF PACKAGE FOR INTEGER " &
|
98 |
|
|
"TYPE DECLARED IN VISIBLE PART, AND FOR " &
|
99 |
|
|
"DERIVED INTEGER TYPES " &
|
100 |
|
|
"AND DERIVED PRIVATE TYPES WHOSE FULL DECLARATIONS " &
|
101 |
|
|
"ARE AS INTEGER TYPES");
|
102 |
|
|
|
103 |
|
|
CHECK_1 (-60, 9, "DERIVED_INT");
|
104 |
|
|
CHECK_2 (-60, 9, "INT_IN_P");
|
105 |
|
|
CHECK_3 (-60, 9, "ALT_INT_IN_P");
|
106 |
|
|
|
107 |
|
|
NEWPROC;
|
108 |
|
|
|
109 |
|
|
IF DERIVED_INT'SIZE /= MINIMUM_SIZE THEN
|
110 |
|
|
FAILED ("DERIVED_INT'SIZE INCORRECT");
|
111 |
|
|
END IF;
|
112 |
|
|
|
113 |
|
|
IF INT_IN_P'SIZE /= MINIMUM_SIZE THEN
|
114 |
|
|
FAILED ("INT_IN_P'SIZE INCORRECT");
|
115 |
|
|
END IF;
|
116 |
|
|
|
117 |
|
|
IF ALT_INT_IN_P'SIZE /= MINIMUM_SIZE THEN
|
118 |
|
|
FAILED ("ALT_INT_IN_P'SIZE INCORRECT");
|
119 |
|
|
END IF;
|
120 |
|
|
|
121 |
|
|
IF DERIVED_PRIVATE_INT'SIZE /= MINIMUM_SIZE THEN
|
122 |
|
|
FAILED ("DERIVED_PRIVATE_INT'SIZE INCORRECT");
|
123 |
|
|
END IF;
|
124 |
|
|
|
125 |
|
|
RESULT;
|
126 |
|
|
|
127 |
|
|
END CD2A31C;
|