1 |
294 |
jeremybenn |
-- CD1C03A.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 SIZE
|
28 |
|
|
-- CLAUSE.
|
29 |
|
|
|
30 |
|
|
-- HISTORY:
|
31 |
|
|
-- JET 09/16/87 CREATED ORIGINAL TEST.
|
32 |
|
|
-- DHH 03/30/89 CHANGED SPECIFIED_SIZE TO 5, ADDED CHECK ON
|
33 |
|
|
-- REPRESENTATION CLAUSES, AND CHANGED THE TEST
|
34 |
|
|
-- EXTENSION FROM '.DEP' TO '.ADA'.
|
35 |
|
|
|
36 |
|
|
WITH REPORT; USE REPORT;
|
37 |
|
|
WITH LENGTH_CHECK; -- CONTAINS A CALL TO 'FAILED'.
|
38 |
|
|
PROCEDURE CD1C03A IS
|
39 |
|
|
|
40 |
|
|
SPECIFIED_SIZE : CONSTANT := 5;
|
41 |
|
|
|
42 |
|
|
TYPE PARENT_TYPE IS RANGE -8 .. 7;
|
43 |
|
|
|
44 |
|
|
FOR PARENT_TYPE'SIZE USE SPECIFIED_SIZE;
|
45 |
|
|
PT : PARENT_TYPE := -7;
|
46 |
|
|
|
47 |
|
|
TYPE DERIVED_TYPE IS NEW PARENT_TYPE;
|
48 |
|
|
|
49 |
|
|
DT : DERIVED_TYPE := -7;
|
50 |
|
|
PROCEDURE CHECK_1 IS NEW LENGTH_CHECK (DERIVED_TYPE);
|
51 |
|
|
PROCEDURE CHECK_2 IS NEW LENGTH_CHECK (PARENT_TYPE);
|
52 |
|
|
|
53 |
|
|
BEGIN
|
54 |
|
|
|
55 |
|
|
TEST("CD1C03A", "CHECK THAT THE SIZE OF A DERIVED TYPE IS " &
|
56 |
|
|
"INHERITED FROM THE PARENT IF THE SIZE OF " &
|
57 |
|
|
"THE PARENT WAS DETERMINED BY A SIZE CLAUSE");
|
58 |
|
|
|
59 |
|
|
IF PARENT_TYPE'SIZE /= IDENT_INT (SPECIFIED_SIZE) THEN
|
60 |
|
|
FAILED ("PARENT_TYPE'SIZE /= " &
|
61 |
|
|
INTEGER'IMAGE(SPECIFIED_SIZE) &
|
62 |
|
|
". ACTUAL SIZE IS" &
|
63 |
|
|
INTEGER'IMAGE(PARENT_TYPE'SIZE));
|
64 |
|
|
END IF;
|
65 |
|
|
|
66 |
|
|
IF DERIVED_TYPE'SIZE /= IDENT_INT (SPECIFIED_SIZE) THEN
|
67 |
|
|
FAILED ("DERIVED_TYPE'SIZE /= " &
|
68 |
|
|
INTEGER'IMAGE(SPECIFIED_SIZE) &
|
69 |
|
|
". ACTUAL SIZE IS" &
|
70 |
|
|
INTEGER'IMAGE(DERIVED_TYPE'SIZE));
|
71 |
|
|
END IF;
|
72 |
|
|
|
73 |
|
|
IF DT'SIZE < IDENT_INT (SPECIFIED_SIZE) THEN
|
74 |
|
|
FAILED ("DT'SIZE SHOULD NOT BE LESS THAN" &
|
75 |
|
|
INTEGER'IMAGE(SPECIFIED_SIZE) &
|
76 |
|
|
". ACTUAL SIZE IS" &
|
77 |
|
|
INTEGER'IMAGE(DT'SIZE));
|
78 |
|
|
END IF;
|
79 |
|
|
|
80 |
|
|
CHECK_1 (DT, 5, "DERIVED_TYPE");
|
81 |
|
|
CHECK_2 (PT, 5, "PARENT_TYPE");
|
82 |
|
|
RESULT;
|
83 |
|
|
|
84 |
|
|
END CD1C03A;
|