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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CD2A22J.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 WHEN A SIZE SPECIFICATION IS GIVEN FOR AN
27
--     ENUMERATION TYPE, THEN SUCH A TYPE OF THE SMALLEST APPROPRIATE
28
--     UNSIGNED SIZE CAN BE PASSED AS AN ACTUAL PARAMETER TO A GENERIC
29
--     PROCEDURE.
30
 
31
-- HISTORY:
32
--     JET 08/13/87 CREATED ORIGINAL TEST.
33
--     DHH 04/17/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED
34
--                  OPERATORS ON 'SIZE TESTS, AND ADDED CHECK ON
35
--                  REPRESENTATION CLAUSE.
36
--     JRL 03/27/92 ELIMINATED REDUNDANT TESTING.
37
 
38
WITH REPORT; USE REPORT;
39
WITH LENGTH_CHECK;                      -- CONTAINS A CALL TO 'FAILED'.
40
PROCEDURE CD2A22J IS
41
 
42
     TYPE BASIC_ENUM IS (ZERO, ONE, TWO);
43
     BASIC_SIZE : CONSTANT := 2;
44
 
45
     FOR BASIC_ENUM'SIZE USE BASIC_SIZE;
46
 
47
BEGIN
48
     TEST ("CD2A22J", "CHECK THAT WHEN A SIZE SPECIFICATION IS GIVEN " &
49
                      "FOR AN ENUMERATION TYPE, THEN SUCH A TYPE OF " &
50
                      "THE SMALLEST APPROPRIATE UNSIGNED SIZE CAN BE " &
51
                      "PASSED AS AN ACTUAL PARAMETER TO A GENERIC " &
52
                      "PROCEDURE");
53
 
54
     DECLARE -- TYPE DECLARATION GIVEN WITHIN GENERIC PROCEDURE.
55
 
56
          GENERIC
57
               TYPE GPARM IS (<>);
58
          PROCEDURE GENPROC (C0, C1, C2: GPARM);
59
 
60
          PROCEDURE GENPROC (C0, C1, C2: GPARM) IS
61
 
62
               SUBTYPE CHECK_TYPE IS GPARM;
63
 
64
               FUNCTION IDENT (CH : CHECK_TYPE) RETURN CHECK_TYPE IS
65
               BEGIN
66
                    IF EQUAL (3, 3) THEN
67
                         RETURN CH;
68
                    ELSE
69
                         RETURN C1;
70
                    END IF;
71
               END IDENT;
72
 
73
               PROCEDURE CHECK_1 IS NEW LENGTH_CHECK (CHECK_TYPE);
74
 
75
          BEGIN -- GENPROC.
76
               CHECK_1 (C0, BASIC_SIZE, "CHECK_TYPE");
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
END CD2A22J;

powered by: WebSVN 2.1.0

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