1-- C45504C.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 WHEN A
27--      PRODUCT LIES OUTSIDE THE RANGE OF THE BASE TYPE, IF THE
28--      OPERANDS ARE OF PREDEFINED TYPE LONG_INTEGER.
29
30-- APPLICABILITY CRITERIA:
31--      THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS THAT SUPPORT
32--      THE PREDEFINED TYPE "LONG_INTEGER".
33
34--      IF SUCH A TYPE IS NOT SUPPORTED THEN THE DECLARATION OF THE
35--      VARIABLE "F" 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
41-- HISTORY:
42--      RJW 09/01/86  CREATED ORIGINAL TEST.
43--      JET 12/30/87  UPDATED HEADER FORMAT AND DEFEATED OPTIMIZATION.
44--      JRL 03/30/93  REMOVED NUMERIC_ERROR FROM TEST.
45
46WITH REPORT; USE REPORT;
47PROCEDURE C45504C IS
48
49     F : LONG_INTEGER;                --  N/A => ERROR.
50     L : LONG_INTEGER;
51
52     FUNCTION IDENT_LONG(A : LONG_INTEGER) RETURN LONG_INTEGER IS
53     BEGIN
54          IF EQUAL (3, 3) THEN
55               RETURN A;
56          ELSE
57               RETURN 0;
58          END IF;
59     END IDENT_LONG;
60
61     FUNCTION LONG_OK (X : LONG_INTEGER) RETURN BOOLEAN IS
62     BEGIN
63          RETURN X = IDENT_LONG(X);
64     END;
65
66BEGIN
67     TEST ( "C45504C", "CHECK THAT CONSTRAINT_ERROR " &
68                       "IS RAISED WHEN A PRODUCT LIES OUTSIDE THE " &
69                       "RANGE OF THE BASE TYPE, IF THE OPERANDS ARE " &
70                       "OF PREDEFINED TYPE LONG_INTEGER" );
71
72     F := IDENT_LONG(LONG_INTEGER'FIRST);
73     L := IDENT_LONG(LONG_INTEGER'LAST);
74
75     BEGIN
76          IF LONG_OK (F * L) THEN
77               FAILED ( "NO EXCEPTION RAISED BY 'F * L' - 1" );
78          ELSE
79               FAILED ( "NO EXCEPTION RAISED BY 'F * L' - 2" );
80          END IF;
81
82     EXCEPTION
83          WHEN CONSTRAINT_ERROR =>
84               COMMENT ( "CONSTRAINT_ERROR RAISED BY 'F * L'" );
85          WHEN OTHERS =>
86               FAILED ( "WRONG EXCEPTION RAISED BY 'F * L'" );
87     END;
88
89     BEGIN
90          IF LONG_OK (F * F) THEN
91               FAILED ( "NO EXCEPTION RAISED BY 'F * F' - 1" );
92          ELSE
93               FAILED ( "NO EXCEPTION RAISED BY 'F * F' - 2" );
94          END IF;
95
96     EXCEPTION
97          WHEN CONSTRAINT_ERROR =>
98               COMMENT ( "CONSTRAINT_ERROR RAISED BY 'F * F'" );
99          WHEN OTHERS =>
100               FAILED ( "WRONG EXCEPTION RAISED BY 'F * F'" );
101     END;
102
103     BEGIN
104          IF LONG_OK (L * L) THEN
105               FAILED ( "NO EXCEPTION RAISED BY 'L * L' - 1" );
106          ELSE
107               FAILED ( "NO EXCEPTION RAISED BY 'L * L' - 2" );
108          END IF;
109
110     EXCEPTION
111          WHEN CONSTRAINT_ERROR =>
112               COMMENT ( "CONSTRAINT_ERROR RAISED BY 'L * L'" );
113          WHEN OTHERS =>
114               FAILED ( "WRONG EXCEPTION RAISED BY 'L * L'" );
115     END;
116
117     RESULT;
118
119END C45504C;
120