1-- C52104H.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  B : STATICALLY-DETERMINABLE NULL LENGTHS.
34
35
36-- RM 07/20/81
37-- SPS 3/22/83
38
39WITH REPORT;
40PROCEDURE  C52104H  IS
41
42     USE  REPORT ;
43
44BEGIN
45
46     TEST( "C52104H" , "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( 1..1 )  := "A" ;
64          ARR72  :  STRING( 5..4 )  := ""  ;
65
66     BEGIN
67
68          -- STRING ASSIGNMENT:
69
70          ARR72 := ARR71 ;
71          FAILED( "EXCEPTION NOT RAISED  -  SUBTEST 7" );
72
73     EXCEPTION
74
75          WHEN  CONSTRAINT_ERROR =>
76
77               -- CHECKING THE VALUES AFTER THE STRING ASSIGNMENT:
78
79               IF  ARR72 /= ""
80               THEN
81                    FAILED( "ORIGINAL VALUE ALTERED (7)" );
82               END IF;
83
84          WHEN  OTHERS  =>
85               FAILED( "WRONG EXCEPTION RAISED  -  SUBTEST 7" );
86
87     END ;
88
89
90     -------------------------------------------------------------------
91
92     --    (8) SLICED OBJECTS OF THE PREDEFINED TYPE  'STRING' , WITH
93     --        STRING LITERALS.
94     --
95
96     DECLARE
97
98          ARR82 : STRING( 5..9 ) ;
99
100     BEGIN
101
102
103          -- INITIALIZATION OF LHS ARRAY:
104
105          ARR82( 5..9 )  :=  "QUINC"  ;
106
107
108          -- STRING LITERAL ASSIGNMENT:
109
110          ARR82( 5..9 )( 6..9 )( 6..5 ) :=  "ABC" ;
111          FAILED( "EXCEPTION NOT RAISED  -  SUBTEST 8" );
112
113     EXCEPTION
114
115          WHEN  CONSTRAINT_ERROR =>
116
117               -- CHECKING THE VALUES AFTER THE STRING ASSIGNMENT:
118
119               IF  ARR82           /=  "QUINC"  OR
120                   ARR82(  5..9  ) /=  "QUINC"
121               THEN
122                    FAILED( "ORIGINAL VALUE ALTERED (8)" );
123               END IF;
124
125          WHEN  OTHERS  =>
126
127               FAILED( "WRONG EXCEPTION RAISED  -  SUBTEST 8" );
128
129     END ;
130
131
132     -------------------------------------------------------------------
133
134     --    (9) SLICED OBJECTS OF THE PREDEFINED TYPE  'STRING'  (BY
135     --        THEMSELVES).
136     --
137
138     DECLARE
139
140          SUBTYPE  TA92  IS  STRING( 5..9 ) ;
141
142          ARR91  :  STRING( 1..5 )  := "ABCDE" ;
143          ARR92  :  TA92 ;
144
145     BEGIN
146
147
148          -- INITIALIZATION OF LHS ARRAY:
149
150          ARR92( 5..9 )  :=  "QUINC"  ;
151
152
153          -- STRING SLICE ASSIGNMENT:
154
155          ARR92( 5..9 )( 6..9 )( 8..7 ) :=  ARR91( 1..5 )( 5..7 ) ;
156          FAILED( "EXCEPTION NOT RAISED  -  SUBTEST 9" );
157
158     EXCEPTION
159
160          WHEN  CONSTRAINT_ERROR =>
161
162               -- CHECKING THE VALUES AFTER THE STRING ASSIGNMENT:
163
164               IF ARR92           /=  "QUINC"  OR
165                  ARR92(  5..9  ) /=  "QUINC"
166               THEN
167                    FAILED( "ORIGINAL VALUE ALTERED (9)" );
168               END IF;
169
170          WHEN  OTHERS  =>
171
172               FAILED( "WRONG EXCEPTION RAISED  -  SUBTEST 9" );
173
174     END ;
175
176
177     -------------------------------------------------------------------
178
179
180     RESULT ;
181
182
183END C52104H;
184