1-- C42007E.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 BOUNDS OF A STRING LITERAL ARE DETERMINED CORRECTLY.
26-- IN PARTICULAR, CHECK THAT THE LOWER BOUND IS GIVEN BY 'FIRST OF THE
27-- INDEX SUBTYPE WHEN THE STRING LITERAL IS USED AS:
28
29--   E) THE LEFT OR RIGHT OPERAND OF "&".
30
31-- TBN  7/28/86
32
33WITH REPORT; USE REPORT;
34PROCEDURE C42007E IS
35
36BEGIN
37
38     TEST("C42007E", "CHECK THE BOUNDS OF A STRING LITERAL WHEN USED " &
39                     "AS THE LEFT OR RIGHT OPERAND OF THE CATENATION " &
40                     "OPERATOR");
41
42     BEGIN
43
44CASE_E :  DECLARE
45
46               SUBTYPE STR_RANGE IS INTEGER RANGE 2 .. 10;
47               TYPE STR IS ARRAY (STR_RANGE RANGE <>) OF CHARACTER;
48
49               FUNCTION CONCAT1 RETURN STR IS
50               BEGIN
51                    RETURN ("ABC" & (7 .. 8 => 'D'));
52               END CONCAT1;
53
54               FUNCTION CONCAT2 RETURN STR IS
55               BEGIN
56                    RETURN ((IDENT_INT(4) .. 3 => 'A') & "BC");
57               END CONCAT2;
58
59               FUNCTION CONCAT3 RETURN STRING IS
60               BEGIN
61                    RETURN ("TEST" & (7 .. 8 => 'X'));
62               END CONCAT3;
63
64               FUNCTION CONCAT4 RETURN STRING IS
65               BEGIN
66                    RETURN ((8 .. 5 => 'A') & "DE");
67               END CONCAT4;
68
69          BEGIN
70
71               IF CONCAT1'FIRST /= IDENT_INT(2) THEN
72                    FAILED ("LOWER BOUND INCORRECTLY DETERMINED - 1");
73               END IF;
74               IF CONCAT1'LAST /= 6 THEN
75                    FAILED ("UPPER BOUND INCORRECTLY DETERMINED - 1");
76               END IF;
77               IF CONCAT1 /= "ABCDD" THEN
78                    FAILED ("STRING INCORRECTLY DETERMINED - 1");
79               END IF;
80
81               IF CONCAT2'FIRST /= IDENT_INT(2) THEN
82                    FAILED ("LOWER BOUND INCORRECTLY DETERMINED - 2");
83               END IF;
84               IF CONCAT2'LAST /= 3 THEN
85                    FAILED ("UPPER BOUND INCORRECTLY DETERMINED - 2");
86               END IF;
87               IF CONCAT2 /= "BC" THEN
88                    FAILED ("STRING INCORRECTLY DETERMINED - 2");
89               END IF;
90
91               IF CONCAT3'FIRST /= IDENT_INT(1) THEN
92                    FAILED ("LOWER BOUND INCORRECTLY DETERMINED - 3");
93               END IF;
94               IF CONCAT3'LAST /= 6 THEN
95                    FAILED ("UPPER BOUND INCORRECTLY DETERMINED - 3");
96               END IF;
97               IF CONCAT3 /= "TESTXX" THEN
98                    FAILED ("STRING INCORRECTLY DETERMINED - 3");
99               END IF;
100
101               IF CONCAT4'FIRST /= IDENT_INT(1) THEN
102                    FAILED ("LOWER BOUND INCORRECTLY DETERMINED - 4");
103               END IF;
104               IF CONCAT4'LAST /= 2 THEN
105                    FAILED ("UPPER BOUND INCORRECTLY DETERMINED - 4");
106               END IF;
107               IF CONCAT4 /= "DE" THEN
108                    FAILED ("STRING INCORRECTLY DETERMINED - 4");
109               END IF;
110
111          END CASE_E;
112
113     END;
114
115     RESULT;
116
117END C42007E;
118