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/] [c3/] [c35502p.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C35502P.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
--     FOR AN ENUMERATION TYPE OTHER THAN BOOLEAN OR CHARACTER TYPE,
27
--     CHECK THAT THE RESULTS AND TYPE PRODUCED BY THE ATTRIBUTES
28
--     ARE CORRECT.
29
 
30
--     CHECK THAT 'FIRST AND 'LAST YIELD CORRECT RESULTS WHEN THE
31
--     PREFIX DENOTES A NULL SUBTYPE.
32
 
33
-- HISTORY:
34
--     RJW 05/05/86  CREATED ORIGINAL TEST.
35
--     CJJ 06/09/87  CHANGED "=" COMPARISONS IN GENERIC
36
--                   PROCEDURE Q TO "/=".
37
 
38
 
39
WITH REPORT; USE REPORT;
40
 
41
PROCEDURE  C35502P  IS
42
 
43
BEGIN
44
 
45
     TEST( "C35502P" , "CHECK THAT THE ATTRIBUTES 'FIRST' AND " &
46
                       "'LAST' YIELD THE CORRECT RESULTS WHEN THE " &
47
                       "PREFIX IS A GENERIC FORMAL DISCRETE TYPE " &
48
                       "WHOSE ACTUAL PARAMETER IS AN ENUMERATION " &
49
                       "TYPE OTHER THAN A CHARACTER OR A BOOLEAN " &
50
                       "TYPE" );
51
 
52
     DECLARE
53
       -- FOR THESE DECLARATIONS, 'FIRST AND 'LAST REFER TO THE
54
       -- SUBTYPE VALUES, BUT 'VAL AND 'POS ARE INHERITED FROM THE
55
       -- BASE TYPE.
56
 
57
          TYPE ENUM IS (A, BC, ABC, A_B_C, ABCD);
58
          SUBTYPE SUBENUM IS ENUM RANGE A .. ABC;
59
 
60
          TYPE NEWENUM IS NEW ENUM RANGE BC .. A_B_C;
61
          TYPE NONEWENUM IS NEW ENUM RANGE ABCD .. A;
62
          GENERIC
63
               TYPE E IS (<>);
64
               F, L : E;
65
          PROCEDURE P (STR : STRING);
66
 
67
          PROCEDURE P (STR : STRING) IS
68
               SUBTYPE NOENUM IS E RANGE
69
                   E'VAL (IDENT_INT(2)) .. E'VAL (IDENT_INT(1));
70
          BEGIN
71
               IF E'FIRST /= F THEN
72
                    FAILED ( "INCORRECT E'FIRST FOR " & STR );
73
               END IF;
74
               IF NOENUM'FIRST /= E'VAL (2) THEN
75
                    FAILED ( "INCORRECT NOENUM'FIRST FOR " & STR );
76
               END IF;
77
 
78
               IF E'LAST /= L THEN
79
                    FAILED ( "INCORRECT E'LAST FOR " & STR );
80
               END IF;
81
               IF NOENUM'LAST /= E'VAL (1) THEN
82
                    FAILED ( "INCORRECT NOENUM'LAST FOR " & STR );
83
               END IF;
84
          END P;
85
 
86
          GENERIC
87
               TYPE E IS (<>);
88
          PROCEDURE Q;
89
 
90
          PROCEDURE Q IS
91
               SUBTYPE NOENUM IS E RANGE
92
                       E'VAL (IDENT_INT(2)) .. E'VAL (IDENT_INT(1));
93
          BEGIN
94
               IF E'FIRST /= E'VAL (IDENT_INT(4)) THEN
95
                    FAILED ( "INCORRECT E'FIRST FOR NONEWENUM" );
96
               END IF;
97
               IF NOENUM'FIRST /= E'VAL (2) THEN
98
                    FAILED ( "INCORRECT NOENUM'FIRST FOR NONEWENUM");
99
               END IF;
100
 
101
               IF E'LAST /= E'VAL (IDENT_INT(0)) THEN
102
                    FAILED ( "INCORRECT E'LAST FOR NONEWENUM");
103
               END IF;
104
               IF NOENUM'LAST /= E'VAL (1) THEN
105
                    FAILED ( "INCORRECT NOENUM'LAST FOR NONEWENUM");
106
               END IF;
107
          END Q;
108
 
109
          PROCEDURE PROC1 IS NEW P (ENUM, A, ABCD);
110
          PROCEDURE PROC2 IS NEW P (SUBENUM, A, ABC);
111
          PROCEDURE PROC3 IS NEW P (NEWENUM, BC, A_B_C);
112
          PROCEDURE PROC4 IS NEW Q (NONEWENUM);
113
 
114
     BEGIN
115
          PROC1 ( "ENUM" );
116
          PROC2 ( "SUBENUM" );
117
          PROC3 ( "NEWENUM" );
118
          PROC4;
119
     END;
120
 
121
     RESULT;
122
END C35502P;

powered by: WebSVN 2.1.0

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