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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CD2A22I.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 IF A SIZE CLAUSE SPECIFIES THE SMALLEST APPROPRIATE
27
--     SIZE FOR A SIGNED REPRESENTATION FOR AN ENUMERATION TYPE,
28
--     THEN THE TYPE CAN BE USED AS AN ACTUAL PARAMETER IN AN
29
--     INSTANTIATION.
30
 
31
-- HISTORY:
32
--     JET 08/13/87 CREATED ORIGINAL TEST.
33
--     PWB 05/11/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
34
--     JRL 03/27/92 ELIMINATED REDUNDANT TESTING.
35
 
36
WITH REPORT; USE REPORT;
37
PROCEDURE CD2A22I IS
38
 
39
     TYPE BASIC_ENUM IS (ZERO, ONE, TWO);
40
     BASIC_SIZE : CONSTANT := 3;
41
 
42
     FOR BASIC_ENUM'SIZE USE BASIC_SIZE;
43
 
44
BEGIN
45
     TEST ("CD2A22I", "CHECK THAT IF A SIZE CLAUSE SPECIFIES THE " &
46
                      "SMALLEST APPROPRIATE SIZE FOR A SIGNED " &
47
                      "REPRESENTATION FOR AN ENUMERATION TYPE, THEN " &
48
                      "THE TYPE CAN BE USED AS AN ACTUAL PARAMETER IN " &
49
                      "AN INSTANTIATION");
50
 
51
 
52
     DECLARE -- TYPE DECLARATION GIVEN WITHIN GENERIC PROCEDURE.
53
 
54
          GENERIC
55
               TYPE GPARM IS (<>);
56
          PROCEDURE GENPROC (C0, C1, C2: GPARM);
57
 
58
          PROCEDURE GENPROC (C0, C1, C2: GPARM) IS
59
 
60
               SUBTYPE CHECK_TYPE IS GPARM;
61
 
62
               FUNCTION IDENT (CH : CHECK_TYPE) RETURN CHECK_TYPE IS
63
               BEGIN
64
                    IF EQUAL (3, 3) THEN
65
                         RETURN CH;
66
                    ELSE
67
                         RETURN C1;
68
                    END IF;
69
               END IDENT;
70
 
71
          BEGIN -- GENPROC.
72
 
73
               IF CHECK_TYPE'SIZE /= IDENT_INT (BASIC_SIZE) THEN
74
                    FAILED ("INCORRECT VALUE FOR CHECK_TYPE'SIZE");
75
               END IF;
76
 
77
               IF C0'SIZE < IDENT_INT (BASIC_SIZE) THEN
78
                    FAILED ("INCORRECT VALUE FOR C0'SIZE");
79
               END IF;
80
 
81
               IF NOT ((IDENT (C1) IN C1 .. C2)       AND
82
                       (C0 NOT IN IDENT (C1) .. C2)) THEN
83
                    FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " &
84
                            "OPERATORS");
85
               END IF;
86
 
87
               IF CHECK_TYPE'LAST /= IDENT (C2) THEN
88
                    FAILED ("INCORRECT VALUE FOR CHECK_TYPE'LAST");
89
               END IF;
90
 
91
               IF CHECK_TYPE'VAL (0) /= IDENT (C0) OR
92
                  CHECK_TYPE'VAL (1) /= IDENT (C1) OR
93
                  CHECK_TYPE'VAL (2) /= IDENT (C2) THEN
94
                    FAILED ("INCORRECT VALUE FOR CHECK_TYPE'VAL");
95
               END IF;
96
 
97
               IF CHECK_TYPE'PRED (C1) /= IDENT (C0) OR
98
                  CHECK_TYPE'PRED (C2) /= IDENT (C1) THEN
99
                    FAILED ("INCORRECT VALUE FOR CHECK_TYPE'PRED");
100
               END IF;
101
 
102
               IF CHECK_TYPE'VALUE ("ZERO") /= IDENT (C0)  OR
103
                  CHECK_TYPE'VALUE ("ONE")  /=  IDENT (C1) OR
104
                  CHECK_TYPE'VALUE ("TWO")  /=  IDENT (C2) THEN
105
                    FAILED ("INCORRECT VALUE FOR CHECK_TYPE'VALUE");
106
               END IF;
107
 
108
          END GENPROC;
109
 
110
          PROCEDURE NEWPROC IS NEW GENPROC (BASIC_ENUM);
111
 
112
     BEGIN
113
 
114
          NEWPROC (ZERO, ONE, TWO);
115
 
116
     END;
117
 
118
     RESULT;
119
 
120
END CD2A22I;

powered by: WebSVN 2.1.0

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