annotate gcc/testsuite/ada/acats/tests/cd/cd40001.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- CD40001.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that Enumeration_Representation_Clauses are supported for
kono
parents:
diff changeset
28 -- codes in the range System.Min_Int..System.Max_Int.
kono
parents:
diff changeset
29 --
kono
parents:
diff changeset
30 -- TEST DESCRIPTION:
kono
parents:
diff changeset
31 -- This test defines several types, and checks that the range of the
kono
parents:
diff changeset
32 -- enumeration clause is as expected.
kono
parents:
diff changeset
33 --
kono
parents:
diff changeset
34 -- APPLICABILITY CRITERIA:
kono
parents:
diff changeset
35 -- All implementations must attempt to compile this test.
kono
parents:
diff changeset
36 --
kono
parents:
diff changeset
37 -- For implementations validating against Systems Programming Annex (C):
kono
parents:
diff changeset
38 -- this test must execute and report PASSED.
kono
parents:
diff changeset
39 --
kono
parents:
diff changeset
40 -- For implementations not validating against Annex C:
kono
parents:
diff changeset
41 -- this test may report compile time errors at one or more points
kono
parents:
diff changeset
42 -- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
kono
parents:
diff changeset
43 -- Otherwise, the test must execute and report PASSED.
kono
parents:
diff changeset
44 --
kono
parents:
diff changeset
45 --
kono
parents:
diff changeset
46 -- CHANGE HISTORY:
kono
parents:
diff changeset
47 -- 22 JUL 95 SAIC Initial version
kono
parents:
diff changeset
48 -- 07 MAY 96 SAIC Revised for 2.1
kono
parents:
diff changeset
49 -- 16 FEB 98 EDS Modified Documentation.
kono
parents:
diff changeset
50 --!
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 with System;
kono
parents:
diff changeset
53 with Ada.Unchecked_Conversion;
kono
parents:
diff changeset
54 package CD40001_0 is
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 type Press_The_Bounds is ( Negative_Large, Positive_Large );
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 for Press_The_Bounds use
kono
parents:
diff changeset
59 ( Negative_Large => System.Min_Int, -- ANX-C RQMT.
kono
parents:
diff changeset
60 Positive_Large => System.Max_Int ); -- ANX-C RQMT.
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 type Add_The_Bounds is
kono
parents:
diff changeset
63 ( Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 for Add_The_Bounds use
kono
parents:
diff changeset
66 ( Monday => System.Min_Int, -- ANX-C RQMT.
kono
parents:
diff changeset
67 Tuesday => System.Min_Int + 1, -- ANX-C RQMT.
kono
parents:
diff changeset
68 Wednesday => System.Min_Int + 2, -- ANX-C RQMT.
kono
parents:
diff changeset
69 Thursday => System.Min_Int + 3, -- ANX-C RQMT.
kono
parents:
diff changeset
70 Friday => System.Min_Int + 4, -- ANX-C RQMT.
kono
parents:
diff changeset
71 Saturday => System.Min_Int + 5 ); -- ANX-C RQMT.
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 type Minus_The_Bounds is ( Jan, Feb, Mar, Apr);
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 for Minus_The_Bounds use
kono
parents:
diff changeset
76 ( Apr => System.Max_Int, -- ANX-C RQMT.
kono
parents:
diff changeset
77 Mar => System.Max_Int - 1, -- ANX-C RQMT.
kono
parents:
diff changeset
78 Feb => System.Max_Int - 2, -- ANX-C RQMT.
kono
parents:
diff changeset
79 Jan => System.Max_Int - 3 ); -- ANX-C RQMT.
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 type TC_Integer is range System.Min_Int..System.Max_Int;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 procedure TC_Check_Press;
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 procedure TC_Check_Add;
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 procedure TC_Check_Minus;
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 function TC_Compare_Press is new Ada.Unchecked_Conversion
kono
parents:
diff changeset
90 (Press_The_Bounds, TC_Integer);
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 function TC_Compare_Add is new Ada.Unchecked_Conversion
kono
parents:
diff changeset
93 (Add_The_Bounds, TC_Integer);
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 function TC_Compare_Minus is new Ada.Unchecked_Conversion
kono
parents:
diff changeset
96 (Minus_The_Bounds, TC_Integer);
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 end CD40001_0;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 --==================================================================--
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 with Report;
kono
parents:
diff changeset
103 package body CD40001_0 is
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 procedure TC_Check_Press is
kono
parents:
diff changeset
106 My_Press_First : Press_The_Bounds := Negative_Large;
kono
parents:
diff changeset
107 My_Press_Last : Press_The_Bounds := Positive_Large;
kono
parents:
diff changeset
108 begin
kono
parents:
diff changeset
109 if TC_Compare_Press (My_Press_First) /= System.Min_Int or
kono
parents:
diff changeset
110 TC_Compare_Press (My_Press_Last) /= System.Max_Int
kono
parents:
diff changeset
111 then
kono
parents:
diff changeset
112 Report.Failed
kono
parents:
diff changeset
113 ("Expected enumeration size of System.Min_Int and System.Max_Int " &
kono
parents:
diff changeset
114 "not available for this implementation");
kono
parents:
diff changeset
115 end if;
kono
parents:
diff changeset
116 end TC_Check_Press;
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 ---------------------------------------------------------------------------
kono
parents:
diff changeset
119 procedure TC_Check_Add is
kono
parents:
diff changeset
120 My_Monday : Add_The_Bounds := Monday;
kono
parents:
diff changeset
121 My_Tuesday : Add_The_Bounds := Tuesday;
kono
parents:
diff changeset
122 My_Wednesday : Add_The_Bounds := Wednesday;
kono
parents:
diff changeset
123 My_Thursday : Add_The_Bounds := Thursday;
kono
parents:
diff changeset
124 My_Friday : Add_The_Bounds := Friday;
kono
parents:
diff changeset
125 My_Saturday : Add_The_Bounds := Saturday;
kono
parents:
diff changeset
126 begin
kono
parents:
diff changeset
127 if TC_Compare_Add (My_Monday) /= (System.Min_Int) or
kono
parents:
diff changeset
128 TC_Compare_Add (My_Thursday) /= (System.Min_Int + 3) or
kono
parents:
diff changeset
129 TC_Compare_Add (My_Wednesday) /= (System.Min_Int + 2) or
kono
parents:
diff changeset
130 TC_Compare_Add (My_Tuesday) /= (System.Min_Int + 1) or
kono
parents:
diff changeset
131 TC_Compare_Add (My_Saturday) /= (System.Min_Int + 5) or
kono
parents:
diff changeset
132 TC_Compare_Add (My_Friday) /= (System.Min_Int + 4)
kono
parents:
diff changeset
133 then
kono
parents:
diff changeset
134 Report.Failed
kono
parents:
diff changeset
135 ("Expected enumeration size of System.Min_Int, System.Min_Int + 1 " &
kono
parents:
diff changeset
136 "through System.Min_Int + 5 not available for this implementation");
kono
parents:
diff changeset
137 end if;
kono
parents:
diff changeset
138 end TC_Check_Add;
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 ---------------------------------------------------------------------------
kono
parents:
diff changeset
141 procedure TC_Check_Minus is
kono
parents:
diff changeset
142 My_Jan : Minus_The_Bounds := Jan;
kono
parents:
diff changeset
143 My_Feb : Minus_The_Bounds := Feb;
kono
parents:
diff changeset
144 My_Mar : Minus_The_Bounds := Mar;
kono
parents:
diff changeset
145 My_Apr : Minus_The_Bounds := Apr;
kono
parents:
diff changeset
146 begin
kono
parents:
diff changeset
147 if TC_Compare_Minus (My_Jan) /= (System.Max_Int - 3) or
kono
parents:
diff changeset
148 TC_Compare_Minus (My_Feb) /= (System.Max_Int - 2) or
kono
parents:
diff changeset
149 TC_Compare_Minus (My_Mar) /= (System.Max_Int - 1) or
kono
parents:
diff changeset
150 TC_Compare_Minus (My_Apr) /= (System.Max_Int)
kono
parents:
diff changeset
151 then
kono
parents:
diff changeset
152 Report.Failed
kono
parents:
diff changeset
153 ("Expected enumeration size of System.Max_Int, System.Max_Int - 1 " &
kono
parents:
diff changeset
154 "through System.Max_Int - 3 not available for this implementation");
kono
parents:
diff changeset
155 end if;
kono
parents:
diff changeset
156 end TC_Check_Minus;
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 end CD40001_0;
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 --==================================================================--
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 with Report;
kono
parents:
diff changeset
163 with CD40001_0;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 procedure CD40001 is
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 begin -- Main test procedure.
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 Report.Test ("CD40001", "Check that Enumeration_Representation_Clauses " &
kono
parents:
diff changeset
170 "are supported for codes in the range " &
kono
parents:
diff changeset
171 "System.Min_Int..System.Max_Int" );
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 CD40001_0.TC_Check_Press;
kono
parents:
diff changeset
174
kono
parents:
diff changeset
175 CD40001_0.TC_Check_Add;
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 CD40001_0.TC_Check_Minus;
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 Report.Result;
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 end CD40001;