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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CD3015A.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 CAN BE USED CORRECTLY IN
27
--     ORDERING RELATIONS, INDEXING ARRAYS, AND IN GENERIC
28
--     INSTANTIATIONS, WHEN THERE IS NO ENUMERATION CLAUSE FOR THE
29
--     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 CD3015A IS
42
 
43
BEGIN
44
 
45
     TEST ("CD3015A", "CHECK THAT A DERIVED ENUMERATION TYPE CAN BE " &
46
                      "USED CORRECTLY IN ORDERING RELATIONS, " &
47
                      "INDEXING ARRAYS, AND IN GENERIC " &
48
                      "INSTANTIATIONS, WHEN THERE IS NO ENUMERATION " &
49
                      "CLAUSE FOR THE PARENT");
50
 
51
     DECLARE
52
          PACKAGE PACK IS
53
 
54
               TYPE MAIN IS (RED,BLUE,YELLOW,'R','B','Y');
55
 
56
               TYPE HUE IS NEW MAIN;
57
               FOR HUE USE (RED => 8, BLUE => 9, YELLOW => 10,
58
                            'R' => 11, 'B' => 12, 'Y' => 13);
59
 
60
               TYPE BASE IS ARRAY(HUE) OF INTEGER;
61
               COLOR,BASIC : HUE;
62
               BARRAY : BASE;
63
 
64
               TYPE HUE1 IS NEW MAIN;
65
               FOR HUE1 USE (RED => 10, BLUE => 14, YELLOW => 16,
66
                            'R' => 19, 'B' => 41, 'Y' => 46);
67
 
68
               TYPE BASE1 IS ARRAY(HUE1) OF INTEGER;
69
               COLOR1,BASIC1 : HUE1;
70
               BARRAY1 : BASE1;
71
 
72
               GENERIC
73
                    TYPE ENUM IS (<>);
74
               PROCEDURE CHANGE(X,Y : IN OUT ENUM);
75
 
76
          END PACK;
77
 
78
          PACKAGE BODY PACK 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'SUCC(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 IN 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) = 1 AND BARRAY1 (BLUE) = 2 AND
121
                   BARRAY1 (YELLOW) = 3 AND BARRAY1 ('R') = 4 AND
122
                   BARRAY1 ('B') = 5 AND BARRAY1 ('Y') = 6)
123
                  THEN
124
                    FAILED("INDEXING ARRAY FAILURE");
125
               END IF;
126
 
127
          END PACK;
128
     BEGIN
129
          NULL;
130
     END;
131
 
132
     RESULT;
133
END CD3015A;

powered by: WebSVN 2.1.0

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