1--  C45614B.DEP
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 CONSTRAINT_ERROR IS RAISED BY PREDEFINED SHORT_INTEGER
27--     "**" IF THE SECOND OPERAND HAS A NEGATIVE VALUE.
28
29-- APPLICABILITY CRITERIA:
30--     THIS TEST IS APPLICABLE TO THOSE IMPLEMENTATIONS WHICH SUPPORT
31--     SHORT_INTEGER.
32
33--     IF "SHORT_INTEGER" IS NOT SUPPORTED, THEN THE DECLARATION OF
34--     "CHECK_SHORT" MUST BE REJECTED.
35
36-- HISTORY:
37--     HTG 10/07/86 CREATED ORIGINAL TEST.
38--     DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
39
40WITH REPORT; USE REPORT;
41PROCEDURE C45614B IS
42
43     CHECK_SHORT : SHORT_INTEGER;                   -- N/A => ERROR.
44
45     FUNCTION IDENT (X : SHORT_INTEGER) RETURN SHORT_INTEGER IS
46     BEGIN
47          RETURN SHORT_INTEGER (IDENT_INT (INTEGER (X)));
48     END IDENT;
49
50BEGIN
51
52     TEST ("C45614B", "CHECK THAT CONSTRAINT_ERROR IS RAISED BY " &
53                      "PREDEFINED SHORT_INTEGER ""**"" IF THE " &
54                      "SECOND OPERAND HAS A NEGATIVE VALUE");
55
56     DECLARE
57          A : INTEGER := -2;
58          B : SHORT_INTEGER := 3;
59          INT : SHORT_INTEGER := 0;
60     BEGIN
61          INT := IDENT(B ** IDENT_INT(A));
62          FAILED ("NO EXCEPTION FOR '3**(-2)'");
63
64          EXCEPTION
65               WHEN CONSTRAINT_ERROR =>
66                    NULL;
67               WHEN OTHERS =>
68                    FAILED ("WRONG EXCEPTION RAISED FOR '3**(-2)'");
69     END;
70
71     DECLARE
72          A : INTEGER := -3;
73          B : SHORT_INTEGER := -5;
74          INT : SHORT_INTEGER := 0;
75     BEGIN
76          INT := IDENT(B ** IDENT_INT(A));
77          FAILED ("NO EXCEPTION FOR '(-5)**(-3)'");
78
79          EXCEPTION
80               WHEN CONSTRAINT_ERROR =>
81                    NULL;
82               WHEN OTHERS =>
83                    FAILED ("WRONG EXCEPTION RAISED FOR '(-5)**(-3)'");
84     END;
85
86     DECLARE
87          B : SHORT_INTEGER := 0;
88          INT : SHORT_INTEGER := 0;
89     BEGIN
90          INT := IDENT(B ** IDENT_INT(-3));
91          FAILED ("NO EXCEPTION FOR '0**(-3)");
92
93          EXCEPTION
94               WHEN CONSTRAINT_ERROR =>
95                    NULL;
96               WHEN OTHERS =>
97                    FAILED ("WRONG EXCEPTION RAISED FOR '0**(-3)'");
98     END;
99
100     DECLARE
101          INT : SHORT_INTEGER := 0;
102     BEGIN
103          INT := IDENT(-10 ** IDENT_INT(-2));
104          FAILED ("NO EXCEPTION FOR '(-10)**(-2)'");
105
106          EXCEPTION
107               WHEN CONSTRAINT_ERROR =>
108                    NULL;
109               WHEN OTHERS =>
110                    FAILED ("WRONG EXCEPTION RAISED FOR '(-10)**(-2)'");
111     END;
112
113     DECLARE
114          INT : SHORT_INTEGER := 0;
115     BEGIN
116          INT := IDENT(6 ** IDENT_INT(-4));
117          FAILED ("NO EXCEPTION FOR '6**(-4)'");
118
119          EXCEPTION
120               WHEN CONSTRAINT_ERROR =>
121                    NULL;
122               WHEN OTHERS =>
123                    FAILED ("WRONG EXCEPTION RAISED FOR '6**(-4)'");
124     END;
125
126     RESULT;
127
128END C45614B;
129