1-- C43214E.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 THE LOWER BOUND FOR THE STRING LITERAL IS DETERMINED BY
26-- THE APPLICABLE INDEX CONSTRAINT, WHEN ONE EXISTS.
27
28-- EG  02/10/84
29
30WITH REPORT;
31
32PROCEDURE C43214E IS
33
34     USE REPORT;
35
36BEGIN
37
38     TEST("C43214E", "INITIALIZATION OF CONSTRAINED ARRAY");
39
40     BEGIN
41
42CASE_D :  BEGIN
43
44--             COMMENT ("CASE D1 : INITIALIZATION OF CONSTRAINED " &
45--                      "ARRAY CONSTANT");
46
47     CASE_D1 : DECLARE
48
49                    D1 : CONSTANT STRING(11 .. 13) := "ABC";
50
51               BEGIN
52
53                    IF D1'FIRST /= 11 THEN
54                         FAILED ("CASE 1 : LOWER BOUND INCORRECT");
55                    ELSIF D1'LAST /= 13 THEN
56                         FAILED ("CASE 1 : UPPER BOUND INCORRECT");
57                    ELSIF D1 /= "ABC" THEN
58                              FAILED ("CASE 1 : ARRAY DOES NOT " &
59                                      "CONTAIN THE CORRECT VALUES");
60                    END IF;
61
62               END CASE_D1;
63
64--             COMMENT ("CASE D2 : INITIALIZATION OF CONSTRAINED " &
65--                      "ARRAY VARIABLE");
66
67     CASE_D2 : DECLARE
68
69                    D2 : STRING(11 .. 13) := "ABC";
70
71               BEGIN
72
73                    IF D2'FIRST /= 11 THEN
74                         FAILED ("CASE 2 : LOWER BOUND INCORRECT");
75                    ELSIF D2'LAST /= 13 THEN
76                         FAILED ("CASE 2 : UPPER BOUND INCORRECT");
77                    ELSIF D2 /= "ABC" THEN
78                         FAILED ("CASE 2 : INCORRECT VALUES");
79                    END IF;
80
81               END CASE_D2;
82
83--             COMMENT ("CASE D3 : INITIALIZATION OF CONSTRAINED " &
84--                      "ARRAY FORMAL PARAMETER OF A SUBPROGRAM");
85
86     CASE_D3 : DECLARE
87
88                    SUBTYPE STD3 IS STRING(IDENT_INT(5) .. 7);
89
90                    PROCEDURE PROC1 (A : STD3 := "ABC") IS
91                    BEGIN
92                         IF A'FIRST /= 5 THEN
93                              FAILED ("CASE 3 : LOWER BOUND " &
94                                      "INCORRECT");
95                         ELSIF A'LAST /= 7 THEN
96                              FAILED ("CASE 3 : UPPER BOUND " &
97                                      "INCORRECT");
98                         ELSIF A /= "ABC" THEN
99                              FAILED ("CASE 3 : INCORRECT VALUES");
100                         END IF;
101                    END PROC1;
102
103               BEGIN
104
105               PROC1;
106
107               END CASE_D3;
108
109--             COMMENT ("CASE D4 : INITIALIZATION OF CONSTRAINED " &
110--                      "ARRAY FORMAL PARAMETER OF A GENERIC UNIT");
111
112     CASE_D4 : DECLARE
113
114                    SUBTYPE STD4 IS STRING(5 .. 8);
115
116                    GENERIC
117                         D4 : STD4 := "ABCD";
118                    PROCEDURE PROC1;
119
120                    PROCEDURE PROC1 IS
121                    BEGIN
122                         IF D4'FIRST /= 5 THEN
123                              FAILED ("CASE 4 : LOWER BOUND " &
124                                      "INCORRECT");
125                         ELSIF D4'LAST /= 8 THEN
126                              FAILED ("CASE 4 : UPPER BOUND " &
127                                      "INCORRECT");
128                         ELSIF D4 /= "ABCD" THEN
129                              FAILED ("CASE 4 : INCORRECT VALUES");
130                         END IF;
131                    END PROC1;
132
133                    PROCEDURE PROC2 IS NEW PROC1;
134
135               BEGIN
136
137                    PROC2;
138
139               END CASE_D4;
140
141          END CASE_D;
142
143     END;
144
145     RESULT;
146
147END C43214E;
148