1-- C45304A.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 CONSTRAINT_ERROR IS RAISED BY
27--     "+" AND "-" FOR PREDEFINED INTEGER WHEN THE RESULT IS OUTSIDE
28--     THE RANGE OF THE BASE TYPE.
29
30-- *** NOTE: This test has been modified since ACVC version 1.11 to    -- 9X
31-- ***       remove incompatibilities associated with the transition   -- 9X
32-- ***       to Ada 9X.                                                -- 9X
33
34-- HISTORY:
35--     TBN 10/06/86  CREATED ORIGINAL TEST.
36--     JET 12/29/87  FURTHER DEFEATED OPTIMIZATION.
37--     JRL 03/30/93 REMOVED NUMERIC_ERROR FROM TEST.
38
39WITH REPORT; USE REPORT;
40PROCEDURE C45304A IS
41
42BEGIN
43     TEST ("C45304A", "CHECK THAT CONSTRAINT_ERROR " &
44                      "IS RAISED BY ""+"" AND ""-"" FOR PREDEFINED " &
45                      "INTEGER WHEN THE RESULT IS OUTSIDE THE RANGE " &
46                      "OF THE BASE TYPE");
47
48     DECLARE
49          B : INTEGER := INTEGER'LAST;
50     BEGIN
51          IF EQUAL (IDENT_INT(B)+1, 0) THEN
52               FAILED ("NO EXCEPTION FOR ADDITION -- ZERO RESULT");
53          ELSE
54               FAILED ("NO EXCEPTION FOR ADDITION -- NONZERO RESULT");
55          END IF;
56
57     EXCEPTION
58          WHEN CONSTRAINT_ERROR =>
59               NULL;
60          WHEN OTHERS =>
61               FAILED ("UNEXPECTED EXCEPTION RAISED FOR ADDITION");
62     END;
63
64     DECLARE
65          B : INTEGER := INTEGER'FIRST;
66     BEGIN
67          IF EQUAL (IDENT_INT(B)-1, 0) THEN
68               FAILED ("NO EXCEPTION FOR SUBTRACTION -- ZERO RESULT");
69          ELSE
70               FAILED ("NO EXCEPTION FOR SUBTRACTION -- " &
71                       "NONZERO RESULT");
72          END IF;
73
74     EXCEPTION
75          WHEN CONSTRAINT_ERROR =>
76               NULL;
77          WHEN OTHERS =>
78               FAILED ("UNEXPECTED EXCEPTION RAISED FOR SUBTRACTION");
79     END;
80
81     RESULT;
82END C45304A;
83