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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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