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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cd/] [cd3014d.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CD3014D.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
-- OBJECTIVE:
26
--     CHECK THAT AN ENUMERATION TYPE WITH A REPRESENTATION CLAUSE IN A
27
--     GENERIC UNIT CAN BE USED CORRECTLY IN ORDERING RELATIONS,
28
--     INDEXING ARRAYS, AND IN GENERIC INSTANTIATIONS.
29
 
30
-- HISTORY
31
--     DHH 09/30/87  CREATED ORIGINAL TEST.
32
--     BCB 03/20/89  CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
33
--     BCB 03/07/90  REVISED WORDING IN HEADER COMMENT AND IN CALL TO
34
--                   REPORT.TEST.  ADDED CHECK FOR NON-CONTIGUOUS CODES.
35
--                   REVISED CHECK FOR ARRAY INDEXING.
36
--     THS 09/18/90  REVISED WORDING IN HEADER AND MODIFIED FAILED ERROR
37
--                   MESSAGE.
38
 
39
WITH REPORT; USE REPORT;
40
PROCEDURE CD3014D IS
41
 
42
BEGIN
43
 
44
     TEST ("CD3014D", "CHECK THAT AN ENUMERATION TYPE WITH A " &
45
                      "REPRESENTATION CLAUSE IN A GENERIC UNIT CAN " &
46
                      "BE USED CORRECTLY IN ORDERING RELATIONS, " &
47
                      "INDEXING ARRAYS, AND IN GENERIC INSTANTIATIONS");
48
 
49
     DECLARE
50
 
51
          GENERIC
52
          PACKAGE GENPACK IS
53
 
54
               TYPE HUE IS (RED,BLUE,YELLOW,'R','B','Y');
55
 
56
               FOR HUE USE (RED => 8, BLUE => 9, YELLOW => 10,
57
                            'R' => 11, 'B' => 12, 'Y' => 13);
58
 
59
               TYPE HUE1 IS ('Y','B','R',YELLOW,BLUE,RED);
60
 
61
               FOR HUE1 USE ('Y' => 10, 'B' => 14, 'R' => 16,
62
                             YELLOW => 19, BLUE => 41, RED => 46);
63
 
64
               TYPE BASE1 IS ARRAY(HUE1) OF INTEGER;
65
               COLOR1,BASIC1 : HUE1;
66
               BARRAY1 : BASE1;
67
 
68
               TYPE BASE IS ARRAY(HUE) OF INTEGER;
69
               COLOR,BASIC : HUE;
70
               BARRAY : BASE;
71
 
72
               GENERIC
73
                    TYPE ENUM IS (<>);
74
               PROCEDURE CHANGE(X,Y : IN OUT ENUM);
75
 
76
          END GENPACK;
77
 
78
          PACKAGE BODY GENPACK IS
79
 
80
               PROCEDURE CHANGE(X,Y : IN OUT ENUM) IS
81
                    T : ENUM;
82
               BEGIN
83
                    T := X;
84
                    X := Y;
85
                    Y := T;
86
               END CHANGE;
87
 
88
               PROCEDURE PROC IS NEW CHANGE(HUE);
89
               PROCEDURE PROC1 IS NEW CHANGE(HUE1);
90
 
91
          BEGIN
92
               BASIC := RED;
93
               COLOR := HUE'SUCC(BASIC);
94
               BASIC1 := RED;
95
               COLOR1 := HUE1'PRED(BASIC1);
96
               IF (COLOR < BASIC OR BASIC >= 'R' OR 'Y' <= COLOR OR
97
                  COLOR > 'B') OR
98
                  NOT (COLOR1 < BASIC1 AND BASIC1 >= 'R' AND
99
                  'Y' <= COLOR1 AND COLOR1 > 'B') THEN
100
                    FAILED("ORDERING RELATIONS ARE INCORRECT");
101
               END IF;
102
 
103
               PROC(BASIC,COLOR);
104
               PROC1(BASIC1,COLOR1);
105
 
106
               IF COLOR /= RED OR COLOR1 /= RED THEN
107
                    FAILED("VALUES OF PARAMETERS TO INSTANCE OF " &
108
                           "GENERIC UNIT NOT CORRECT AFTER CALL");
109
               END IF;
110
 
111
               BARRAY := (IDENT_INT(1),IDENT_INT(2),IDENT_INT(3),
112
                         IDENT_INT(4),IDENT_INT(5),IDENT_INT(6));
113
 
114
               BARRAY1 := (IDENT_INT(1),IDENT_INT(2),IDENT_INT(3),
115
                         IDENT_INT(4),IDENT_INT(5),IDENT_INT(6));
116
 
117
               IF (BARRAY (RED) /= 1 OR BARRAY (BLUE) /= 2 OR
118
                   BARRAY (YELLOW) /= 3 OR BARRAY ('R') /= 4 OR
119
                   BARRAY ('B') /= 5 OR BARRAY ('Y') /= 6) OR
120
                  NOT (BARRAY1 (RED) = 6 AND BARRAY1 (BLUE) = 5 AND
121
                   BARRAY1 (YELLOW) = 4 AND BARRAY1 ('R') = 3 AND
122
                   BARRAY1 ('B') = 2 AND BARRAY1 ('Y') = 1)
123
                  THEN
124
                    FAILED("INDEXING ARRAY FAILURE");
125
               END IF;
126
 
127
          END GENPACK;
128
 
129
          PACKAGE P IS NEW GENPACK;
130
     BEGIN
131
          NULL;
132
     END;
133
 
134
     RESULT;
135
END CD3014D;

powered by: WebSVN 2.1.0

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