1-- C52104M.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 LENGTHS MUST MATCH IN ARRAY AND SLICE ASSIGNMENTS.
26--    MORE SPECIFICALLY, TEST THAT ATTEMPTED ASSIGNMENTS BETWEEN
27--    ARRAYS WITH NON-MATCHING LENGTHS LEAVE THE DESTINATION ARRAY
28--    INTACT AND CAUSE  CONSTRAINT_ERROR  TO BE RAISED.
29--    (OVERLAPS BETWEEN THE OPERANDS OF THE ASSIGNMENT STATEMENT
30--    ARE TREATED ELSEWHERE.)
31
32-- THIS IS THE THIRD FILE IN
33--    DIVISION  C :  NON-NULL LENGTHS NOT DETERMINABLE STATICALLY.
34
35
36-- RM 07/20/81
37-- SPS 3/22/83
38
39WITH REPORT;
40PROCEDURE  C52104M  IS
41
42     USE  REPORT ;
43
44BEGIN
45
46     TEST( "C52104M" , "CHECK THAT IN ARRAY ASSIGNMENTS AND IN SLICE" &
47                       " ASSIGNMENTS  THE LENGTHS MUST MATCH" );
48
49
50     --                              ( EACH DIVISION COMPRISES 3 FILES,
51     --                                COVERING RESPECTIVELY THE FIRST
52     --                                3 , NEXT 2 , AND LAST 3 OF THE 8
53     --                                SELECTIONS FOR THE DIVISION.)
54
55
56     -------------------------------------------------------------------
57
58     --    (7) UNSLICED OBJECTS OF THE PREDEFINED TYPE  'STRING'  (BY
59     --        THEMSELVES).
60
61     DECLARE
62
63          ARR71  :  STRING( IDENT_INT(1)..IDENT_INT(5) )  := "ABCDE" ;
64          ARR72  :  STRING( IDENT_INT(5)..IDENT_INT(8) )  := "FGHI"  ;
65
66     BEGIN
67
68
69          -- STRING ASSIGNMENT:
70
71          ARR72 := ARR71 ;
72          FAILED( "EXCEPTION NOT RAISED  -  SUBTEST 7" );
73
74     EXCEPTION
75
76          WHEN  CONSTRAINT_ERROR =>
77
78               -- CHECKING THE VALUES AFTER THE STRING ASSIGNMENT:
79
80               IF  ARR72 /= "FGHI"
81               THEN
82                    FAILED( "ORIGINAL VALUE ALTERED (7)" );
83               END IF;
84
85          WHEN  OTHERS  =>
86               FAILED( "WRONG EXCEPTION RAISED  -  SUBTEST 7" );
87
88     END ;
89
90
91     -------------------------------------------------------------------
92
93
94     --    (8) SLICED OBJECTS OF THE PREDEFINED TYPE  'STRING' , WITH
95     --        STRING LITERALS.
96     --
97
98     DECLARE
99
100          ARR82 : STRING( IDENT_INT(5)..IDENT_INT(9) )  :=  "QBCDE"  ;
101
102     BEGIN
103
104
105          -- STRING LITERAL ASSIGNMENT:
106
107          ARR82( IDENT_INT(5)..IDENT_INT(9) )
108               ( IDENT_INT(6)..IDENT_INT(9) ) :=  "EIN" ;
109          FAILED( "EXCEPTION NOT RAISED  -  SUBTEST 8" );
110
111     EXCEPTION
112
113          WHEN  CONSTRAINT_ERROR =>
114
115               -- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
116
117               IF  ARR82                               /=  "QBCDE"  OR
118                   ARR82( IDENT_INT(5)..IDENT_INT(9) ) /=  "QBCDE"
119               THEN
120                    FAILED( "LHS ARRAY ALTERED  (8)" );
121               END IF;
122
123          WHEN  OTHERS  =>
124               FAILED( "WRONG EXCEPTION RAISED  -  SUBTEST 8" );
125
126     END ;
127
128
129     -------------------------------------------------------------------
130
131     --    (9) SLICED OBJECTS OF THE PREDEFINED TYPE  'STRING'  (BY
132     --        THEMSELVES).
133     --
134
135     DECLARE
136
137          SUBTYPE  TA92  IS  STRING( IDENT_INT(5)..IDENT_INT(9) ) ;
138
139          ARR91  :  STRING( IDENT_INT(1)..IDENT_INT(7) )  := "ABCDEFG" ;
140          ARR92  :  TA92 ;
141
142     BEGIN
143
144
145          -- INITIALIZATION OF LHS ARRAY:
146
147          ARR92( IDENT_INT(5)..IDENT_INT(9) )  :=  "QUINC"  ;
148
149
150          -- STRING SLICE ASSIGNMENT:
151
152          ARR92( IDENT_INT(5)..IDENT_INT(9) )
153               ( IDENT_INT(6)..IDENT_INT(9) ) :=
154               ARR91
155               ( IDENT_INT(1)..IDENT_INT(7) )
156               ( IDENT_INT(1)..IDENT_INT(6) )
157               ( IDENT_INT(1)..IDENT_INT(6) ) ;
158          FAILED( "EXCEPTION NOT RAISED  -  SUBTEST 9" );
159
160     EXCEPTION
161
162          WHEN  CONSTRAINT_ERROR =>
163
164               -- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
165
166               IF  ARR92                               /=  "QUINC"  OR
167                   ARR92( IDENT_INT(5)..IDENT_INT(9) ) /=  "QUINC"
168               THEN
169                    FAILED( "LHS VALUE ALTERED  (9)" );
170               END IF;
171
172          WHEN  OTHERS  =>
173               FAILED( "WRONG EXCEPTION RAISED  -  SUBTEST 9" );
174
175     END ;
176
177
178     -------------------------------------------------------------------
179
180
181     RESULT ;
182
183
184END C52104M;
185