OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c5/] [c52104c.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C52104C.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  A : STATICALLY-DETERMINABLE NON-NULL LENGTHS.
34
 
35
 
36
-- RM 07/20/81
37
-- SPS 3/22/83
38
 
39
WITH REPORT;
40
PROCEDURE  C52104C  IS
41
 
42
     USE  REPORT ;
43
 
44
BEGIN
45
 
46
     TEST( "C52104C" , "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..5 )  := "ABCDE" ;
64
          ARR72  :  STRING( 5..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( 5..9 )  :=  "QBCDE"  ;
101
 
102
     BEGIN
103
 
104
 
105
          -- STRING LITERAL ASSIGNMENT:
106
 
107
          ARR82( 5..9 )( 6..9 ) :=  "EIN" ;
108
          FAILED( "EXCEPTION NOT RAISED  -  SUBTEST 8" );
109
 
110
     EXCEPTION
111
 
112
          WHEN  CONSTRAINT_ERROR =>
113
 
114
               -- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
115
 
116
               IF  ARR82           /=  "QBCDE"  OR
117
                   ARR82(  5..9  ) /=  "QBCDE"
118
               THEN
119
                    FAILED( "LHS ARRAY ALTERED  (8)" );
120
               END IF;
121
 
122
          WHEN  OTHERS  =>
123
               FAILED( "WRONG EXCEPTION RAISED  -  SUBTEST 8" );
124
 
125
     END ;
126
 
127
 
128
     -------------------------------------------------------------------
129
 
130
     --    (9) SLICED OBJECTS OF THE PREDEFINED TYPE  'STRING'  (BY
131
     --        THEMSELVES).
132
     --
133
 
134
     DECLARE
135
 
136
          SUBTYPE  TA92  IS  STRING( 5..9 ) ;
137
 
138
          ARR91  :  STRING( 1..7 )  := "ABCDEFG" ;
139
          ARR92  :  TA92 ;
140
 
141
     BEGIN
142
 
143
 
144
          -- INITIALIZATION OF LHS ARRAY:
145
 
146
          ARR92( 5..9 )  :=  "QUINC"  ;
147
 
148
 
149
          -- STRING SLICE ASSIGNMENT:
150
 
151
          ARR92( 5..9 )( 6..9 ) :=  ARR91( 1..7 )( 1..6 )( 1..6 ) ;
152
          FAILED( "EXCEPTION NOT RAISED  -  SUBTEST 9" );
153
 
154
     EXCEPTION
155
 
156
          WHEN  CONSTRAINT_ERROR =>
157
 
158
               -- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
159
 
160
               IF  ARR92           /=  "QUINC"  OR
161
                   ARR92(  5..9  ) /=  "QUINC"
162
               THEN
163
                    FAILED( "LHS VALUE ALTERED  (9)" );
164
               END IF;
165
 
166
          WHEN  OTHERS  =>
167
               FAILED( "WRONG EXCEPTION RAISED  -  SUBTEST 9" );
168
 
169
     END ;
170
 
171
 
172
     -------------------------------------------------------------------
173
 
174
 
175
     RESULT ;
176
 
177
 
178
END C52104C;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.