1 |
12 |
jlechner |
-- CD1C03H.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 RECORD SIZE AND THE COMPONENT POSITIONS AND
|
27 |
|
|
-- SIZES OF A DERIVED RECORD TYPE ARE INHERITED FROM THE
|
28 |
|
|
-- PARENT IF THOSE ASPECTS OF THE PARENT WERE DETERMINED BY A
|
29 |
|
|
-- RECORD REPRESENTATION CLAUSE.
|
30 |
|
|
|
31 |
|
|
-- HISTORY:
|
32 |
|
|
-- BCB 03/20/89 CHANGED EXTENSION FROM '.ADA' TO '.DEP'.
|
33 |
|
|
-- JET 09/17/87 CREATED ORIGINAL TEST.
|
34 |
|
|
|
35 |
|
|
WITH REPORT; USE REPORT;
|
36 |
|
|
WITH SYSTEM; USE SYSTEM;
|
37 |
|
|
|
38 |
|
|
PROCEDURE CD1C03H IS
|
39 |
|
|
|
40 |
|
|
UNITS_PER_INTEGER : CONSTANT :=
|
41 |
|
|
(INTEGER'SIZE + SYSTEM.STORAGE_UNIT - 1) /
|
42 |
|
|
SYSTEM.STORAGE_UNIT;
|
43 |
|
|
|
44 |
|
|
TYPE E_TYPE IS (RED, BLUE, GREEN);
|
45 |
|
|
|
46 |
|
|
TYPE PARENT_TYPE IS
|
47 |
|
|
RECORD
|
48 |
|
|
I : INTEGER RANGE 0 .. 127 := 127;
|
49 |
|
|
C : CHARACTER := 'S';
|
50 |
|
|
B : BOOLEAN := FALSE;
|
51 |
|
|
E : E_TYPE := BLUE;
|
52 |
|
|
END RECORD;
|
53 |
|
|
|
54 |
|
|
FOR PARENT_TYPE USE
|
55 |
|
|
RECORD
|
56 |
|
|
C AT 0 * UNITS_PER_INTEGER RANGE 0 .. CHARACTER'SIZE - 1;
|
57 |
|
|
B AT 1 * UNITS_PER_INTEGER RANGE 0 .. BOOLEAN'SIZE - 1;
|
58 |
|
|
I AT 2 * UNITS_PER_INTEGER RANGE 0 .. INTEGER'SIZE/2 - 1;
|
59 |
|
|
E AT 3 * UNITS_PER_INTEGER RANGE 0 .. CHARACTER'SIZE - 1;
|
60 |
|
|
END RECORD;
|
61 |
|
|
|
62 |
|
|
TYPE DERIVED_TYPE IS NEW PARENT_TYPE;
|
63 |
|
|
|
64 |
|
|
P_REC : PARENT_TYPE;
|
65 |
|
|
REC : DERIVED_TYPE;
|
66 |
|
|
|
67 |
|
|
BEGIN
|
68 |
|
|
|
69 |
|
|
TEST("CD1C03H", "CHECK THAT THE RECORD SIZE AND THE COMPONENT " &
|
70 |
|
|
"POSITIONS AND SIZES OF A DERIVED RECORD " &
|
71 |
|
|
"TYPE ARE INHERITED FROM THE PARENT IF THOSE " &
|
72 |
|
|
"ASPECTS OF THE PARENT WERE DETERMINED BY " &
|
73 |
|
|
"A RECORD REPRESENTATION CLAUSE");
|
74 |
|
|
|
75 |
|
|
IF DERIVED_TYPE'SIZE /= IDENT_INT (PARENT_TYPE'SIZE) THEN
|
76 |
|
|
FAILED ("DERIVED_TYPE'SIZE WAS NOT INHERITED FROM " &
|
77 |
|
|
"PARENT_TYPE");
|
78 |
|
|
END IF;
|
79 |
|
|
|
80 |
|
|
IF REC.I'SIZE /= P_REC.I'SIZE OR
|
81 |
|
|
REC.C'SIZE /= P_REC.C'SIZE OR
|
82 |
|
|
REC.B'SIZE /= P_REC.B'SIZE OR
|
83 |
|
|
REC.E'SIZE /= P_REC.E'SIZE THEN
|
84 |
|
|
FAILED ("THE SIZES OF DERIVED_TYPE ELEMENTS WERE NOT " &
|
85 |
|
|
"INHERITED FROM PARENT_TYPE");
|
86 |
|
|
END IF;
|
87 |
|
|
|
88 |
|
|
REC := (12, 'T', TRUE, RED);
|
89 |
|
|
|
90 |
|
|
IF (REC.I /= 12) OR (REC.C /= 'T') OR
|
91 |
|
|
(NOT REC.B) OR (REC.E /= RED) THEN
|
92 |
|
|
FAILED ("THE VALUES OF DERIVED_TYPE COMPONENTS WERE " &
|
93 |
|
|
"INCORRECT");
|
94 |
|
|
END IF;
|
95 |
|
|
|
96 |
|
|
IF REC.I'POSITION /= P_REC.I'POSITION OR
|
97 |
|
|
REC.C'POSITION /= P_REC.C'POSITION OR
|
98 |
|
|
REC.B'POSITION /= P_REC.B'POSITION OR
|
99 |
|
|
REC.E'POSITION /= P_REC.E'POSITION THEN
|
100 |
|
|
FAILED ("THE POSITIONS OF DERIVED_TYPE COMPONENTS WERE " &
|
101 |
|
|
"NOT INHERITED FROM PARENT_TYPE");
|
102 |
|
|
END IF;
|
103 |
|
|
|
104 |
|
|
IF REC.I'FIRST_BIT /= P_REC.I'FIRST_BIT OR
|
105 |
|
|
REC.C'FIRST_BIT /= P_REC.C'FIRST_BIT OR
|
106 |
|
|
REC.B'FIRST_BIT /= P_REC.B'FIRST_BIT OR
|
107 |
|
|
REC.E'FIRST_BIT /= P_REC.E'FIRST_BIT THEN
|
108 |
|
|
FAILED ("THE FIRST_BITS OF DERIVED_TYPE COMPONENTS WERE " &
|
109 |
|
|
"NOT INHERITED FROM PARENT_TYPE");
|
110 |
|
|
END IF;
|
111 |
|
|
|
112 |
|
|
IF REC.I'LAST_BIT /= P_REC.I'LAST_BIT OR
|
113 |
|
|
REC.C'LAST_BIT /= P_REC.C'LAST_BIT OR
|
114 |
|
|
REC.B'LAST_BIT /= P_REC.B'LAST_BIT OR
|
115 |
|
|
REC.E'LAST_BIT /= P_REC.E'LAST_BIT THEN
|
116 |
|
|
FAILED ("THE LAST_BITS OF DERIVED_TYPE COMPONENTS WERE " &
|
117 |
|
|
"NOT INHERITED FROM PARENT_TYPE");
|
118 |
|
|
END IF;
|
119 |
|
|
|
120 |
|
|
RESULT;
|
121 |
|
|
|
122 |
|
|
END CD1C03H;
|