1 |
294 |
jeremybenn |
-- C64109E.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 |
|
|
-- CHECK THAT ARRAYS THAT ARE COMPONENTS OF RECORDS ARE PASSED CORRECTLY
|
26 |
|
|
-- TO SUBPROGRAMS. SPECIFICALLY,
|
27 |
|
|
-- (E) CHECK THE CASE WHERE THE FORMAL IS UNCONSTRAINED, AND ARRAYS
|
28 |
|
|
-- WITH DIFFERENT BOUNDS ARE PASSED AS ACTUALS.
|
29 |
|
|
|
30 |
|
|
-- CPP 8/20/84
|
31 |
|
|
|
32 |
|
|
WITH REPORT; USE REPORT;
|
33 |
|
|
PROCEDURE C64109E IS
|
34 |
|
|
|
35 |
|
|
BEGIN
|
36 |
|
|
TEST ("C64109E", "CHECK THAT ARRAYS WHICH ARE COMPONENTS OF " &
|
37 |
|
|
"RECORDS ARE PASSED CORRECTLY TO SUBPROGRAMS - " &
|
38 |
|
|
"ARRAYS WITH DIFFERENT BOUNDS PASSED TO UNCONSTRAINED " &
|
39 |
|
|
"FORMAL");
|
40 |
|
|
|
41 |
|
|
DECLARE -- (E)
|
42 |
|
|
|
43 |
|
|
SUBTYPE SUBINT IS INTEGER RANGE 0..5;
|
44 |
|
|
TYPE ARRAY_TYPE IS ARRAY (SUBINT RANGE <>) OF BOOLEAN;
|
45 |
|
|
TYPE RECORD_TYPE IS
|
46 |
|
|
RECORD
|
47 |
|
|
A : ARRAY_TYPE (IDENT_INT(0)..IDENT_INT(2));
|
48 |
|
|
B : ARRAY_TYPE (1..3);
|
49 |
|
|
END RECORD;
|
50 |
|
|
REC : RECORD_TYPE := (A => (0..2 => IDENT_BOOL(TRUE)),
|
51 |
|
|
B => (1..3 => IDENT_BOOL(FALSE)));
|
52 |
|
|
BOOL : BOOLEAN;
|
53 |
|
|
|
54 |
|
|
PROCEDURE P1 (ARR : ARRAY_TYPE; ARR2 : ARRAY_TYPE) IS
|
55 |
|
|
BEGIN
|
56 |
|
|
IF ARR /= (TRUE, TRUE, TRUE) THEN
|
57 |
|
|
FAILED ("IN PARAM NOT PASSED CORRECTLY");
|
58 |
|
|
END IF;
|
59 |
|
|
IF ARR'FIRST /= IDENT_INT(0) OR ARR'LAST /= 2 THEN
|
60 |
|
|
FAILED ("WRONG IN PARAMETER BOUNDS - 1");
|
61 |
|
|
END IF;
|
62 |
|
|
IF ARR2 /= (FALSE, FALSE, FALSE) THEN
|
63 |
|
|
FAILED ("IN PARAM NOT PASSED CORRECTLY - 2");
|
64 |
|
|
END IF;
|
65 |
|
|
IF ARR2'FIRST /= 1 OR ARR2'LAST /= IDENT_INT(3) THEN
|
66 |
|
|
FAILED ("WRONG IN PARAMETER BOUNDS - 2");
|
67 |
|
|
END IF;
|
68 |
|
|
END P1;
|
69 |
|
|
|
70 |
|
|
FUNCTION F1 ( ARR : ARRAY_TYPE; ARR2 : ARRAY_TYPE)
|
71 |
|
|
RETURN BOOLEAN IS
|
72 |
|
|
BEGIN
|
73 |
|
|
IF ARR /= (TRUE, TRUE, TRUE) THEN
|
74 |
|
|
FAILED ("IN PARAM NOT PASSED CORRECTLY TO FN");
|
75 |
|
|
END IF;
|
76 |
|
|
IF ARR'FIRST /= IDENT_INT(0) OR ARR'LAST /= 2 THEN
|
77 |
|
|
FAILED ("WRONG IN PARAMETER BOUNDS FOR FN - 1");
|
78 |
|
|
END IF;
|
79 |
|
|
IF ARR2 /= (FALSE, FALSE, FALSE) THEN
|
80 |
|
|
FAILED ("IN PARAM NOT PASSED CORRECTLY TO FN");
|
81 |
|
|
END IF;
|
82 |
|
|
IF ARR2'FIRST /= 1 OR ARR2'LAST /= IDENT_INT(3) THEN
|
83 |
|
|
FAILED ("WRONG IN PARAMETER BOUNDS FOR FN - 2");
|
84 |
|
|
END IF;
|
85 |
|
|
RETURN TRUE;
|
86 |
|
|
END F1;
|
87 |
|
|
|
88 |
|
|
PROCEDURE P2 (ARR : IN OUT ARRAY_TYPE;
|
89 |
|
|
ARR2 : IN OUT ARRAY_TYPE) IS
|
90 |
|
|
BEGIN
|
91 |
|
|
IF ARR /= (TRUE, TRUE, TRUE) THEN
|
92 |
|
|
FAILED ("IN OUT PARAM NOT PASSED CORRECTLY");
|
93 |
|
|
END IF;
|
94 |
|
|
IF ARR'FIRST /= IDENT_INT(0) OR ARR'LAST /= 2 THEN
|
95 |
|
|
FAILED ("WRONG IN OUT PARAMETER BOUNDS - 1");
|
96 |
|
|
END IF;
|
97 |
|
|
IF ARR2 /= (FALSE, FALSE, FALSE) THEN
|
98 |
|
|
FAILED ("IN OUT PARAM NOT PASSED CORRECTLY");
|
99 |
|
|
END IF;
|
100 |
|
|
IF ARR2'FIRST /= 1 OR ARR2'LAST /= IDENT_INT(3) THEN
|
101 |
|
|
FAILED ("WRONG IN OUT PARAMETER BOUNDS - 2");
|
102 |
|
|
END IF;
|
103 |
|
|
ARR := (ARR'RANGE => FALSE);
|
104 |
|
|
ARR2 := (ARR2'RANGE => TRUE);
|
105 |
|
|
END P2;
|
106 |
|
|
|
107 |
|
|
PROCEDURE P3 (ARR : OUT ARRAY_TYPE; ARR2 : OUT ARRAY_TYPE) IS
|
108 |
|
|
BEGIN
|
109 |
|
|
IF ARR'FIRST /= IDENT_INT(0) OR ARR'LAST /= 2 THEN
|
110 |
|
|
FAILED ("WRONG OUT PARAMETER BOUNDS - 1");
|
111 |
|
|
END IF;
|
112 |
|
|
IF ARR2'FIRST /= 1 OR ARR2'LAST /= IDENT_INT(3) THEN
|
113 |
|
|
FAILED ("WRONG OUT PARAMETER BOUNDS - 2");
|
114 |
|
|
END IF;
|
115 |
|
|
ARR := (ARR'RANGE => FALSE);
|
116 |
|
|
ARR2 := (ARR2'RANGE => TRUE);
|
117 |
|
|
END P3;
|
118 |
|
|
|
119 |
|
|
BEGIN -- (E)
|
120 |
|
|
|
121 |
|
|
P1 (REC.A, REC.B);
|
122 |
|
|
IF REC.A /= (TRUE, TRUE, TRUE) THEN
|
123 |
|
|
FAILED ("IN PARAM CHANGED BY PROCEDURE");
|
124 |
|
|
END IF;
|
125 |
|
|
IF REC.B /= (FALSE, FALSE, FALSE) THEN
|
126 |
|
|
FAILED ("IN PARAM CHANGED BY PROCEDURE - 2");
|
127 |
|
|
END IF;
|
128 |
|
|
|
129 |
|
|
BOOL := F1 (REC.A, REC.B);
|
130 |
|
|
IF REC.A /= (TRUE, TRUE, TRUE) THEN
|
131 |
|
|
FAILED ("IN PARAM CHANGED BY FUNCTION");
|
132 |
|
|
END IF;
|
133 |
|
|
IF REC.B /= (FALSE, FALSE, FALSE) THEN
|
134 |
|
|
FAILED ("IN PARAM CHANGED BY FUNCTION - 2");
|
135 |
|
|
END IF;
|
136 |
|
|
|
137 |
|
|
P2 (REC.A, REC.B);
|
138 |
|
|
IF REC.A /= (FALSE, FALSE, FALSE) THEN
|
139 |
|
|
FAILED ("IN OUT PARAM RETURNED INCORRECTLY");
|
140 |
|
|
END IF;
|
141 |
|
|
IF REC.B /= (TRUE, TRUE, TRUE) THEN
|
142 |
|
|
FAILED ("IN OUT PARAM RETURNED INCORRECTLY - 2");
|
143 |
|
|
END IF;
|
144 |
|
|
|
145 |
|
|
P3 (REC.A, REC.B);
|
146 |
|
|
IF REC.A /= (FALSE, FALSE, FALSE) THEN
|
147 |
|
|
FAILED ("OUT PARAM RETURNED INCORRECTLY");
|
148 |
|
|
END IF;
|
149 |
|
|
IF REC.B /= (TRUE, TRUE, TRUE) THEN
|
150 |
|
|
FAILED ("OUT PARAM RETURNED INCORRECTLY - 2");
|
151 |
|
|
END IF;
|
152 |
|
|
|
153 |
|
|
END; -- (E)
|
154 |
|
|
|
155 |
|
|
RESULT;
|
156 |
|
|
END C64109E;
|