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/] [cd3015g.ada] - Blame information for rev 149

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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