1-- C43209A.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 A STRING LITERAL IS ALLOWED IN A MULTIDIMENSIONAL
27--     ARRAY AGGREGATE AT THE PLACE OF A ONE DIMENSIONAL ARRAY OF
28--     CHARACTER TYPE.
29
30-- HISTORY:
31--     DHH 08/12/88 CREATED ORIGINAL TEST.
32
33WITH REPORT; USE REPORT;
34PROCEDURE C43209A IS
35
36     TYPE MULTI_ARRAY IS ARRAY(1 .. 2, 1 .. 3, 1 .. 6) OF CHARACTER;
37
38BEGIN
39     TEST("C43209A", "CHECK THAT A STRING LITERAL IS ALLOWED IN A " &
40                     "MULTIDIMENSIONAL ARRAY AGGREGATE AT THE PLACE " &
41                     "OF A ONE DIMENSIONAL ARRAY OF CHARACTER TYPE");
42
43     DECLARE
44          X : MULTI_ARRAY := ((('A', 'B', 'C', 'D', 'E', 'F'),
45                              ('G', 'H', 'I', 'J', 'K', 'L'),
46                              ('M', 'N', 'O', 'P', 'Q', 'R')),
47                              (('S', 'T', 'U', 'V', 'W', 'X'),
48                              ('W', 'Z', 'A', 'B', 'C', 'D'),
49                              "WHOZAT"));
50
51          Y : MULTI_ARRAY := (("WHOZAT",
52                              ('A', 'B', 'C', 'D', 'E', 'F'),
53                              ('G', 'H', 'I', 'J', 'K', 'L')),
54                              (('M', 'N', 'O', 'P', 'Q', 'R'),
55                              ('S', 'T', 'U', 'V', 'W', 'X'),
56                              ('W', 'Z', 'A', 'B', 'C', 'D')));
57
58     BEGIN
59          IF X(IDENT_INT(2), IDENT_INT(3), IDENT_INT(6)) /=
60                  Y(IDENT_INT(1), IDENT_INT(1), IDENT_INT(6)) THEN
61               FAILED("INITIALIZATION FAILURE");
62          END IF;
63     END;
64
65     DECLARE
66          PROCEDURE FIX_AGG(T : MULTI_ARRAY) IS
67          BEGIN
68               IF T(IDENT_INT(2), IDENT_INT(2), IDENT_INT(5)) /=
69                       T(IDENT_INT(1), IDENT_INT(1), IDENT_INT(1)) THEN
70                    FAILED("SUBPROGRAM FAILURE");
71               END IF;
72          END;
73     BEGIN
74          FIX_AGG((("WHOZAT", ('A', 'B', 'C', 'D', 'E', 'F'),
75                              ('G', 'H', 'I', 'J', 'K', 'L')),
76                              (('M', 'N', 'O', 'P', 'Q', 'R'),
77                              ('S', 'T', 'U', 'V', 'W', 'X'),
78                              ('W', 'Z', 'A', 'B', 'C', 'D'))));
79
80     END;
81
82     DECLARE
83
84          Y : CONSTANT MULTI_ARRAY := (("WHOZAT",
85                              ('A', 'B', 'C', 'D', 'E', 'F'),
86                              ('G', 'H', 'I', 'J', 'K', 'L')),
87                              (('M', 'N', 'O', 'P', 'Q', 'R'),
88                              ('S', 'T', 'U', 'V', 'W', 'X'),
89                              ('W', 'Z', 'A', 'B', 'C', 'D')));
90
91     BEGIN
92          IF Y(IDENT_INT(2), IDENT_INT(2), IDENT_INT(5)) /=
93             Y(IDENT_INT(1), IDENT_INT(1), IDENT_INT(1)) THEN
94               FAILED("CONSTANT FAILURE");
95          END IF;
96     END;
97
98     DECLARE
99     BEGIN
100          IF MULTI_ARRAY'((1 =>(('A', 'B', 'C', 'D', 'E', 'F'),
101               ('G', 'H', 'I', 'J', 'K', 'L'),
102               ('M', 'N', 'O', 'P', 'Q', 'R')),
103              2 => (('S', 'T', 'U', 'V', 'W', 'X'),
104               ('W', 'Z', 'A', 'B', 'C', 'D'),
105               "WHOZAT"))) = MULTI_ARRAY'((1 =>(1 =>"WHOZAT",
106                             2 =>('A', 'B', 'C', 'D', 'E', 'F'),
107                             3 =>('G', 'H', 'I', 'J', 'K', 'L')),
108                            2 => (1 =>('M', 'N', 'O', 'P', 'Q', 'R'),
109                             2 =>('S', 'T', 'U', 'V', 'W', 'X'),
110                             3 => ('W', 'Z', 'A', 'B', 'C', 'D')))) THEN
111               FAILED("EQUALITY OPERATOR FAILURE");
112          END IF;
113     END;
114
115     DECLARE
116          SUBTYPE SM IS INTEGER RANGE 1 .. 10;
117          TYPE UNCONSTR IS ARRAY(SM RANGE <>, SM RANGE<>) OF CHARACTER;
118
119          FUNCTION FUNC(X : SM) RETURN UNCONSTR IS
120          BEGIN
121               IF EQUAL(X,X) THEN
122                    RETURN (1 => "WHEN", 2 => "WHAT");
123               ELSE
124                    RETURN ("    ", "    ");
125               END IF;
126          END FUNC;
127
128     BEGIN
129          IF FUNC(1) /= FUNC(2) THEN
130               FAILED("UNCONSTRAINED FUNCTION RETURN FAILURE");
131          END IF;
132     END;
133
134     RESULT;
135END C43209A;
136