1-- C45631B.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 TYPE SHORT_INTEGER 'ABS A' EQUALS A IF A IS
27--     POSITIVE AND EQUALS -A IF A IS NEGATIVE.
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--     RJW 02/26/86 CREATED ORIGINAL TEST.
38--     DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
39
40WITH REPORT; USE REPORT;
41
42PROCEDURE C45631B IS
43
44     CHECK_SHORT : SHORT_INTEGER;                   -- N/A => ERROR.
45
46     FUNCTION IDENT (X : SHORT_INTEGER) RETURN SHORT_INTEGER IS
47     BEGIN
48          RETURN SHORT_INTEGER (IDENT_INT (INTEGER (X)));
49     END IDENT;
50
51BEGIN
52
53     TEST ( "C45631B", "CHECK THAT FOR TYPE SHORT_INTEGER 'ABS A' " &
54                       "EQUALS A IF A IS POSITIVE AND EQUALS -A IF " &
55                       "A IS NEGATIVE" );
56
57     DECLARE
58
59          P : SHORT_INTEGER := IDENT (1);
60          N : SHORT_INTEGER := IDENT (-1);
61          Z : SHORT_INTEGER := IDENT (0);
62     BEGIN
63
64          IF ABS P = P THEN
65               NULL;
66          ELSE
67               FAILED ( "'ABS' TEST FOR P - 1" );
68          END IF;
69
70          IF ABS N = -N THEN
71               NULL;
72          ELSE
73               FAILED ( "'ABS' TEST FOR N - 1" );
74          END IF;
75
76          IF ABS Z = Z THEN
77               NULL;
78          ELSE
79               FAILED ( "'ABS TEST FOR Z - 1" );
80          END IF;
81
82          IF ABS (Z) = -Z THEN
83               NULL;
84          ELSE
85               FAILED ( "'ABS TEST FOR Z - 2");
86          END IF;
87
88          IF "ABS" (RIGHT => P) = P THEN
89               NULL;
90          ELSE
91               FAILED ( "'ABS' TEST FOR P - 2" );
92          END IF;
93
94          IF "ABS" (N) = -N THEN
95               NULL;
96          ELSE
97               FAILED ( "'ABS' TEST FOR N - 2 " );
98          END IF;
99
100          IF "ABS" (Z) = Z THEN
101               NULL;
102          ELSE
103               FAILED ( "'ABS' TEST FOR Z - 3" );
104          END IF;
105
106          IF ABS (IDENT (-SHORT_INTEGER'LAST)) = SHORT_INTEGER'LAST
107             THEN
108               NULL;
109          ELSE
110               FAILED ( "'ABS' TEST FOR -SHORT_INTEGER'LAST" );
111          END IF;
112     END;
113
114     RESULT;
115
116END C45631B;
117