1-- C45504B.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
27--      A PRODUCT LIES OUTSIDE THE RANGE OF THE BASE TYPE, IF
28--      THE OPERANDS ARE OF PREDEFINED TYPE SHORT_INTEGER.
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
35--      THE 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 ADDED CODE TO
44--                    DEFEAT OPTIMIZATION.
45--      JRL 03/30/93  REMOVED NUMERIC_ERROR FROM TEST.
46
47WITH REPORT; USE REPORT;
48PROCEDURE C45504B IS
49
50     F : SHORT_INTEGER;                -- N/A => ERROR.
51     L : SHORT_INTEGER;
52
53     FUNCTION IDENT_SHORT(A : SHORT_INTEGER) RETURN SHORT_INTEGER IS
54     BEGIN
55          IF EQUAL (3,3) THEN
56               RETURN A;
57          ELSE
58               RETURN 0;
59          END IF;
60     END IDENT_SHORT;
61
62     FUNCTION SHORT_OK(X : SHORT_INTEGER) RETURN BOOLEAN IS
63     BEGIN
64          RETURN X = IDENT_SHORT(X);
65     END SHORT_OK;
66
67BEGIN
68     TEST ( "C45504B", "CHECK THAT CONSTRAINT_ERROR " &
69                       "IS RAISED WHEN A PRODUCT LIES OUTSIDE THE " &
70                       "RANGE OF THE BASE TYPE, IF THE OPERANDS ARE " &
71                       "OF PREDEFINED TYPE SHORT_INTEGER" );
72
73     F := IDENT_SHORT(SHORT_INTEGER'FIRST);
74     L := IDENT_SHORT(SHORT_INTEGER'LAST);
75
76     BEGIN
77          IF SHORT_OK (F*L) THEN
78               FAILED ( "NO EXCEPTION RAISED BY 'F * L' - 1" );
79          ELSE
80               FAILED ( "NO EXCEPTION RAISED BY 'F * L' - 2" );
81          END IF;
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 SHORT_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     EXCEPTION
96          WHEN CONSTRAINT_ERROR =>
97               COMMENT ( "CONSTRAINT_ERROR RAISED BY 'F * F'" );
98          WHEN OTHERS =>
99               FAILED ( "WRONG EXCEPTION RAISED BY 'F * F'" );
100     END;
101
102     BEGIN
103          IF SHORT_OK (L * L) THEN
104               FAILED ( "NO EXCEPTION RAISED BY 'L * L' - 1" );
105          ELSE
106               FAILED ( "NO EXCEPTION RAISED BY 'L * L' - 2" );
107          END IF;
108     EXCEPTION
109          WHEN CONSTRAINT_ERROR =>
110               COMMENT ( "CONSTRAINT_ERROR RAISED BY 'L * L'" );
111          WHEN OTHERS =>
112               FAILED ( "WRONG EXCEPTION RAISED BY 'L * L'" );
113     END;
114
115     RESULT;
116
117END C45504B;
118