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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cd/] [cd2a24i.ada] - Blame information for rev 309

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

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

powered by: WebSVN 2.1.0

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