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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CD2A31E.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 IS GIVEN FOR AN
27
--     INTEGER TYPE, THEN SUCH A TYPE CAN BE PASSED AS AN ACTUAL
28
--     PARAMETER TO GENERIC PROCEDURES.
29
 
30
-- HISTORY:
31
--     JET 08/12/87  CREATED ORIGINAL TEST.
32
--     BCB 10/18/88  MODIFIED HEADER AND ENTERED IN ACVC.
33
--     DHH 04/06/89  CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED
34
--                   SIZE CLAUSE VALUE TO 9, AND CHANGED 'SIZE CLAUSE
35
--                   CHECKS.
36
--     JRL 03/27/92  ELIMINATED REDUNDANT TESTING.
37
 
38
WITH REPORT;  USE REPORT;
39
 
40
PROCEDURE CD2A31E IS
41
 
42
     TYPE BASIC_INT IS RANGE -100 .. 100;
43
     BASIC_SIZE : CONSTANT := 9;
44
 
45
     FOR BASIC_INT'SIZE USE BASIC_SIZE;
46
 
47
BEGIN
48
 
49
     TEST ("CD2A31E", "CHECK THAT WHEN A SIZE SPECIFICATION IS " &
50
                      "GIVEN FOR AN INTEGER TYPE, THEN SUCH A TYPE " &
51
                      "CAN BE PASSED AS AN ACTUAL PARAMETER TO " &
52
                      "GENERIC PACKAGES AND 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 := -100;
65
          I2 : INT :=    0;
66
          I3 : INT :=  100;
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
               IF NOT ((I1 < IDENT (0))           AND
88
                       (IDENT (I3) > IDENT (I2))  AND
89
                       (I2 <= IDENT (0))          AND
90
                       (IDENT (100) = I3))        THEN
91
                    FAILED ("INCORRECT RESULTS FOR RELATIONAL " &
92
                            "OPERATORS");
93
               END IF;
94
 
95
               IF NOT (((I1 + I3)  = I2)         AND
96
                       ((I2 - I3)  = I1)         AND
97
                       ((I3 * I2)  = I2)         AND
98
                       ((I2 / I1)  = I2)         AND
99
                       ((I1 ** 1)  = I1)         AND
100
                       ((I1 REM 9) = IDENT (-1)) AND
101
                       ((I3 MOD 9) = IDENT (1))) THEN
102
                    FAILED ("INCORRECT RESULTS FOR BINARY ARITHMETIC " &
103
                            "OPERATORS");
104
               END IF;
105
 
106
               IF INT'LAST /= IDENT (100) THEN
107
                    FAILED ("INCORRECT VALUE FOR INT'LAST");
108
               END IF;
109
 
110
               IF INT'VAL (-100) /= IDENT (I1) OR
111
                  INT'VAL (0)    /= IDENT (I2) OR
112
                  INT'VAL (100)  /= IDENT (I3) THEN
113
                    FAILED ("INCORRECT VALUE FOR INT'VAL");
114
               END IF;
115
 
116
               IF INT'PRED (I2) /= IDENT (-1) OR
117
                  INT'PRED (I3) /= IDENT (99) THEN
118
                    FAILED ("INCORRECT VALUE FOR INT'PRED");
119
               END IF;
120
 
121
               IF INT'VALUE ("-100") /= IDENT (I1) OR
122
                  INT'VALUE (" 0")   /= IDENT (I2) OR
123
                  INT'VALUE (" 100") /= IDENT (I3) THEN
124
                         FAILED ("INCORRECT VALUE FOR INT'VALUE");
125
               END IF;
126
 
127
          END GENPROC;
128
 
129
          PROCEDURE NEWPROC IS NEW GENPROC (BASIC_INT);
130
 
131
     BEGIN
132
 
133
          NEWPROC;
134
 
135
     END;
136
 
137
     RESULT;
138
 
139
END CD2A31E;

powered by: WebSVN 2.1.0

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