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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C34012A.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 DEFAULT EXPRESSIONS IN DERIVED RECORD TYPES AND
27
--     DERIVED SUBPROGRAMS ARE EVALUATED USING THE ENTITIES DENOTED BY
28
--     THE EXPRESSIONS IN THE PARENT TYPE.
29
 
30
-- HISTORY:
31
--     RJW 06/19/86  CREATED ORIGINAL TEST.
32
--     BCB 08/19/87  CHANGED HEADER TO STANDARD HEADER FORMAT.  CHANGED
33
--                   PACKAGE B SO WOULD HAVE ONE CASE WHERE DEFAULT IS
34
--                   DECLARED BEFORE THE DERIVED TYPE DECLARATION.
35
 
36
WITH REPORT; USE REPORT;
37
 
38
PROCEDURE C34012A IS
39
 
40
BEGIN
41
     TEST ("C34012A", "CHECK THAT DEFAULT EXPRESSIONS IN DERIVED " &
42
                      "RECORD TYPES AND DERIVED SUBPROGRAMS ARE " &
43
                      "EVALUATED USING THE ENTITIES DENOTED BY THE " &
44
                      "EXPRESSIONS IN THE PARENT TYPE" );
45
 
46
     DECLARE
47
          PACKAGE P IS
48
               X : INTEGER := 5;
49
               TYPE REC IS
50
                    RECORD
51
                         C : INTEGER := X;
52
                    END RECORD;
53
          END P;
54
 
55
          PACKAGE Q IS
56
               X : INTEGER := 6;
57
               TYPE NEW_REC IS NEW P.REC;
58
               QVAR : NEW_REC;
59
          END Q;
60
 
61
          PACKAGE R IS
62
               X : INTEGER := 7;
63
               TYPE BRAND_NEW_REC IS NEW Q.NEW_REC;
64
               RVAR : BRAND_NEW_REC;
65
          END R;
66
 
67
          USE Q;
68
          USE R;
69
     BEGIN
70
          IF QVAR.C = 5 THEN
71
               NULL;
72
          ELSE
73
               FAILED ( "INCORRECT VALUE FOR QVAR" );
74
          END IF;
75
 
76
          IF RVAR.C = 5 THEN
77
               NULL;
78
          ELSE
79
               FAILED ( "INCORRECT VALUE FOR RVAR" );
80
          END IF;
81
     END;
82
 
83
     DECLARE
84
          PACKAGE A IS
85
               TYPE T IS RANGE 1 .. 10;
86
               DEFAULT : T := 5;
87
               FUNCTION F (X : T := DEFAULT) RETURN T;
88
          END A;
89
 
90
          PACKAGE BODY A IS
91
               FUNCTION F (X : T := DEFAULT) RETURN T IS
92
               BEGIN
93
                    RETURN X;
94
               END F;
95
          END A;
96
 
97
          PACKAGE B IS
98
               DEFAULT : A.T:= 6;
99
               TYPE NEW_T IS NEW A.T;
100
               BVAR : NEW_T := F;
101
          END B;
102
 
103
          PACKAGE C IS
104
               TYPE BRAND_NEW_T IS NEW B.NEW_T;
105
               DEFAULT : BRAND_NEW_T := 7;
106
               CVAR : BRAND_NEW_T :=F;
107
          END C;
108
 
109
          USE B;
110
          USE C;
111
     BEGIN
112
          IF BVAR = 5 THEN
113
               NULL;
114
          ELSE
115
               FAILED ( "INCORRECT VALUE FOR BVAR" );
116
          END IF;
117
 
118
          IF CVAR = 5 THEN
119
               NULL;
120
          ELSE
121
               FAILED ( "INCORRECT VALUE FOR CVAR" );
122
          END IF;
123
 
124
          DECLARE
125
               VAR : BRAND_NEW_T := F;
126
          BEGIN
127
               IF VAR = 5 THEN
128
                    NULL;
129
               ELSE
130
                    FAILED ( "INCORRECT VALUE FOR VAR" );
131
               END IF;
132
          END;
133
     END;
134
 
135
     RESULT;
136
END C34012A;

powered by: WebSVN 2.1.0

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