1-- C45632B.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 FOR PREDEFINED TYPE SHORT_INTEGER,
27--     CONSTRAINT_ERROR IS RAISED FOR ABS (SHORT_INTEGER'FIRST)
28--     IF -SHORT_INTEGER'LAST > SHORT_INTEGER'FIRST.
29
30-- APPLICABILITY CRITERIA:
31--     THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS THAT SUPPORT
32--     THE PREDEFINED TYPE "SHORT_INTEGER".
33
34--     IF SUCH A TYPE IS NOT SUPPORTED, THEN THE DECLARATION OF THE
35--     VARIABLE "TEST_VAR" MUST BE REJECTED.
36
37-- *** NOTE: This test has been modified since ACVC version 1.11 to    -- 9X
38-- ***       remove incompatibilities associated with the transition   -- 9X
39-- ***       to Ada 9X.                                                -- 9X
40-- ***                                                                 -- 9X
41
42-- HISTORY:
43--     RJW 02/20/86  CREATED ORIGINAL TEST.
44--     JET 12/30/87  UPDATED HEADER FORMAT, ADDED CODE TO DEFEAT
45--                   OPTIMIZATION.
46--     MRM 03/30/93  REMOVED NUMERIC_ERROR FOR 9X COMPATIBILITY
47
48WITH REPORT; USE REPORT;
49
50PROCEDURE C45632B IS
51
52     TEST_VAR : SHORT_INTEGER;               -- N/A => ERROR.
53     I : SHORT_INTEGER;
54
55     FUNCTION IDENT_SHORT (A : SHORT_INTEGER) RETURN SHORT_INTEGER IS
56     BEGIN
57          IF EQUAL (3,3) THEN
58               RETURN A;
59          ELSE
60               RETURN 0;
61          END IF;
62     END IDENT_SHORT;
63
64BEGIN
65
66     TEST ( "C45632B", "CHECK THAT FOR PREDEFINED TYPE " &
67                       "SHORT_INTEGER CONSTRAINT_ERROR IS RAISED FOR " &
68                       "ABS (SHORT_INTEGER'FIRST) IF " &
69                       "-SHORT_INTEGER'LAST > SHORT_INTEGER'FIRST");
70
71     BEGIN
72          I := IDENT_SHORT (SHORT_INTEGER'FIRST);
73
74          IF -SHORT_INTEGER'LAST > SHORT_INTEGER'FIRST THEN
75               BEGIN
76                    IF IDENT_SHORT (ABS I) = IDENT_SHORT (I) THEN
77                         FAILED ("NO EXCEPTION -- EQUALITY TRUE");
78                    ELSE
79                         FAILED ("NO EXCEPTION -- EQUALITY FALSE");
80                    END IF;
81               EXCEPTION
82                    WHEN CONSTRAINT_ERROR =>
83                         COMMENT ( "CONSTRAINT_ERROR RAISED" );
84                    WHEN OTHERS =>
85                         FAILED ( "WRONG EXCEPTION RAISED" );
86               END;
87          ELSE
88               COMMENT ( "-SHORT_INTEGER'LAST <= SHORT_INTEGER'FIRST");
89          END IF;
90     END;
91
92     RESULT;
93
94END C45632B;
95