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/] [c4/] [c44003f.ada] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C44003F.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 FOR CORRECT PRECEDENCE OF PRE-DEFINED AND OVERLOADED
27
--     OPERATIONS ON ENUMERATION TYPES OTHER THAN BOOLEAN OR CHARACTER
28
--     AND ONE-DIMENSIONAL ARRAYS WITH COMPONENTS OF SUCH TYPES.
29
 
30
-- HISTORY:
31
--     RJW 10/13/88  CREATED ORIGINAL TEST.
32
 
33
WITH REPORT; USE REPORT;
34
PROCEDURE C44003F IS
35
 
36
     TYPE ENUM IS (ZERO, ONE, TWO, THREE, FOUR, FIVE);
37
 
38
BEGIN
39
     TEST ("C44003F", "CHECK FOR CORRECT PRECEDENCE OF PRE-DEFINED " &
40
                      "AND OVERLOADED OPERATIONS ON ENUMERATION " &
41
                      "TYPES OTHER THAN BOOLEAN OR CHARACTER AND " &
42
                      "ONE-DIMENSIONAL ARRAYS WITH COMPONENTS OF " &
43
                      "SUCH TYPES");
44
 
45
 
46
----- ENUMERATION TYPE:
47
 
48
     DECLARE
49
          E1 : ENUM := ONE;
50
          E2 : ENUM := TWO;
51
          E5 : ENUM := FIVE;
52
 
53
          FUNCTION "AND" (LEFT, RIGHT : ENUM) RETURN ENUM IS
54
          BEGIN
55
               RETURN ZERO;
56
          END "AND";
57
 
58
          FUNCTION "<" (LEFT, RIGHT : ENUM) RETURN ENUM IS
59
          BEGIN
60
               RETURN THREE;
61
          END "<";
62
 
63
          FUNCTION "-" (LEFT, RIGHT : ENUM) RETURN ENUM IS
64
          BEGIN
65
               RETURN ENUM'VAL (ENUM'POS (LEFT) - ENUM'POS (RIGHT));
66
          END "-";
67
 
68
          FUNCTION "+" (RIGHT : ENUM) RETURN ENUM IS
69
          BEGIN
70
               RETURN RIGHT;
71
          END "+";
72
 
73
          FUNCTION "*" (LEFT, RIGHT : ENUM) RETURN ENUM IS
74
          BEGIN
75
               RETURN ENUM'VAL (ENUM'POS (LEFT) * ENUM'POS (RIGHT));
76
          END "*";
77
 
78
          FUNCTION "**" (LEFT, RIGHT : ENUM) RETURN ENUM IS
79
          BEGIN
80
               RETURN ENUM'VAL (ENUM'POS (LEFT) ** ENUM'POS (RIGHT));
81
          END "**";
82
 
83
     BEGIN
84
          IF NOT (+E1 < E2) OR NOT (E2 >= +E2) OR NOT (E5 = +FIVE) THEN
85
               FAILED ("INCORRECT RESULT - 1");
86
          END IF;
87
 
88
          IF (E5 ** E1 AND E2) /= (E5 - E1 * E5 ** E1) THEN
89
               FAILED ("INCORRECT RESULT - 2");
90
          END IF;
91
 
92
     END;
93
 
94
----- ARRAYS:
95
 
96
     DECLARE
97
          TYPE ARR IS ARRAY (INTEGER RANGE <>) OF ENUM;
98
 
99
          SUBTYPE SARR IS ARR (1 .. 3);
100
 
101
          E1 : SARR := (OTHERS => ONE);
102
          E2 : SARR := (OTHERS => TWO);
103
          E5 : SARR := (OTHERS => FIVE);
104
 
105
          FUNCTION "XOR" (LEFT, RIGHT : ARR) RETURN ARR IS
106
          BEGIN
107
               RETURN (1 .. 3 => ZERO);
108
          END "XOR";
109
 
110
          FUNCTION "<=" (LEFT, RIGHT : ARR) RETURN ARR IS
111
          BEGIN
112
               RETURN (1 .. 3 => THREE);
113
          END "<=";
114
 
115
          FUNCTION "+" (LEFT, RIGHT : ARR) RETURN ARR IS
116
          BEGIN
117
               RETURN (1 .. 3 => ZERO);
118
          END "+";
119
 
120
          FUNCTION "MOD" (LEFT, RIGHT : ARR) RETURN ARR IS
121
          BEGIN
122
               RETURN (1 .. 3 => THREE);
123
          END "MOD";
124
 
125
          FUNCTION "**" (LEFT, RIGHT : ARR) RETURN ARR IS
126
          BEGIN
127
               RETURN (1 .. 3 => FOUR);
128
          END "**";
129
     BEGIN
130
          IF (E5 ** E1 <= E2 + E5 MOD E1 XOR E1) /= (1 .. 3 => ZERO)
131
             THEN
132
               FAILED ("INCORRECT RESULT - 3");
133
          END IF;
134
 
135
          IF (E5 ** E1 & E2) /= (FOUR, FOUR, FOUR, TWO, TWO, TWO) OR
136
             (E1 MOD E2 <= E5) /= (1 .. 3 => THREE) THEN
137
               FAILED ("INCORRECT RESULT - 4");
138
          END IF;
139
     END;
140
 
141
     RESULT;
142
 
143
END C44003F;

powered by: WebSVN 2.1.0

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