OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C41107A.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 FOR AN ARRAY HAVING BOTH POSITIVE AND NEGATIVE
26
--   INDEX VALUES, THE PROPER COMPONENT IS SELECTED - A.
27
-- CHECK THAT FOR AN ARRAY INDEXED WITH AN ENUMERATION TYPE,
28
--   APPROPRIATE COMPONENTS CAN BE SELECTED - B.
29
-- CHECK THAT SUBSCRIPT EXPRESSIONS CAN BE OF COMPLEXITY GREATER
30
--   THAN VARIABLE + - CONSTANT - C.
31
-- CHECK THAT MULTIPLY DIMENSIONED ARRAYS ARE PROPERLY INDEXED - D.
32
 
33
-- WKB 7/29/81
34
-- JBG 8/21/83
35
 
36
WITH REPORT;
37
USE REPORT;
38
PROCEDURE C41107A IS
39
 
40
     TYPE T1 IS ARRAY (INTEGER RANGE -2..2) OF INTEGER;
41
     A : T1 := (1,2,3,4,5);
42
 
43
     TYPE COLOR IS (RED,ORANGE,YELLOW,GREEN,BLUE);
44
     TYPE T2 IS ARRAY (COLOR RANGE RED..BLUE) OF INTEGER;
45
     B : T2 := (5,4,3,2,1);
46
 
47
     C : STRING (1..7) := "ABCDEFG";
48
 
49
     TYPE T4 IS ARRAY (1..4,1..3) OF INTEGER;
50
     D : T4 := (1 => (1,2,3), 2 => (4,5,6), 3 => (7,8,9),
51
                4 => (0,-1,-2));
52
 
53
     V1 : INTEGER := IDENT_INT (1);
54
     V2 : INTEGER := IDENT_INT (2);
55
     V3 : INTEGER := IDENT_INT (3);
56
 
57
     PROCEDURE P1 (X : IN INTEGER; Y : IN OUT INTEGER;
58
                   Z : OUT INTEGER; W : STRING) IS
59
     BEGIN
60
          IF X /= 1 THEN
61
               FAILED ("WRONG VALUE FOR IN PARAMETER - " & W);
62
          END IF;
63
          IF Y /= 4 THEN
64
               FAILED ("WRONG VALUE FOR IN OUT PARAMETER - " & W);
65
          END IF;
66
          Y := 11;
67
          Z := 12;
68
     END P1;
69
 
70
     PROCEDURE P2 (X : IN CHARACTER; Y : IN OUT CHARACTER;
71
                   Z : OUT CHARACTER) IS
72
     BEGIN
73
          IF X /= 'D' THEN
74
               FAILED ("WRONG VALUE FOR IN PARAMETER - C");
75
          END IF;
76
          IF Y /= 'F' THEN
77
               FAILED ("WRONG VALUE FOR IN OUT PARAMETER - C");
78
          END IF;
79
          Y := 'Y';
80
          Z := 'Z';
81
     END P2;
82
 
83
BEGIN
84
     TEST ("C41107A", "CHECK THAT THE PROPER COMPONENT IS SELECTED " &
85
                      "FOR ARRAYS WITH POS AND NEG INDICES, " &
86
                      "ENUMERATION INDICES, COMPLEX SUBSCRIPT " &
87
                      "EXPRESSIONS, AND MULTIPLE DIMENSIONS");
88
 
89
     IF A(IDENT_INT(1)) /= 4 THEN
90
          FAILED ("WRONG VALUE FOR EXPRESSION - A");
91
     END IF;
92
     A(IDENT_INT(-2)) := 10;
93
     IF A /= (10,2,3,4,5) THEN
94
          FAILED ("WRONG TARGET FOR ASSIGNMENT - A");
95
     END IF;
96
     A := (2,1,0,3,4);
97
     P1 (A(-1), A(2), A(-2), "A");
98
     IF A /= (12,1,0,3,11) THEN
99
          FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - A");
100
     END IF;
101
 
102
     IF B(GREEN) /= 2 THEN
103
          FAILED ("WRONG VALUE FOR EXPRESSION - B");
104
     END IF;
105
     B(YELLOW) := 10;
106
     IF B /= (5,4,10,2,1) THEN
107
          FAILED ("WRONG TARGET FOR ASSIGNMENT - B");
108
     END IF;
109
     B := (1,4,2,3,5);
110
     P1 (B(RED), B(ORANGE), B(BLUE), "B");
111
     IF B /= (1,11,2,3,12) THEN
112
          FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - B");
113
     END IF;
114
 
115
     IF C(3..6)(3**2 / 3 * (2-1) - 6 / 3 + 2) /= 'C' THEN
116
          FAILED ("WRONG VALUE FOR EXPRESSION - C");
117
     END IF;
118
     C(3..6)(V3**2 / V1 * (V3-V2) + IDENT_INT(4) - V3 * V2 - V1) := 'W';
119
     IF C /= "ABCDEWG" THEN
120
          FAILED ("WRONG TARGET FOR ASSIGNMENT - C");
121
     END IF;
122
     C := "ABCDEFG";
123
     P2 (C(3..6)(V3+V1), C(3..6)(V3*V2), C(3..6)((V1+V2)*V1));
124
     IF C /= "ABZDEYG" THEN
125
          FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - C");
126
     END IF;
127
 
128
     IF D(IDENT_INT(1),IDENT_INT(3)) /= 3 THEN
129
          FAILED ("WRONG VALUE FOR EXPRESSION - D");
130
     END IF;
131
     D(IDENT_INT(4),IDENT_INT(2)) := 10;
132
     IF D /= ((1,2,3),(4,5,6),(7,8,9),(0,10,-2)) THEN
133
          FAILED ("WRONG TARGET FOR ASSIGNMENT - D");
134
     END IF;
135
     D := (1 => (0,2,3), 2 => (4,5,6), 3 => (7,8,9), 4 => (1,-1,-2));
136
     P1 (D(4,1), D(2,1), D(3,2), "D");
137
     IF D /= ((0,2,3),(11,5,6),(7,12,9),(1,-1,-2)) THEN
138
          FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - D");
139
     END IF;
140
 
141
     RESULT;
142
END C41107A;

powered by: WebSVN 2.1.0

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