3 -- Grant of Unlimited Rights
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
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.
27 -- Check that Enumeration_Representation_Clauses are supported for
28 -- codes in the range System.Min_Int..System.Max_Int.
31 -- This test defines several types, and checks that the range of the
32 -- enumeration clause is as expected.
34 -- APPLICABILITY CRITERIA:
35 -- All implementations must attempt to compile this test.
37 -- For implementations validating against Systems Programming Annex (C):
38 -- this test must execute and report PASSED.
40 -- For implementations not validating against Annex C:
41 -- this test may report compile time errors at one or more points
42 -- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
43 -- Otherwise, the test must execute and report PASSED.
47 -- 22 JUL 95 SAIC Initial version
48 -- 07 MAY 96 SAIC Revised for 2.1
49 -- 16 FEB 98 EDS Modified Documentation.
53 with Ada
.Unchecked_Conversion
;
56 type Press_The_Bounds
is ( Negative_Large
, Positive_Large
);
58 for Press_The_Bounds
use
59 ( Negative_Large
=> System
.Min_Int
, -- ANX-C RQMT.
60 Positive_Large
=> System
.Max_Int
); -- ANX-C RQMT.
62 type Add_The_Bounds
is
63 ( Monday
, Tuesday
, Wednesday
, Thursday
, Friday
, Saturday
);
65 for Add_The_Bounds
use
66 ( Monday
=> System
.Min_Int
, -- ANX-C RQMT.
67 Tuesday
=> System
.Min_Int
+ 1, -- ANX-C RQMT.
68 Wednesday
=> System
.Min_Int
+ 2, -- ANX-C RQMT.
69 Thursday
=> System
.Min_Int
+ 3, -- ANX-C RQMT.
70 Friday
=> System
.Min_Int
+ 4, -- ANX-C RQMT.
71 Saturday
=> System
.Min_Int
+ 5 ); -- ANX-C RQMT.
73 type Minus_The_Bounds
is ( Jan
, Feb
, Mar
, Apr
);
75 for Minus_The_Bounds
use
76 ( Apr
=> System
.Max_Int
, -- ANX-C RQMT.
77 Mar
=> System
.Max_Int
- 1, -- ANX-C RQMT.
78 Feb
=> System
.Max_Int
- 2, -- ANX-C RQMT.
79 Jan
=> System
.Max_Int
- 3 ); -- ANX-C RQMT.
81 type TC_Integer
is range System
.Min_Int
..System
.Max_Int
;
83 procedure TC_Check_Press
;
85 procedure TC_Check_Add
;
87 procedure TC_Check_Minus
;
89 function TC_Compare_Press
is new Ada
.Unchecked_Conversion
90 (Press_The_Bounds
, TC_Integer
);
92 function TC_Compare_Add
is new Ada
.Unchecked_Conversion
93 (Add_The_Bounds
, TC_Integer
);
95 function TC_Compare_Minus
is new Ada
.Unchecked_Conversion
96 (Minus_The_Bounds
, TC_Integer
);
100 --==================================================================--
103 package body CD40001_0
is
105 procedure TC_Check_Press
is
106 My_Press_First
: Press_The_Bounds
:= Negative_Large
;
107 My_Press_Last
: Press_The_Bounds
:= Positive_Large
;
109 if TC_Compare_Press
(My_Press_First
) /= System
.Min_Int
or
110 TC_Compare_Press
(My_Press_Last
) /= System
.Max_Int
113 ("Expected enumeration size of System.Min_Int and System.Max_Int " &
114 "not available for this implementation");
118 ---------------------------------------------------------------------------
119 procedure TC_Check_Add
is
120 My_Monday
: Add_The_Bounds
:= Monday
;
121 My_Tuesday
: Add_The_Bounds
:= Tuesday
;
122 My_Wednesday
: Add_The_Bounds
:= Wednesday
;
123 My_Thursday
: Add_The_Bounds
:= Thursday
;
124 My_Friday
: Add_The_Bounds
:= Friday
;
125 My_Saturday
: Add_The_Bounds
:= Saturday
;
127 if TC_Compare_Add
(My_Monday
) /= (System
.Min_Int
) or
128 TC_Compare_Add
(My_Thursday
) /= (System
.Min_Int
+ 3) or
129 TC_Compare_Add
(My_Wednesday
) /= (System
.Min_Int
+ 2) or
130 TC_Compare_Add
(My_Tuesday
) /= (System
.Min_Int
+ 1) or
131 TC_Compare_Add
(My_Saturday
) /= (System
.Min_Int
+ 5) or
132 TC_Compare_Add
(My_Friday
) /= (System
.Min_Int
+ 4)
135 ("Expected enumeration size of System.Min_Int, System.Min_Int + 1 " &
136 "through System.Min_Int + 5 not available for this implementation");
140 ---------------------------------------------------------------------------
141 procedure TC_Check_Minus
is
142 My_Jan
: Minus_The_Bounds
:= Jan
;
143 My_Feb
: Minus_The_Bounds
:= Feb
;
144 My_Mar
: Minus_The_Bounds
:= Mar
;
145 My_Apr
: Minus_The_Bounds
:= Apr
;
147 if TC_Compare_Minus
(My_Jan
) /= (System
.Max_Int
- 3) or
148 TC_Compare_Minus
(My_Feb
) /= (System
.Max_Int
- 2) or
149 TC_Compare_Minus
(My_Mar
) /= (System
.Max_Int
- 1) or
150 TC_Compare_Minus
(My_Apr
) /= (System
.Max_Int
)
153 ("Expected enumeration size of System.Max_Int, System.Max_Int - 1 " &
154 "through System.Max_Int - 3 not available for this implementation");
160 --==================================================================--
167 begin -- Main test procedure.
169 Report
.Test
("CD40001", "Check that Enumeration_Representation_Clauses " &
170 "are supported for codes in the range " &
171 "System.Min_Int..System.Max_Int" );
173 CD40001_0
.TC_Check_Press
;
175 CD40001_0
.TC_Check_Add
;
177 CD40001_0
.TC_Check_Minus
;