annotate gcc/testsuite/ada/acats/tests/c3/c390a022.am @ 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 -- C390A022.AM
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 a nonprivate tagged type declared in a package specification
kono
parents:
diff changeset
28 -- may be extended with a record extension in a different package
kono
parents:
diff changeset
29 -- specification, and that this record extension may in turn be extended
kono
parents:
diff changeset
30 -- by a private extension in a third package.
kono
parents:
diff changeset
31 --
kono
parents:
diff changeset
32 -- Check that each derivative inherits the user-defined primitive
kono
parents:
diff changeset
33 -- subprograms of its parent (including those that its parent inherited),
kono
parents:
diff changeset
34 -- that it may override these inherited primitive subprograms, and that it
kono
parents:
diff changeset
35 -- may also declare its own primitive subprograms.
kono
parents:
diff changeset
36 --
kono
parents:
diff changeset
37 -- Check that predefined equality operators are defined for the tagged
kono
parents:
diff changeset
38 -- type and its derivatives.
kono
parents:
diff changeset
39 --
kono
parents:
diff changeset
40 -- Check that type conversion is defined from a type extension to its
kono
parents:
diff changeset
41 -- parent, and that this parent itself may be a type extension.
kono
parents:
diff changeset
42 --
kono
parents:
diff changeset
43 -- TEST DESCRIPTION:
kono
parents:
diff changeset
44 -- Declare a root tagged type and two associated primitive subprograms
kono
parents:
diff changeset
45 -- in a package specification (foundation code).
kono
parents:
diff changeset
46 --
kono
parents:
diff changeset
47 -- Extend the root type with a record extension in a different package
kono
parents:
diff changeset
48 -- specification. Declare a new primitive subprogram for the extension,
kono
parents:
diff changeset
49 -- and override one of the two inherited subprograms. Within the
kono
parents:
diff changeset
50 -- overriding subprogram, utilize type conversion to call the parent's
kono
parents:
diff changeset
51 -- implementation of the same subprogram. Also within the overriding
kono
parents:
diff changeset
52 -- subprogram, call the new primitive subprogram and each inherited
kono
parents:
diff changeset
53 -- subprogram.
kono
parents:
diff changeset
54 --
kono
parents:
diff changeset
55 -- Extend the extension with a private extension in a third package
kono
parents:
diff changeset
56 -- specification. Declare a new primitive subprogram for this private
kono
parents:
diff changeset
57 -- extension, and override one of the three inherited subprograms.
kono
parents:
diff changeset
58 -- Within the overriding subprogram, utilize type conversion to call the
kono
parents:
diff changeset
59 -- parent's implementation of the same subprogram. Also within the
kono
parents:
diff changeset
60 -- overriding subprogram, call the new primitive subprogram and each
kono
parents:
diff changeset
61 -- inherited subprogram.
kono
parents:
diff changeset
62 --
kono
parents:
diff changeset
63 -- Also in the third package, declare two operations of the private
kono
parents:
diff changeset
64 -- extension which utilize aggregates and equality operators to verify
kono
parents:
diff changeset
65 -- the correctness of the components.
kono
parents:
diff changeset
66 --
kono
parents:
diff changeset
67 -- In the main program, declare objects of the two extended types.
kono
parents:
diff changeset
68 -- For each object, call the overriding subprogram, and verify the
kono
parents:
diff changeset
69 -- correctness of the components by using aggregates and equality
kono
parents:
diff changeset
70 -- operators, or by checking the components directly, or, for the private
kono
parents:
diff changeset
71 -- extension, by calling the verification operations declared in the
kono
parents:
diff changeset
72 -- third package.
kono
parents:
diff changeset
73 --
kono
parents:
diff changeset
74 -- TEST FILES:
kono
parents:
diff changeset
75 -- This test consists of the following files:
kono
parents:
diff changeset
76 --
kono
parents:
diff changeset
77 -- F390A00.A
kono
parents:
diff changeset
78 -- C390A020.A
kono
parents:
diff changeset
79 -- C390A021.A
kono
parents:
diff changeset
80 -- => C390A022.AM
kono
parents:
diff changeset
81 --
kono
parents:
diff changeset
82 --
kono
parents:
diff changeset
83 -- CHANGE HISTORY:
kono
parents:
diff changeset
84 -- 06 Dec 94 SAIC ACVC 2.0
kono
parents:
diff changeset
85 -- 04 Jun 96 SAIC ACVC 2.1: Modified prologue.
kono
parents:
diff changeset
86 --
kono
parents:
diff changeset
87 --!
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 with Report;
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 with F390A00; -- Basic alert abstraction.
kono
parents:
diff changeset
92 with C390A020; -- Extended alert abstraction.
kono
parents:
diff changeset
93 with C390A021; -- Further extended alert abstraction.
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 use F390A00; -- Primitive operations of Alert_Type directly visible.
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 with Ada.Calendar;
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 procedure C390A022 is
kono
parents:
diff changeset
100 use type Ada.Calendar.Time; -- Equality/inequality ops directly visible.
kono
parents:
diff changeset
101 begin
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 Report.Test ("C390A02", "Primitive operation inheritance by type " &
kono
parents:
diff changeset
104 "extensions: all extensions declared in different " &
kono
parents:
diff changeset
105 "packages; second extension is private");
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 -- The case for type F390A00.Alert_Type is tested in C390A01.
kono
parents:
diff changeset
109 -- That subtest is not repeated here.
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 LOW_ALERT_SUBTEST: ---------------------------------------------------------
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 declare
kono
parents:
diff changeset
115 Low_Alarm : C390A020.Low_Alert_Type; -- Extension of tagged type.
kono
parents:
diff changeset
116 use C390A020; -- Primitive operations of extension directly visible.
kono
parents:
diff changeset
117 begin
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 -- Check "=" operator availability. Aggregate with positional
kono
parents:
diff changeset
120 -- associations:
kono
parents:
diff changeset
121 if not (Low_Alarm = (Default_Time, Null_Device, 0)) then
kono
parents:
diff changeset
122 Report.Failed ("Wrong initial values for Low_Alert_Type");
kono
parents:
diff changeset
123 end if;
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 Handle (Low_Alarm);
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 -- Check component availability:
kono
parents:
diff changeset
128 if Low_Alarm.Arrival_Time /= Alert_Time or
kono
parents:
diff changeset
129 Low_Alarm.Display_On /= Teletype or
kono
parents:
diff changeset
130 Low_Alarm.Level /= 1
kono
parents:
diff changeset
131 then
kono
parents:
diff changeset
132 Report.Failed ("Wrong values for Low_Alert_Type after Handle");
kono
parents:
diff changeset
133 end if;
kono
parents:
diff changeset
134 end Low_Alert_Subtest;
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 -- Check intermediate display counts:
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 if F390A00.Display_Count_For /= (Null_Device => 1,
kono
parents:
diff changeset
140 Teletype => 1,
kono
parents:
diff changeset
141 Console => 0,
kono
parents:
diff changeset
142 Big_Screen => 0)
kono
parents:
diff changeset
143 then
kono
parents:
diff changeset
144 Report.Failed ("Wrong display counts after Low_Alert_Type");
kono
parents:
diff changeset
145 end if;
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 MEDIUM_ALERT_SUBTEST: ------------------------------------------------------
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 declare
kono
parents:
diff changeset
151 Medium_Alarm : C390A021.Medium_Alert_Type; -- Priv. ext. of extension.
kono
parents:
diff changeset
152 use C390A021; -- Primitive operations of extension directly visible.
kono
parents:
diff changeset
153 begin
kono
parents:
diff changeset
154 if not C390A021.Initial_Values_Okay (Medium_Alarm) then
kono
parents:
diff changeset
155 Report.Failed ("Wrong initial values for Medium_Alert_Type");
kono
parents:
diff changeset
156 end if;
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 Handle (Medium_Alarm);
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 if C390A021.Bad_Final_Values (Medium_Alarm) then
kono
parents:
diff changeset
161 Report.Failed ("Wrong values for Medium_Alert_Type after Handle");
kono
parents:
diff changeset
162 end if;
kono
parents:
diff changeset
163 end Medium_Alert_Subtest;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 -- Check final display counts:
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 if F390A00.Display_Count_For /= (Null_Device => 2,
kono
parents:
diff changeset
169 Teletype => 2,
kono
parents:
diff changeset
170 Console => 1,
kono
parents:
diff changeset
171 Big_Screen => 0)
kono
parents:
diff changeset
172 then
kono
parents:
diff changeset
173 Report.Failed ("Wrong display counts after Medium_Alert_Type");
kono
parents:
diff changeset
174 end if;
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 Report.Result;
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 end C390A022;