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 for a nonabstract private extension, any inherited
28 -- abstract subprograms can be overridden in the private part of
29 -- the immediately enclosing package and that calls can be made to
30 -- private dispatching operations.
33 -- This test builds an additional layer upon the foundation code to
34 -- provide the required "hidden" dispatching operation. The procedure
35 -- Swap, a private subprogram, should be called by dispatch.
38 -- The following files comprise this test:
40 -- F393A00.A (foundation code)
45 -- 06 Dec 94 SAIC ACVC 2.0
51 type Grinder
is new F393A00_4
.Mill
with private;
52 type Coarseness
is (Whole_Bean
, Coarse
, Medium
, Fine
, Espresso
);
54 procedure Set_Grind
( It
: in out Grinder
; The_Grind
: Coarseness
);
55 function Grind
( It
: Grinder
) return Coarseness
;
57 function Create
return Grinder
;
59 procedure Swap
( A
,B
: in out Grinder
);
60 type Grinder
is new F393A00_4
.Mill
with
62 Grind
: Coarseness
:= Whole_Bean
;
67 package body C393A05_0
is
68 procedure Set_Grind
( It
: in out Grinder
; The_Grind
: Coarseness
) is
70 F393A00_0
.TC_Touch
( 'A' );
71 It
.Grind
:= The_Grind
;
74 function Grind
( It
: Grinder
) return Coarseness
is
76 F393A00_0
.TC_Touch
( 'B' );
80 procedure Swap
( A
,B
: in out Grinder
) is
81 T
: constant Grinder
:= A
;
83 F393A00_0
.TC_Touch
( 'C' );
88 function Create
return Grinder
is
91 F393A00_0
.TC_Touch
( 'D' );
92 F393A00_4
.Initialize
( F393A00_4
.Mill
( One
) );
103 package Tracer
renames F393A00_0
;
104 package Coffee
renames C393A05_0
;
105 use type Coffee
.Coarseness
;
107 Morning
: Coffee
.Grinder
;
108 Afternoon
: Coffee
.Grinder
;
110 Gritty
: Coffee
.Coarseness
;
112 procedure Class_Swap
( A
, B
: in out Coffee
.Grinder
'Class ) is
114 Coffee
.Swap
( A
, B
); -- dispatch
117 begin -- Main test procedure.
119 Report
.Test
("C393A05", "Check that nonabstract private extensions, "
120 & "inherited abstract subprograms overridden "
121 & "in the private part can be dispatched from "
122 & "outside the package" );
124 Tracer
.TC_Validate
( "hh", "Declarations" );
126 Morning
:= Coffee
.Create
;
127 Tracer
.TC_Validate
( "hDa", "Creating Morning Coffee" );
128 Gritty
:= Coffee
.Grind
( Morning
);
129 Tracer
.TC_Validate
( "B", "Finding Morning Grind" );
131 Afternoon
:= Coffee
.Create
;
132 Tracer
.TC_Validate
( "hDa", "Creating Afternoon Coffee" );
133 Coffee
.Set_Grind
( Afternoon
, Coffee
.Medium
);
134 Tracer
.TC_Validate
( "A", "Setting Afternoon Grind" );
136 Coffee
.Swap
( Morning
, Afternoon
);
137 Tracer
.TC_Validate
( "C", "Dispatching Swapping Coffees" );
139 if Gritty
/= Coffee
.Grind
( Afternoon
)
140 or Coffee
.Grind
( Afternoon
) /= Coffee
.Fine
then
141 Report
.Failed
("Result of Swap");
143 Tracer
.TC_Validate
( "BB", "Finding Afternoon Grind" );
146 Evening
: Coffee
.Grinder
'Class := Coffee
.Create
;
148 Tracer
.TC_Validate
( "hDa", "Creating Evening Coffee" );
150 Coffee
.Set_Grind
( Evening
, Coffee
.Espresso
);
151 Tracer
.TC_Validate
( "A", "Setting Evening Grind" );
153 Morning
:= Coffee
.Grinder
( Evening
);
154 Class_Swap
( Morning
, Evening
);
155 Tracer
.TC_Validate
( "C", "Swapping Coffees" );
156 if Coffee
.Grind
( Morning
) /= Coffee
.Espresso
then
157 Report
.Failed
("Result of Assignment");