-- CA11B01.A
|
-- CA11B01.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- unlimited rights in the software and documentation contained herein.
|
-- unlimited rights in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- released technical data and computer software in whole or in part, in
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- OBJECTIVE:
|
-- OBJECTIVE:
|
-- Check that a type derived in a public child inherits primitive
|
-- Check that a type derived in a public child inherits primitive
|
-- operations from parent.
|
-- operations from parent.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- Declare a root record type with discriminant in a package
|
-- Declare a root record type with discriminant in a package
|
-- specification. Declare a primitive subprogram for the type
|
-- specification. Declare a primitive subprogram for the type
|
-- (foundation code).
|
-- (foundation code).
|
--
|
--
|
-- Add a public child to the above package. Derive a new type
|
-- Add a public child to the above package. Derive a new type
|
-- with constraint to the discriminant record type from the parent
|
-- with constraint to the discriminant record type from the parent
|
-- package. Declare a new primitive subprogram to write to the child
|
-- package. Declare a new primitive subprogram to write to the child
|
-- derived type.
|
-- derived type.
|
--
|
--
|
-- Add a new public child to the above package. This grandchild package
|
-- Add a new public child to the above package. This grandchild package
|
-- derives a new type using the record type from the above package.
|
-- derives a new type using the record type from the above package.
|
-- Declare a new primitive subprogram to write to the grandchild derived
|
-- Declare a new primitive subprogram to write to the grandchild derived
|
-- type.
|
-- type.
|
--
|
--
|
-- In the main program, "with" the grandchild. Access the inherited
|
-- In the main program, "with" the grandchild. Access the inherited
|
-- operations from grandparent, parent, and grandchild packages.
|
-- operations from grandparent, parent, and grandchild packages.
|
--
|
--
|
-- TEST FILES:
|
-- TEST FILES:
|
-- This test depends on the following foundation code:
|
-- This test depends on the following foundation code:
|
--
|
--
|
-- FA11B00.A
|
-- FA11B00.A
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 06 Dec 94 SAIC ACVC 2.0
|
--
|
--
|
--!
|
--!
|
|
|
-- Child package of FA11B00.
|
-- Child package of FA11B00.
|
package FA11B00.CA11B01_0 is -- Application_Two_Widget
|
package FA11B00.CA11B01_0 is -- Application_Two_Widget
|
-- This public child declares a derived type from its parent. It
|
-- This public child declares a derived type from its parent. It
|
-- represents processing of widgets in a window system.
|
-- represents processing of widgets in a window system.
|
|
|
type App2_Widget is new App1_Widget (Maximum_Size => 5000);
|
type App2_Widget is new App1_Widget (Maximum_Size => 5000);
|
-- Inherits procedure Create_Widget from parent.
|
-- Inherits procedure Create_Widget from parent.
|
|
|
-- Primitive operation of type App2_Widget.
|
-- Primitive operation of type App2_Widget.
|
-- To be inherited by its children derivatives.
|
-- To be inherited by its children derivatives.
|
procedure App2_Widget_Specific_Oper (The_Widget : in out App2_Widget;
|
procedure App2_Widget_Specific_Oper (The_Widget : in out App2_Widget;
|
Loc : in Widget_Location);
|
Loc : in Widget_Location);
|
|
|
end FA11B00.CA11B01_0; -- Application_Two_Widget
|
end FA11B00.CA11B01_0; -- Application_Two_Widget
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
package body FA11B00.CA11B01_0 is -- Application_Two_Widget
|
package body FA11B00.CA11B01_0 is -- Application_Two_Widget
|
|
|
procedure App2_Widget_Specific_Oper
|
procedure App2_Widget_Specific_Oper
|
(The_Widget : in out App2_Widget;
|
(The_Widget : in out App2_Widget;
|
Loc : in Widget_Location) is
|
Loc : in Widget_Location) is
|
begin
|
begin
|
The_Widget.Location := Loc;
|
The_Widget.Location := Loc;
|
end App2_Widget_Specific_Oper;
|
end App2_Widget_Specific_Oper;
|
|
|
end FA11B00.CA11B01_0; -- Application_Two_Widget
|
end FA11B00.CA11B01_0; -- Application_Two_Widget
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
-- Grandchild package of FA11B00, child package of FA11B00.CA11B01_0.
|
-- Grandchild package of FA11B00, child package of FA11B00.CA11B01_0.
|
package FA11B00.CA11B01_0.CA11B01_1 is -- Application_Three_Widget
|
package FA11B00.CA11B01_0.CA11B01_1 is -- Application_Three_Widget
|
-- This public grandchild declares a derived type from its parent. It
|
-- This public grandchild declares a derived type from its parent. It
|
-- represents processing of widgets in a window system.
|
-- represents processing of widgets in a window system.
|
|
|
type App3_Widget is new App2_Widget; -- Derived record of App2_Widget.
|
type App3_Widget is new App2_Widget; -- Derived record of App2_Widget.
|
|
|
-- Inherits (inherited) procedure Create_Widget from Application_One_Widget.
|
-- Inherits (inherited) procedure Create_Widget from Application_One_Widget.
|
-- Inherits procedure App2_Widget_Specific_Oper from App2_Widget.
|
-- Inherits procedure App2_Widget_Specific_Oper from App2_Widget.
|
|
|
-- Primitive operation of type App3_Widget.
|
-- Primitive operation of type App3_Widget.
|
procedure App3_Widget_Specific_Oper (The_Widget : in out App3_Widget;
|
procedure App3_Widget_Specific_Oper (The_Widget : in out App3_Widget;
|
S : in Widget_Size);
|
S : in Widget_Size);
|
|
|
end FA11B00.CA11B01_0.CA11B01_1; -- Application_Three_Widget
|
end FA11B00.CA11B01_0.CA11B01_1; -- Application_Three_Widget
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
package body FA11B00.CA11B01_0.CA11B01_1 is -- Application_Three_Widget
|
package body FA11B00.CA11B01_0.CA11B01_1 is -- Application_Three_Widget
|
|
|
procedure App3_Widget_Specific_Oper
|
procedure App3_Widget_Specific_Oper
|
(The_Widget : in out App3_Widget;
|
(The_Widget : in out App3_Widget;
|
S : in Widget_Size) is
|
S : in Widget_Size) is
|
begin
|
begin
|
The_Widget.Size := S;
|
The_Widget.Size := S;
|
end App3_Widget_Specific_Oper;
|
end App3_Widget_Specific_Oper;
|
|
|
end FA11B00.CA11B01_0.CA11B01_1; -- Application_Three_Widget
|
end FA11B00.CA11B01_0.CA11B01_1; -- Application_Three_Widget
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
with FA11B00.CA11B01_0.CA11B01_1; -- Application_Three_Widget,
|
with FA11B00.CA11B01_0.CA11B01_1; -- Application_Three_Widget,
|
-- implicitly with Application_Two_Widget,
|
-- implicitly with Application_Two_Widget,
|
-- implicitly with Application_Three_Widget.
|
-- implicitly with Application_Three_Widget.
|
with Report;
|
with Report;
|
|
|
procedure CA11B01 is
|
procedure CA11B01 is
|
|
|
package Application_One_Widget renames FA11B00;
|
package Application_One_Widget renames FA11B00;
|
package Application_Two_Widget renames FA11B00.CA11B01_0;
|
package Application_Two_Widget renames FA11B00.CA11B01_0;
|
package Application_Three_Widget renames FA11B00.CA11B01_0.CA11B01_1;
|
package Application_Three_Widget renames FA11B00.CA11B01_0.CA11B01_1;
|
|
|
use Application_One_Widget;
|
use Application_One_Widget;
|
use Application_Two_Widget;
|
use Application_Two_Widget;
|
use Application_Three_Widget;
|
use Application_Three_Widget;
|
|
|
begin
|
begin
|
|
|
Report.Test ("CA11B01", "Check that a type derived in a public " &
|
Report.Test ("CA11B01", "Check that a type derived in a public " &
|
"child inherits primitive operations from parent");
|
"child inherits primitive operations from parent");
|
|
|
Application_One_Subtest:
|
Application_One_Subtest:
|
declare
|
declare
|
White_Widget : App1_Widget;
|
White_Widget : App1_Widget;
|
|
|
begin
|
begin
|
-- perform an App1_Widget specific operation.
|
-- perform an App1_Widget specific operation.
|
App1_Widget_Specific_Oper (C => White, L => "Line Editor ",
|
App1_Widget_Specific_Oper (C => White, L => "Line Editor ",
|
The_Widget => White_Widget, I => 10);
|
The_Widget => White_Widget, I => 10);
|
|
|
If White_Widget.Color /= White or
|
If White_Widget.Color /= White or
|
White_Widget.Id /= Widget_ID
|
White_Widget.Id /= Widget_ID
|
(Report.Ident_Int (10)) or
|
(Report.Ident_Int (10)) or
|
White_Widget.Label /= "Line Editor " then
|
White_Widget.Label /= "Line Editor " then
|
Report.Failed ("Incorrect result for White_Widget");
|
Report.Failed ("Incorrect result for White_Widget");
|
end if;
|
end if;
|
|
|
end Application_One_Subtest;
|
end Application_One_Subtest;
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
Application_Two_Subtest:
|
Application_Two_Subtest:
|
declare
|
declare
|
Amber_Widget : App2_Widget;
|
Amber_Widget : App2_Widget;
|
|
|
begin
|
begin
|
App1_Widget_Specific_Oper (Amber_Widget, I => 11,
|
App1_Widget_Specific_Oper (Amber_Widget, I => 11,
|
C => Amber, L => "Alarm_Clock ");
|
C => Amber, L => "Alarm_Clock ");
|
-- Inherited from Application_One_Widget.
|
-- Inherited from Application_One_Widget.
|
|
|
-- perform an App2_Widget specific operation.
|
-- perform an App2_Widget specific operation.
|
App2_Widget_Specific_Oper (The_Widget => Amber_Widget, Loc => (380,512));
|
App2_Widget_Specific_Oper (The_Widget => Amber_Widget, Loc => (380,512));
|
|
|
If Amber_Widget.Color /= Amber or
|
If Amber_Widget.Color /= Amber or
|
Amber_Widget.Id /= Widget_ID (Report.Ident_Int (11)) or
|
Amber_Widget.Id /= Widget_ID (Report.Ident_Int (11)) or
|
Amber_Widget.Label /= "Alarm_Clock " or
|
Amber_Widget.Label /= "Alarm_Clock " or
|
Amber_Widget.Location /= (380,512) then
|
Amber_Widget.Location /= (380,512) then
|
Report.Failed ("Incorrect result for Amber_Widget");
|
Report.Failed ("Incorrect result for Amber_Widget");
|
end if;
|
end if;
|
|
|
end Application_Two_Subtest;
|
end Application_Two_Subtest;
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
Application_Three_Subtest:
|
Application_Three_Subtest:
|
declare
|
declare
|
Green_Widget : App3_Widget;
|
Green_Widget : App3_Widget;
|
|
|
begin
|
begin
|
App1_Widget_Specific_Oper (Green_Widget, 100, Green,
|
App1_Widget_Specific_Oper (Green_Widget, 100, Green,
|
"Screen Editor ");
|
"Screen Editor ");
|
-- Inherited (inherited) from Basic_Widget.
|
-- Inherited (inherited) from Basic_Widget.
|
|
|
-- perform an App2_Widget specific operation.
|
-- perform an App2_Widget specific operation.
|
App2_Widget_Specific_Oper (Loc => (1024,760),
|
App2_Widget_Specific_Oper (Loc => (1024,760),
|
The_Widget => Green_Widget);
|
The_Widget => Green_Widget);
|
-- Inherited from App_1_Widget.
|
-- Inherited from App_1_Widget.
|
|
|
-- perform an App3_Widget specific operation.
|
-- perform an App3_Widget specific operation.
|
App3_Widget_Specific_Oper (Green_Widget, S => (100,100));
|
App3_Widget_Specific_Oper (Green_Widget, S => (100,100));
|
|
|
If Green_Widget.Color /= Green or
|
If Green_Widget.Color /= Green or
|
Green_Widget.Id /= Widget_ID (Report.Ident_Int (100)) or
|
Green_Widget.Id /= Widget_ID (Report.Ident_Int (100)) or
|
Green_Widget.Label /= "Screen Editor " or
|
Green_Widget.Label /= "Screen Editor " or
|
Green_Widget.Location /= (1024,760) or
|
Green_Widget.Location /= (1024,760) or
|
Green_Widget.Size /= (100,100) then
|
Green_Widget.Size /= (100,100) then
|
Report.Failed ("Incorrect result for Green_Widget");
|
Report.Failed ("Incorrect result for Green_Widget");
|
end if;
|
end if;
|
|
|
end Application_Three_Subtest;
|
end Application_Three_Subtest;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end CA11B01;
|
end CA11B01;
|
|
|