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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C67005B.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
-- CHECK THAT IF EQUALITY IS REDEFINED FOR A SCALAR TYPE, CASE
26
-- STATEMENTS STILL USE THE PREDEFINED EQUALITY OPERATION.
27
 
28
-- JBG 9/28/83
29
 
30
WITH REPORT; USE REPORT;
31
PROCEDURE C67005B IS
32
 
33
     GENERIC
34
          TYPE LP IS LIMITED PRIVATE;
35
          WITH FUNCTION EQUAL (L, R : LP) RETURN BOOLEAN;
36
     PACKAGE EQUALITY_OPERATOR IS
37
          FUNCTION "=" (L, R : LP) RETURN BOOLEAN;
38
     END EQUALITY_OPERATOR;
39
 
40
     PACKAGE BODY EQUALITY_OPERATOR IS
41
          FUNCTION "=" (L, R : LP) RETURN BOOLEAN IS
42
          BEGIN
43
               RETURN EQUAL(L, R);
44
          END "=";
45
     END EQUALITY_OPERATOR;
46
 
47
BEGIN
48
     TEST ("C67005B", "CHECK THAT REDEFINING EQUALITY FOR A " &
49
                      "SCALAR TYPE DOES NOT AFFECT CASE STATEMENTS");
50
 
51
     DECLARE
52
          TYPE MY IS NEW INTEGER;
53
          CHECK : MY;
54
 
55
          VAR : INTEGER RANGE 1..3 := 3;
56
 
57
          PACKAGE INTEGER_EQUALS IS
58
               FUNCTION EQUAL (L, R : INTEGER) RETURN BOOLEAN;
59
               PACKAGE INTEGER_EQUAL IS NEW EQUALITY_OPERATOR
60
                         (INTEGER, EQUAL);
61
          END INTEGER_EQUALS;
62
 
63
          FUNCTION "=" (L, R : INTEGER) RETURN BOOLEAN RENAMES
64
                       INTEGER_EQUALS.INTEGER_EQUAL."=";
65
 
66
          PACKAGE BODY INTEGER_EQUALS IS
67
               FUNCTION EQUAL (L, R : INTEGER) RETURN BOOLEAN IS
68
               BEGIN
69
                    RETURN FALSE;
70
               END EQUAL;
71
          END INTEGER_EQUALS;
72
 
73
     BEGIN
74
 
75
          IF VAR = 3 THEN
76
               FAILED ("DID NOT USE REDEFINED '=' - 1");
77
          END IF;
78
 
79
          IF VAR /= 3 THEN
80
               NULL;
81
          ELSE
82
               FAILED ("DID NOT USE REDEFINED '/=' - 1");
83
          END IF;
84
 
85
          IF VAR = IDENT_INT(3) THEN
86
               FAILED ("DID NOT USE REDEFINED '=' - 2");
87
          END IF;
88
 
89
          IF VAR /= IDENT_INT(3) THEN
90
               NULL;
91
          ELSE
92
               FAILED ("DID NOT USE REDEFINED '/=' - 2");
93
          END IF;
94
 
95
          CHECK := MY(IDENT_INT(0));
96
          IF CHECK /= 0 THEN
97
               FAILED ("USING WRONG EQUALITY FOR DERIVED TYPE");
98
          END IF;
99
 
100
          CASE VAR IS
101
               WHEN 1..3 => CHECK := MY(IDENT_INT(1));
102
               WHEN OTHERS => NULL;
103
          END CASE;
104
 
105
          IF CHECK /= 1 THEN
106
               FAILED ("DID NOT USE PREDEFINED EQUALS IN CASE - 1");
107
          END IF;
108
 
109
          CASE IDENT_INT(VAR) IS
110
               WHEN 1 => CHECK := 4;
111
               WHEN 2 => CHECK := 5;
112
               WHEN 3 => CHECK := 6;
113
               WHEN OTHERS => CHECK := 7;
114
          END CASE;
115
 
116
          IF CHECK /= 6 THEN
117
               FAILED ("DID NOT USE PREDEFINED EQUALS IN CASE - 2");
118
          END IF;
119
 
120
     END;
121
 
122
     RESULT;
123
 
124
END C67005B;

powered by: WebSVN 2.1.0

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