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

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

Line No. Rev Author Line
1 149 jeremybenn
-- CD2A32I.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 WHEN A SIZE SPECIFICATION OF THE SMALLEST APPROPRIATE
27
--     SIGNED SIZE IS GIVEN FOR AN INTEGER TYPE, THE TYPE CAN
28
--     BE PASSED AS AN ACTUAL PARAMETER TO GENERIC PROCEDURES.
29
 
30
-- HISTORY:
31
--     JET 08/12/87  CREATED ORIGINAL TEST.
32
--     DHH 04/11/89  CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED
33
--                   SIZE CLAUSE VALUE TO 7, AND CHANGED OPERATOR ON
34
--                   'SIZE CHECKS.
35
--     JRL 03/27/92  ELIMINATED REDUNDANT TESTING.
36
 
37
WITH REPORT;  USE REPORT;
38
PROCEDURE CD2A32I IS
39
 
40
     TYPE BASIC_INT IS RANGE -63 .. 63;
41
     BASIC_SIZE : CONSTANT := 7;
42
 
43
     FOR BASIC_INT'SIZE USE BASIC_SIZE;
44
 
45
BEGIN
46
 
47
     TEST ("CD2A32I", "CHECK THAT WHEN A SIZE SPECIFICATION " &
48
                      "OF THE SMALLEST APPROPRIATE SIGNED SIZE " &
49
                      "IS GIVEN FOR AN INTEGER TYPE, " &
50
                      "THE TYPE " &
51
                      "CAN BE PASSED AS AN ACTUAL PARAMETER TO " &
52
                      "GENERIC PROCEDURES");
53
 
54
     DECLARE -- TYPE DECLARATION WITHIN GENERIC PROCEDURE.
55
 
56
          GENERIC
57
               TYPE GPARM IS RANGE <>;
58
          PROCEDURE GENPROC;
59
 
60
          PROCEDURE GENPROC IS
61
 
62
          SUBTYPE INT IS GPARM;
63
 
64
          I1 : INT := -63;
65
          I2 : INT :=    0;
66
          I3 : INT :=  63;
67
 
68
          FUNCTION IDENT (I : INT) RETURN INT IS
69
          BEGIN
70
               IF EQUAL (0,0) THEN
71
                    RETURN I;
72
               ELSE
73
                    RETURN 0;
74
               END IF;
75
          END IDENT;
76
 
77
          BEGIN -- GENPROC.
78
 
79
               IF INT'SIZE /= IDENT_INT (BASIC_SIZE) THEN
80
                    FAILED ("INCORRECT VALUE FOR INT'SIZE");
81
               END IF;
82
 
83
               IF I1'SIZE < IDENT_INT (BASIC_SIZE) THEN
84
                    FAILED ("INCORRECT VALUE FOR I1'SIZE");
85
               END IF;
86
 
87
               FOR I IN IDENT (I1) .. IDENT (I3) LOOP
88
                    IF NOT (I IN I1 .. I3) OR
89
                       (I NOT IN IDENT(-63) .. IDENT(63)) THEN
90
                         FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " &
91
                                 "OPERATORS");
92
                    END IF;
93
               END LOOP;
94
 
95
               IF NOT ((+I1 = I1)     AND
96
                       (-I3 = I1)     AND
97
                       (ABS I1 = I3)) THEN
98
                    FAILED ("INCORRECT RESULTS FOR UNARY ARITHMETIC " &
99
                            "OPERATORS");
100
               END IF;
101
 
102
               IF INT'LAST /= IDENT (63) THEN
103
                    FAILED ("INCORRECT VALUE FOR INT'LAST");
104
               END IF;
105
 
106
               IF INT'VAL (-63) /= IDENT (I1) OR
107
                  INT'VAL (0)    /= IDENT (I2) OR
108
                  INT'VAL (63)  /= IDENT (I3) THEN
109
                    FAILED ("INCORRECT VALUE FOR INT'VAL");
110
               END IF;
111
 
112
               IF INT'PRED (I2) /= IDENT (-1) OR
113
                  INT'PRED (I3) /= IDENT (62) THEN
114
                    FAILED ("INCORRECT VALUE FOR INT'PRED");
115
               END IF;
116
 
117
               IF INT'VALUE ("-63") /= IDENT (I1) OR
118
                  INT'VALUE (" 0")   /= IDENT (I2) OR
119
                  INT'VALUE (" 63") /= IDENT (I3) THEN
120
                         FAILED ("INCORRECT VALUE FOR INT'VALUE");
121
               END IF;
122
 
123
          END GENPROC;
124
 
125
          PROCEDURE NEWPROC IS NEW GENPROC (BASIC_INT);
126
 
127
     BEGIN
128
 
129
          NEWPROC;
130
 
131
     END;
132
 
133
     RESULT;
134
 
135
END CD2A32I;

powered by: WebSVN 2.1.0

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