-- C432004.A
|
-- C432004.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 the type of an extension aggregate may be derived from the
|
-- Check that the type of an extension aggregate may be derived from the
|
-- type of the ancestor part through multiple record extensions. Check
|
-- type of the ancestor part through multiple record extensions. Check
|
-- for ancestor parts that are subtype marks. Check that the type of the
|
-- for ancestor parts that are subtype marks. Check that the type of the
|
-- ancestor part may be abstract.
|
-- ancestor part may be abstract.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- This test defines the following type hierarchies:
|
-- This test defines the following type hierarchies:
|
--
|
--
|
-- (A) (F)
|
-- (A) (F)
|
-- Abstract Abstract
|
-- Abstract Abstract
|
-- Tagged record Tagged private
|
-- Tagged record Tagged private
|
-- / \ / \
|
-- / \ / \
|
-- / (C) (G) \
|
-- / (C) (G) \
|
-- (B) Abstract Abstract (H)
|
-- (B) Abstract Abstract (H)
|
-- Record private record Private
|
-- Record private record Private
|
-- extension extension extension extension
|
-- extension extension extension extension
|
-- | | | |
|
-- | | | |
|
-- (D) (E) (I) (J)
|
-- (D) (E) (I) (J)
|
-- Record Record Record Record
|
-- Record Record Record Record
|
-- extension extension extension extension
|
-- extension extension extension extension
|
--
|
--
|
-- Extension aggregates for B, D, E, I, and J are constructed using each
|
-- Extension aggregates for B, D, E, I, and J are constructed using each
|
-- of its ancestor types as the ancestor part (except for E and J, for
|
-- of its ancestor types as the ancestor part (except for E and J, for
|
-- which only the immediate ancestor is used, since using A and F,
|
-- which only the immediate ancestor is used, since using A and F,
|
-- respectively, as the ancestor part would be illegal).
|
-- respectively, as the ancestor part would be illegal).
|
--
|
--
|
-- X1 : B := (A with ...);
|
-- X1 : B := (A with ...);
|
-- X2 : D := (A with ...); X5 : I := (F with ...);
|
-- X2 : D := (A with ...); X5 : I := (F with ...);
|
-- X3 : D := (B with ...); X6 : I := (G with ...);
|
-- X3 : D := (B with ...); X6 : I := (G with ...);
|
-- X4 : E := (C with ...); X7 : J := (H with ...);
|
-- X4 : E := (C with ...); X7 : J := (H with ...);
|
--
|
--
|
-- For each assignment of an aggregate, the value of the target object is
|
-- For each assignment of an aggregate, the value of the target object is
|
-- checked to ensure that the proper values for each component were
|
-- checked to ensure that the proper values for each component were
|
-- assigned.
|
-- assigned.
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 06 Dec 94 SAIC ACVC 2.0
|
--
|
--
|
--!
|
--!
|
|
|
package C432004_0 is
|
package C432004_0 is
|
|
|
type Drawers is record
|
type Drawers is record
|
Building : natural;
|
Building : natural;
|
end record;
|
end record;
|
|
|
type Location is access Drawers;
|
type Location is access Drawers;
|
|
|
type Eras is (Precambrian, Paleozoic, Mesozoic, Cenozoic);
|
type Eras is (Precambrian, Paleozoic, Mesozoic, Cenozoic);
|
|
|
type SampleType_A is abstract tagged record
|
type SampleType_A is abstract tagged record
|
Era : Eras := Cenozoic;
|
Era : Eras := Cenozoic;
|
Loc : Location;
|
Loc : Location;
|
end record;
|
end record;
|
|
|
type SampleType_F is abstract tagged private;
|
type SampleType_F is abstract tagged private;
|
|
|
-- The following function is needed to verify the values of the
|
-- The following function is needed to verify the values of the
|
-- private components.
|
-- private components.
|
function TC_Correct_Result (Rec : SampleType_F'Class;
|
function TC_Correct_Result (Rec : SampleType_F'Class;
|
E : Eras) return Boolean;
|
E : Eras) return Boolean;
|
|
|
private
|
private
|
type SampleType_F is abstract tagged record
|
type SampleType_F is abstract tagged record
|
Era : Eras := Mesozoic;
|
Era : Eras := Mesozoic;
|
end record;
|
end record;
|
|
|
end C432004_0;
|
end C432004_0;
|
|
|
--==================================================================--
|
--==================================================================--
|
|
|
package body C432004_0 is
|
package body C432004_0 is
|
|
|
function TC_Correct_Result (Rec : SampleType_F'Class;
|
function TC_Correct_Result (Rec : SampleType_F'Class;
|
E : Eras) return Boolean is
|
E : Eras) return Boolean is
|
begin
|
begin
|
return (Rec.Era = E);
|
return (Rec.Era = E);
|
end TC_Correct_Result;
|
end TC_Correct_Result;
|
|
|
end C432004_0;
|
end C432004_0;
|
|
|
--==================================================================--
|
--==================================================================--
|
|
|
with C432004_0;
|
with C432004_0;
|
package C432004_1 is
|
package C432004_1 is
|
|
|
type Periods is
|
type Periods is
|
(Aphebian, Helikian, Hadrynian,
|
(Aphebian, Helikian, Hadrynian,
|
Cambrian, Ordovician, Silurian, Devonian, Carboniferous, Permian,
|
Cambrian, Ordovician, Silurian, Devonian, Carboniferous, Permian,
|
Triassic, Jurassic, Cretaceous,
|
Triassic, Jurassic, Cretaceous,
|
Tertiary, Quaternary);
|
Tertiary, Quaternary);
|
|
|
type SampleType_B is new C432004_0.SampleType_A with record
|
type SampleType_B is new C432004_0.SampleType_A with record
|
Period : Periods := Quaternary;
|
Period : Periods := Quaternary;
|
end record;
|
end record;
|
|
|
type SampleType_C is abstract new C432004_0.SampleType_A with private;
|
type SampleType_C is abstract new C432004_0.SampleType_A with private;
|
|
|
-- The following function is needed to verify the values of the
|
-- The following function is needed to verify the values of the
|
-- extension's private components.
|
-- extension's private components.
|
function TC_Correct_Result (Rec : SampleType_C'Class;
|
function TC_Correct_Result (Rec : SampleType_C'Class;
|
P : Periods) return Boolean;
|
P : Periods) return Boolean;
|
|
|
type SampleType_G is abstract new C432004_0.SampleType_F with record
|
type SampleType_G is abstract new C432004_0.SampleType_F with record
|
Period : Periods := Jurassic;
|
Period : Periods := Jurassic;
|
Loc : C432004_0.Location;
|
Loc : C432004_0.Location;
|
end record;
|
end record;
|
|
|
type SampleType_H is new C432004_0.SampleType_F with private;
|
type SampleType_H is new C432004_0.SampleType_F with private;
|
|
|
-- The following function is needed to verify the values of the
|
-- The following function is needed to verify the values of the
|
-- extension's private components.
|
-- extension's private components.
|
function TC_Correct_Result (Rec : SampleType_H'Class;
|
function TC_Correct_Result (Rec : SampleType_H'Class;
|
P : Periods;
|
P : Periods;
|
E : C432004_0.Eras) return Boolean;
|
E : C432004_0.Eras) return Boolean;
|
|
|
private
|
private
|
type SampleType_C is abstract new C432004_0.SampleType_A with record
|
type SampleType_C is abstract new C432004_0.SampleType_A with record
|
Period : Periods := Quaternary;
|
Period : Periods := Quaternary;
|
end record;
|
end record;
|
|
|
type SampleType_H is new C432004_0.SampleType_F with record
|
type SampleType_H is new C432004_0.SampleType_F with record
|
Period : Periods := Jurassic;
|
Period : Periods := Jurassic;
|
end record;
|
end record;
|
|
|
end C432004_1;
|
end C432004_1;
|
|
|
--==================================================================--
|
--==================================================================--
|
|
|
package body C432004_1 is
|
package body C432004_1 is
|
|
|
function TC_Correct_Result (Rec : SampleType_C'Class;
|
function TC_Correct_Result (Rec : SampleType_C'Class;
|
P : Periods) return Boolean is
|
P : Periods) return Boolean is
|
begin
|
begin
|
return (Rec.Period = P);
|
return (Rec.Period = P);
|
end TC_Correct_Result;
|
end TC_Correct_Result;
|
|
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
function TC_Correct_Result (Rec : SampleType_H'Class;
|
function TC_Correct_Result (Rec : SampleType_H'Class;
|
P : Periods;
|
P : Periods;
|
E : C432004_0.Eras) return Boolean is
|
E : C432004_0.Eras) return Boolean is
|
begin
|
begin
|
return (Rec.Period = P) and C432004_0.TC_Correct_Result (Rec, E);
|
return (Rec.Period = P) and C432004_0.TC_Correct_Result (Rec, E);
|
end TC_Correct_Result;
|
end TC_Correct_Result;
|
|
|
end C432004_1;
|
end C432004_1;
|
|
|
--==================================================================--
|
--==================================================================--
|
|
|
with C432004_0;
|
with C432004_0;
|
with C432004_1;
|
with C432004_1;
|
package C432004_2 is
|
package C432004_2 is
|
|
|
-- All types herein are record extensions, since aggregates
|
-- All types herein are record extensions, since aggregates
|
-- cannot be given for private extensions
|
-- cannot be given for private extensions
|
|
|
type SampleType_D is new C432004_1.SampleType_B with record
|
type SampleType_D is new C432004_1.SampleType_B with record
|
Sample_On_Loan : Boolean := False;
|
Sample_On_Loan : Boolean := False;
|
end record;
|
end record;
|
|
|
type SampleType_E is new C432004_1.SampleType_C
|
type SampleType_E is new C432004_1.SampleType_C
|
with null record;
|
with null record;
|
|
|
type SampleType_I is new C432004_1.SampleType_G with record
|
type SampleType_I is new C432004_1.SampleType_G with record
|
Sample_On_Loan : Boolean := True;
|
Sample_On_Loan : Boolean := True;
|
end record;
|
end record;
|
|
|
type SampleType_J is new C432004_1.SampleType_H with record
|
type SampleType_J is new C432004_1.SampleType_H with record
|
Sample_On_Loan : Boolean := True;
|
Sample_On_Loan : Boolean := True;
|
end record;
|
end record;
|
|
|
end C432004_2;
|
end C432004_2;
|
|
|
|
|
--==================================================================--
|
--==================================================================--
|
|
|
with Report;
|
with Report;
|
with C432004_0;
|
with C432004_0;
|
with C432004_1;
|
with C432004_1;
|
with C432004_2;
|
with C432004_2;
|
use C432004_1;
|
use C432004_1;
|
use C432004_2;
|
use C432004_2;
|
|
|
procedure C432004 is
|
procedure C432004 is
|
|
|
-- Variety of extension aggregates.
|
-- Variety of extension aggregates.
|
|
|
-- Default values for the components of SampleType_A
|
-- Default values for the components of SampleType_A
|
-- (Era => Cenozoic, Loc => null).
|
-- (Era => Cenozoic, Loc => null).
|
Sample_B : SampleType_B
|
Sample_B : SampleType_B
|
:= (C432004_0.SampleType_A with Period => Devonian);
|
:= (C432004_0.SampleType_A with Period => Devonian);
|
|
|
-- Default values from SampleType_A (Era => Cenozoic, Loc => null).
|
-- Default values from SampleType_A (Era => Cenozoic, Loc => null).
|
Sample_D1 : SampleType_D
|
Sample_D1 : SampleType_D
|
:= (C432004_0.SampleType_A with Period => Cambrian,
|
:= (C432004_0.SampleType_A with Period => Cambrian,
|
Sample_On_Loan => True);
|
Sample_On_Loan => True);
|
|
|
-- Default values from SampleType_A and SampleType_B
|
-- Default values from SampleType_A and SampleType_B
|
-- (Era => Cenozoic, Loc => null, Period => Quaternary).
|
-- (Era => Cenozoic, Loc => null, Period => Quaternary).
|
Sample_D2 : SampleType_D
|
Sample_D2 : SampleType_D
|
:= (SampleType_B with Sample_On_Loan => True);
|
:= (SampleType_B with Sample_On_Loan => True);
|
|
|
-- Default values from SampleType_A and SampleType_C
|
-- Default values from SampleType_A and SampleType_C
|
-- (Era => Cenozoic, Loc => null, Period => Quaternary).
|
-- (Era => Cenozoic, Loc => null, Period => Quaternary).
|
Sample_E : SampleType_E
|
Sample_E : SampleType_E
|
:= (SampleType_C with null record);
|
:= (SampleType_C with null record);
|
|
|
-- Default value from SampleType_F (Era => Mesozoic).
|
-- Default value from SampleType_F (Era => Mesozoic).
|
Sample_I1 : SampleType_I
|
Sample_I1 : SampleType_I
|
:= (C432004_0.SampleType_F with Period => Tertiary,
|
:= (C432004_0.SampleType_F with Period => Tertiary,
|
Loc => new C432004_0.Drawers'(Building => 9),
|
Loc => new C432004_0.Drawers'(Building => 9),
|
Sample_On_Loan => False);
|
Sample_On_Loan => False);
|
|
|
-- Default values from SampleType_F and SampleType_G
|
-- Default values from SampleType_F and SampleType_G
|
-- (Era => Mesozoic, Period => Jurassic, Loc => null).
|
-- (Era => Mesozoic, Period => Jurassic, Loc => null).
|
Sample_I2 : SampleType_I
|
Sample_I2 : SampleType_I
|
:= (SampleType_G with Sample_On_Loan => False);
|
:= (SampleType_G with Sample_On_Loan => False);
|
|
|
-- Default values from SampleType_H (Era => Mesozoic, Period => Jurassic).
|
-- Default values from SampleType_H (Era => Mesozoic, Period => Jurassic).
|
Sample_J : SampleType_J
|
Sample_J : SampleType_J
|
:= (SampleType_H with Sample_On_Loan => False);
|
:= (SampleType_H with Sample_On_Loan => False);
|
|
|
use type C432004_0.Eras;
|
use type C432004_0.Eras;
|
use type C432004_0.Location;
|
use type C432004_0.Location;
|
|
|
begin
|
begin
|
|
|
Report.Test ("C432004", "Check that the type of an extension aggregate " &
|
Report.Test ("C432004", "Check that the type of an extension aggregate " &
|
"may be derived from the type of the ancestor part through " &
|
"may be derived from the type of the ancestor part through " &
|
"multiple record extensions");
|
"multiple record extensions");
|
|
|
if Sample_B /= (C432004_0.Cenozoic, null, Devonian) then
|
if Sample_B /= (C432004_0.Cenozoic, null, Devonian) then
|
Report.Failed ("Object of record extension of abstract ancestor, " &
|
Report.Failed ("Object of record extension of abstract ancestor, " &
|
"SampleType_B, failed content check");
|
"SampleType_B, failed content check");
|
end if;
|
end if;
|
|
|
-------------------
|
-------------------
|
if Sample_D1 /= (Era => C432004_0.Cenozoic, Loc => null,
|
if Sample_D1 /= (Era => C432004_0.Cenozoic, Loc => null,
|
Period => Cambrian, Sample_On_Loan => True) then
|
Period => Cambrian, Sample_On_Loan => True) then
|
Report.Failed ("Object 1 of record extension of record extension, " &
|
Report.Failed ("Object 1 of record extension of record extension, " &
|
"of abstract ancestor, SampleType_D, failed content " &
|
"of abstract ancestor, SampleType_D, failed content " &
|
"check");
|
"check");
|
end if;
|
end if;
|
|
|
-------------------
|
-------------------
|
if Sample_D2 /= (C432004_0.Cenozoic, null, Quaternary, True) then
|
if Sample_D2 /= (C432004_0.Cenozoic, null, Quaternary, True) then
|
Report.Failed ("Object 2 of record extension of record extension, " &
|
Report.Failed ("Object 2 of record extension of record extension, " &
|
"of abstract ancestor, SampleType_D, failed content " &
|
"of abstract ancestor, SampleType_D, failed content " &
|
"check");
|
"check");
|
end if;
|
end if;
|
-------------------
|
-------------------
|
if Sample_E.Era /= C432004_0.Cenozoic or
|
if Sample_E.Era /= C432004_0.Cenozoic or
|
Sample_E.Loc /= null or
|
Sample_E.Loc /= null or
|
not TC_Correct_Result (Sample_E, Quaternary) then
|
not TC_Correct_Result (Sample_E, Quaternary) then
|
Report.Failed ("Object of record extension of abstract private " &
|
Report.Failed ("Object of record extension of abstract private " &
|
"extension of abstract ancestor, SampleType_E, " &
|
"extension of abstract ancestor, SampleType_E, " &
|
"failed content check");
|
"failed content check");
|
end if;
|
end if;
|
|
|
-------------------
|
-------------------
|
if not C432004_0.TC_Correct_Result (Sample_I1, C432004_0.Mesozoic) or
|
if not C432004_0.TC_Correct_Result (Sample_I1, C432004_0.Mesozoic) or
|
Sample_I1.Period /= Tertiary or
|
Sample_I1.Period /= Tertiary or
|
Sample_I1.Loc.Building /= 9 or
|
Sample_I1.Loc.Building /= 9 or
|
Sample_I1.Sample_On_Loan /= False then
|
Sample_I1.Sample_On_Loan /= False then
|
Report.Failed ("Object 1 of record extension of abstract record " &
|
Report.Failed ("Object 1 of record extension of abstract record " &
|
"extension of abstract private ancestor, " &
|
"extension of abstract private ancestor, " &
|
"SampleType_I, failed content check");
|
"SampleType_I, failed content check");
|
end if;
|
end if;
|
|
|
-------------------
|
-------------------
|
if not C432004_0.TC_Correct_Result (Sample_I2, C432004_0.Mesozoic) or
|
if not C432004_0.TC_Correct_Result (Sample_I2, C432004_0.Mesozoic) or
|
Sample_I2.Period /= Jurassic or
|
Sample_I2.Period /= Jurassic or
|
Sample_I2.Loc /= null or
|
Sample_I2.Loc /= null or
|
Sample_I2.Sample_On_Loan /= False then
|
Sample_I2.Sample_On_Loan /= False then
|
Report.Failed ("Object 2 of record extension of abstract record " &
|
Report.Failed ("Object 2 of record extension of abstract record " &
|
"extension of abstract private ancestor, " &
|
"extension of abstract private ancestor, " &
|
"SampleType_I, failed content check");
|
"SampleType_I, failed content check");
|
end if;
|
end if;
|
|
|
-------------------
|
-------------------
|
if not TC_Correct_Result (Sample_J,
|
if not TC_Correct_Result (Sample_J,
|
Jurassic,
|
Jurassic,
|
C432004_0.Mesozoic) or
|
C432004_0.Mesozoic) or
|
Sample_J.Sample_On_Loan /= False then
|
Sample_J.Sample_On_Loan /= False then
|
Report.Failed ("Object of record extension of private extension " &
|
Report.Failed ("Object of record extension of private extension " &
|
"of abstract private ancestor, SampleType_J, " &
|
"of abstract private ancestor, SampleType_J, " &
|
"failed content check");
|
"failed content check");
|
end if;
|
end if;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end C432004;
|
end C432004;
|
|
|