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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CD1C04E.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 A RECORD REPRESENTATION CLAUSE CAN BE GIVEN FOR
27
--     A DERIVED RECORD TYPE EVEN IF THE REPRESENTATION IS INHERITED
28
--     FROM THE PARENT, AND THAT THE REPRESENTATION CLAUSE FOR THE
29
--     DERIVED TYPE OVERRIDES THAT OF THE PARENT TYPE.
30
 
31
-- HISTORY:
32
--     PWB 03/25/89  DELETED CHECKS OF COMPONENT'SIZE; CHANGED
33
--         EXTENSION FROM '.ADA' TO '.DEP'.
34
--     JET 09/21/87  CREATED ORIGINAL TEST.
35
 
36
WITH REPORT; USE REPORT;
37
WITH SYSTEM; USE SYSTEM;
38
 
39
PROCEDURE CD1C04E IS
40
 
41
     UNITS_PER_INTEGER : CONSTANT :=
42
          (INTEGER'SIZE + SYSTEM.STORAGE_UNIT - 1) /
43
          SYSTEM.STORAGE_UNIT;
44
 
45
     TYPE E_TYPE IS (RED, BLUE, GREEN);
46
 
47
     TYPE PARENT_TYPE IS
48
          RECORD
49
               I : INTEGER RANGE 0 .. 127 := 127;
50
               C : CHARACTER := 'S';
51
               B : BOOLEAN := FALSE;
52
               E : E_TYPE := BLUE;
53
          END RECORD;
54
 
55
     FOR PARENT_TYPE USE
56
          RECORD
57
               C AT 0 * UNITS_PER_INTEGER RANGE 0 .. CHARACTER'SIZE - 1;
58
               B AT 1 * UNITS_PER_INTEGER RANGE 0 .. BOOLEAN'SIZE - 1;
59
               I AT 2 * UNITS_PER_INTEGER RANGE 0 .. INTEGER'SIZE/2 - 1;
60
               E AT 3 * UNITS_PER_INTEGER RANGE 0 .. CHARACTER'SIZE - 1;
61
          END RECORD;
62
 
63
     TYPE DERIVED_TYPE IS NEW PARENT_TYPE;
64
 
65
     FOR DERIVED_TYPE USE
66
          RECORD
67
               C AT 1 * UNITS_PER_INTEGER RANGE 1 .. CHARACTER'SIZE + 1;
68
               B AT 3 * UNITS_PER_INTEGER RANGE 1 .. BOOLEAN'SIZE + 1;
69
               I AT 5 * UNITS_PER_INTEGER RANGE 1 .. INTEGER'SIZE/2 + 1;
70
               E AT 7 * UNITS_PER_INTEGER RANGE 1 .. CHARACTER'SIZE + 1;
71
          END RECORD;
72
 
73
     P_REC : PARENT_TYPE;
74
     REC   : DERIVED_TYPE;
75
 
76
BEGIN
77
 
78
     TEST("CD1C04E", "CHECK THAT A RECORD REPRESENTATION CLAUSE " &
79
                     "CAN BE GIVEN FOR A DERIVED RECORD TYPE EVEN " &
80
                     "IF THE REPRESENTATION IS INHERITED FROM " &
81
                     "THE PARENT, AND THAT THE REPRESENTATION " &
82
                     "CLAUSE FOR THE DERIVED TYPE OVERRIDES THAT " &
83
                     "OF THE PARENT TYPE");
84
 
85
     IF DERIVED_TYPE'SIZE = IDENT_INT (PARENT_TYPE'SIZE) THEN
86
          FAILED ("DERIVED_TYPE'SIZE WAS INHERITED FROM " &
87
                  "PARENT_TYPE");
88
     END IF;
89
 
90
     REC := (12, 'T', TRUE, RED);
91
 
92
     IF (REC.I /= 12) OR (REC.C /= 'T') OR
93
        (NOT REC.B) OR (REC.E /= RED) THEN
94
          FAILED ("THE VALUES OF DERIVED_TYPE COMPONENTS WERE " &
95
                  "INCORRECT");
96
     END IF;
97
 
98
     IF REC.I'POSITION = P_REC.I'POSITION OR
99
        REC.C'POSITION = P_REC.C'POSITION OR
100
        REC.B'POSITION = P_REC.B'POSITION OR
101
        REC.E'POSITION = P_REC.E'POSITION THEN
102
          FAILED ("THE POSITIONS OF DERIVED_TYPE COMPONENTS WERE " &
103
                  "INHERITED FROM PARENT_TYPE");
104
     END IF;
105
 
106
     IF REC.I'FIRST_BIT = P_REC.I'FIRST_BIT OR
107
        REC.C'FIRST_BIT = P_REC.C'FIRST_BIT OR
108
        REC.B'FIRST_BIT = P_REC.B'FIRST_BIT OR
109
        REC.E'FIRST_BIT = P_REC.E'FIRST_BIT THEN
110
          FAILED ("THE FIRST_BITS OF DERIVED_TYPE COMPONENTS WERE " &
111
                  "INHERITED FROM PARENT_TYPE");
112
     END IF;
113
 
114
     IF REC.I'LAST_BIT = P_REC.I'LAST_BIT OR
115
        REC.C'LAST_BIT = P_REC.C'LAST_BIT OR
116
        REC.B'LAST_BIT = P_REC.B'LAST_BIT OR
117
        REC.E'LAST_BIT = P_REC.E'LAST_BIT THEN
118
          FAILED ("THE LAST_BITS OF DERIVED_TYPE COMPONENTS WERE " &
119
                  "INHERITED FROM PARENT_TYPE");
120
     END IF;
121
 
122
     RESULT;
123
 
124
END CD1C04E;

powered by: WebSVN 2.1.0

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