1 |
149 |
jeremybenn |
-- CD1C03B.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 THE SIZE OF A DERIVED TYPE IS INHERITED FROM THE
|
27 |
|
|
-- PARENT IF THE SIZE OF THE PARENT WAS DETERMINED BY A PRAGMA
|
28 |
|
|
-- PACK.
|
29 |
|
|
|
30 |
|
|
-- HISTORY:
|
31 |
|
|
-- JET 09/16/87 CREATED ORIGINAL TEST.
|
32 |
|
|
-- PWB 03/27/89 MODIFIED COMPARISON OF OBJECT SIZE TO PARENT SIZE.
|
33 |
|
|
|
34 |
|
|
WITH REPORT; USE REPORT;
|
35 |
|
|
PROCEDURE CD1C03B IS
|
36 |
|
|
|
37 |
|
|
TYPE ENUM IS (E1, E2, E3);
|
38 |
|
|
|
39 |
|
|
TYPE NORMAL_TYPE IS ARRAY (1 .. 100) OF ENUM;
|
40 |
|
|
|
41 |
|
|
TYPE PARENT_TYPE IS ARRAY (1 .. 100) OF ENUM;
|
42 |
|
|
PRAGMA PACK (PARENT_TYPE);
|
43 |
|
|
|
44 |
|
|
TYPE DERIVED_TYPE IS NEW PARENT_TYPE;
|
45 |
|
|
X : DERIVED_TYPE := (OTHERS => ENUM'FIRST);
|
46 |
|
|
|
47 |
|
|
BEGIN
|
48 |
|
|
|
49 |
|
|
TEST("CD1C03B", "CHECK THAT THE SIZE OF A DERIVED TYPE IS " &
|
50 |
|
|
"INHERITED FROM THE PARENT IF THE SIZE OF " &
|
51 |
|
|
"THE PARENT WAS DETERMINED BY A PRAGMA PACK");
|
52 |
|
|
|
53 |
|
|
IF PARENT_TYPE'SIZE = IDENT_INT (NORMAL_TYPE'SIZE) THEN
|
54 |
|
|
COMMENT ("PRAGMA PACK HAD NO EFFECT ON THE SIZE OF " &
|
55 |
|
|
"PARENT_TYPE, WHICH IS" &
|
56 |
|
|
INTEGER'IMAGE(PARENT_TYPE'SIZE));
|
57 |
|
|
ELSIF PARENT_TYPE'SIZE > IDENT_INT (NORMAL_TYPE'SIZE) THEN
|
58 |
|
|
FAILED ("PARENT_TYPE'SIZE SHOULD NOT BE GREATER THAN" &
|
59 |
|
|
INTEGER'IMAGE(NORMAL_TYPE'SIZE) &
|
60 |
|
|
". ACTUAL SIZE IS" &
|
61 |
|
|
INTEGER'IMAGE(PARENT_TYPE'SIZE));
|
62 |
|
|
END IF;
|
63 |
|
|
|
64 |
|
|
IF DERIVED_TYPE'SIZE > IDENT_INT (PARENT_TYPE'SIZE) THEN
|
65 |
|
|
FAILED ("DERIVED_TYPE'SIZE SHOULD NOT BE GREATER THAN" &
|
66 |
|
|
INTEGER'IMAGE(PARENT_TYPE'SIZE) &
|
67 |
|
|
". ACTUAL SIZE IS" &
|
68 |
|
|
INTEGER'IMAGE(DERIVED_TYPE'SIZE));
|
69 |
|
|
END IF;
|
70 |
|
|
|
71 |
|
|
IF X'SIZE < DERIVED_TYPE'SIZE THEN
|
72 |
|
|
FAILED ("OBJECT SIZE TOO LARGE. FIRST VALUE IS " &
|
73 |
|
|
ENUM'IMAGE ( X(1) ) );
|
74 |
|
|
END IF;
|
75 |
|
|
|
76 |
|
|
RESULT;
|
77 |
|
|
|
78 |
|
|
END CD1C03B;
|