OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cc/] [cc3231a.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CC3231A.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 PRIVATE OR LIMITED PRIVATE FORMAL TYPE DENOTES ITS
27
--      ACTUAL PARAMETER AN INTEGER TYPE, AND OPERATIONS OF THE FORMAL
28
--      TYPE ARE IDENTIFIED WITH CORRESPONDING OPERATIONS OF THE ACTUAL
29
--      TYPE.
30
 
31
-- HISTORY:
32
--      TBN 09/14/88  CREATED ORIGINAL TEST.
33
 
34
WITH REPORT; USE REPORT;
35
PROCEDURE CC3231A IS
36
 
37
     GENERIC
38
          TYPE T IS PRIVATE;
39
     PACKAGE P IS
40
          SUBTYPE SUB_T IS T;
41
          PAC_VAR : T;
42
     END P;
43
 
44
     GENERIC
45
          TYPE T IS LIMITED PRIVATE;
46
     PACKAGE LP IS
47
          SUBTYPE SUB_T IS T;
48
          PAC_VAR : T;
49
     END LP;
50
 
51
BEGIN
52
     TEST ("CC3231A", "CHECK THAT A PRIVATE OR LIMITED PRIVATE " &
53
                      "FORMAL TYPE DENOTES ITS ACTUAL PARAMETER AN " &
54
                      "INTEGER TYPE, AND OPERATIONS OF THE " &
55
                      "FORMAL TYPE ARE IDENTIFIED WITH CORRESPONDING " &
56
                      "OPERATIONS OF THE ACTUAL TYPE");
57
 
58
     DECLARE  -- PRIVATE TYPE.
59
          TYPE FIXED IS DELTA 0.125 RANGE 0.0 .. 10.0;
60
 
61
          OBJ_INT : INTEGER := 1;
62
          OBJ_FLO : FLOAT := 1.0;
63
          OBJ_FIX : FIXED := 1.0;
64
 
65
          PACKAGE P1 IS NEW P (INTEGER);
66
          USE P1;
67
 
68
          TYPE NEW_T IS NEW SUB_T;
69
          OBJ_NEWT : NEW_T;
70
     BEGIN
71
          PAC_VAR := SUB_T'(1);
72
          IF PAC_VAR /= OBJ_INT THEN
73
               FAILED ("INCORRECT RESULTS - 1");
74
          END IF;
75
          OBJ_INT := PAC_VAR + OBJ_INT;
76
          IF OBJ_INT <= PAC_VAR THEN
77
               FAILED ("INCORRECT RESULTS - 2");
78
          END IF;
79
          PAC_VAR := PAC_VAR * OBJ_INT;
80
          IF PAC_VAR NOT IN INTEGER THEN
81
               FAILED ("INCORRECT RESULTS - 3");
82
          END IF;
83
          IF OBJ_INT NOT IN SUB_T THEN
84
               FAILED ("INCORRECT RESULTS - 4");
85
          END IF;
86
          IF INTEGER'POS(2) /= SUB_T'POS(2) THEN
87
               FAILED ("INCORRECT RESULTS - 5");
88
          END IF;
89
          PAC_VAR := 1;
90
          OBJ_FIX := PAC_VAR * OBJ_FIX;
91
          IF OBJ_FIX /= 1.0 THEN
92
               FAILED ("INCORRECT RESULTS - 6");
93
          END IF;
94
          OBJ_INT := 1;
95
          OBJ_FIX := OBJ_FIX / OBJ_INT;
96
          IF OBJ_FIX /= 1.0 THEN
97
               FAILED ("INCORRECT RESULTS - 7");
98
          END IF;
99
          OBJ_INT := OBJ_INT ** PAC_VAR;
100
          IF OBJ_INT /= 1 THEN
101
               FAILED ("INCORRECT RESULTS - 8");
102
          END IF;
103
          OBJ_FLO := OBJ_FLO ** PAC_VAR;
104
          IF OBJ_FLO /= 1.0 THEN
105
               FAILED ("INCORRECT RESULTS - 9");
106
          END IF;
107
          OBJ_NEWT := 1;
108
          OBJ_NEWT := OBJ_NEWT - 1;
109
          IF OBJ_NEWT NOT IN NEW_T THEN
110
               FAILED ("INCORRECT RESULTS - 10");
111
          END IF;
112
          IF NEW_T'SUCC(2) /= 3 THEN
113
               FAILED ("INCORRECT RESULTS - 11");
114
          END IF;
115
     END;
116
 
117
     DECLARE  -- LIMITED PRIVATE TYPE.
118
          TYPE FIXED IS DELTA 0.125 RANGE 0.0 .. 10.0;
119
 
120
          OBJ_INT : INTEGER := 1;
121
          OBJ_FLO : FLOAT := 1.0;
122
          OBJ_FIX : FIXED := 1.0;
123
 
124
          PACKAGE P1 IS NEW LP (INTEGER);
125
          USE P1;
126
 
127
          TYPE NEW_T IS NEW SUB_T;
128
          OBJ_NEWT : NEW_T;
129
     BEGIN
130
          PAC_VAR := SUB_T'(1);
131
          IF PAC_VAR /= OBJ_INT THEN
132
               FAILED ("INCORRECT RESULTS - 12");
133
          END IF;
134
          OBJ_INT := PAC_VAR + OBJ_INT;
135
          IF OBJ_INT <= PAC_VAR THEN
136
               FAILED ("INCORRECT RESULTS - 13");
137
          END IF;
138
          PAC_VAR := PAC_VAR * OBJ_INT;
139
          IF PAC_VAR NOT IN INTEGER THEN
140
               FAILED ("INCORRECT RESULTS - 14");
141
          END IF;
142
          IF OBJ_INT NOT IN SUB_T THEN
143
               FAILED ("INCORRECT RESULTS - 15");
144
          END IF;
145
          IF INTEGER'POS(2) /= SUB_T'POS(2) THEN
146
               FAILED ("INCORRECT RESULTS - 16");
147
          END IF;
148
          PAC_VAR := 1;
149
          OBJ_FIX := PAC_VAR * OBJ_FIX;
150
          IF OBJ_FIX /= 1.0 THEN
151
               FAILED ("INCORRECT RESULTS - 17");
152
          END IF;
153
          OBJ_INT := 1;
154
          OBJ_FIX := OBJ_FIX / OBJ_INT;
155
          IF OBJ_FIX /= 1.0 THEN
156
               FAILED ("INCORRECT RESULTS - 18");
157
          END IF;
158
          OBJ_INT := OBJ_INT ** PAC_VAR;
159
          IF OBJ_INT /= 1 THEN
160
               FAILED ("INCORRECT RESULTS - 19");
161
          END IF;
162
          OBJ_FLO := OBJ_FLO ** PAC_VAR;
163
          IF OBJ_FLO /= 1.0 THEN
164
               FAILED ("INCORRECT RESULTS - 20");
165
          END IF;
166
          OBJ_NEWT := 1;
167
          OBJ_NEWT := OBJ_NEWT - 1;
168
          IF OBJ_NEWT NOT IN NEW_T THEN
169
               FAILED ("INCORRECT RESULTS - 21");
170
          END IF;
171
          IF NEW_T'SUCC(2) /= 3 THEN
172
               FAILED ("INCORRECT RESULTS - 22");
173
          END IF;
174
     END;
175
 
176
     RESULT;
177
END CC3231A;

powered by: WebSVN 2.1.0

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