OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c4/] [c47004a.ada] - Blame information for rev 720

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- C47004A.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
-- WHEN THE TYPE MARK IN A QUALIFIED EXPRESSION DENOTES AN INTEGER 
26
-- TYPE, CHECK THAT CONSTRAINT_ERROR IS RAISED WHEN THE VALUE OF THE 
27
-- OPERAND DOES NOT LIE WITHIN THE RANGE OF THE TYPE MARK.
28
 
29
-- RJW 7/23/86
30
 
31
WITH REPORT; USE REPORT;
32
PROCEDURE C47004A IS
33
 
34
BEGIN
35
 
36
     TEST( "C47004A", "WHEN THE TYPE MARK IN A QUALIFIED " &
37
                      "EXPRESSION DENOTES AN INTEGER " &
38
                      "TYPE, CHECK THAT CONSTRAINT_ERROR IS RAISED " &
39
                      "WHEN THE VALUE OF THE OPERAND DOES NOT LIE " &
40
                      "WITHIN THE RANGE OF THE TYPE MARK" );
41
 
42
     DECLARE
43
 
44
          TYPE INT IS RANGE -10 .. 10;
45
          SUBTYPE SINT IS INT RANGE -5 .. 5;
46
 
47
          FUNCTION IDENT (I : INT) RETURN INT IS
48
          BEGIN
49
               RETURN INT (IDENT_INT (INTEGER (I)));
50
          END;
51
 
52
     BEGIN
53
          IF SINT'(IDENT (10)) = 5 THEN
54
               FAILED ( "NO EXCEPTION RAISED FOR VALUE OUTSIDE OF " &
55
                        "SUBTYPE SINT - 1");
56
          ELSE
57
               FAILED ( "NO EXCEPTION RAISED FOR VALUE OUTSIDE OF " &
58
                        "SUBTYPE SINT - 2");
59
          END IF;
60
     EXCEPTION
61
          WHEN CONSTRAINT_ERROR =>
62
               NULL;
63
          WHEN OTHERS =>
64
               FAILED ( "WRONG EXCEPTION RAISED FOR VALUE OUTSIDE " &
65
                        "OF SUBTYPE SINT" );
66
     END;
67
 
68
     DECLARE
69
 
70
          SUBTYPE SINTEGER IS INTEGER RANGE -10 .. 10;
71
 
72
     BEGIN
73
          IF SINTEGER'(IDENT_INT (20)) = 15 THEN
74
               FAILED ( "NO EXCEPTION RAISED FOR VALUE OUTSIDE OF " &
75
                        "SUBTYPE SINTEGER - 1");
76
          ELSE
77
               FAILED ( "NO EXCEPTION RAISED FOR VALUE OUTSIDE OF " &
78
                        "SUBTYPE SINTEGER - 2");
79
          END IF;
80
     EXCEPTION
81
          WHEN CONSTRAINT_ERROR =>
82
               NULL;
83
          WHEN OTHERS =>
84
               FAILED ( "WRONG EXCEPTION RAISED FOR VALUE OUTSIDE " &
85
                        "OF SUBTYPE SINTEGER" );
86
     END;
87
 
88
     DECLARE
89
 
90
          TYPE NINTEGER IS NEW INTEGER;
91
          SUBTYPE SNINT IS NINTEGER RANGE -10 .. 10;
92
 
93
          FUNCTION IDENT (I : NINTEGER) RETURN NINTEGER IS
94
          BEGIN
95
               RETURN NINTEGER (IDENT_INT (INTEGER (I)));
96
          END;
97
 
98
     BEGIN
99
          IF SNINT'(IDENT (-20)) = -10 THEN
100
               FAILED ( "NO EXCEPTION RAISED FOR VALUE OUTSIDE OF " &
101
                        "SUBTYPE SNINT - 1");
102
          ELSE
103
               FAILED ( "NO EXCEPTION RAISED FOR VALUE OUTSIDE OF " &
104
                        "SUBTYPE SNINT - 2");
105
          END IF;
106
     EXCEPTION
107
          WHEN CONSTRAINT_ERROR =>
108
               NULL;
109
          WHEN OTHERS =>
110
               FAILED ( "WRONG EXCEPTION RAISED FOR VALUE OUTSIDE " &
111
                        "OF SUBTYPE SNINT" );
112
     END;
113
 
114
     RESULT;
115
END C47004A;

powered by: WebSVN 2.1.0

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