-- CXAIB04.A -- -- The Ada Conformity Assessment Authority (ACAA) holds unlimited -- rights in the software and documentation contained herein. Unlimited -- rights are the same as those granted by the U.S. Government for older -- parts of the Ada Conformity Assessment Test Suite, and are defined -- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA -- intends to confer upon all recipients unlimited rights equal to those -- held by the ACAA. These rights include rights to use, duplicate, -- release or disclose the 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 to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE ACAA MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. -- -- Notice -- -- The ACAA has created and maintains the Ada Conformity Assessment Test -- Suite for the purpose of conformity assessments conducted in accordance -- with the International Standard ISO/IEC 18009 - Ada: Conformity -- assessment of a language processor. This test suite should not be used -- to make claims of conformance unless used in accordance with -- ISO/IEC 18009 and any applicable ACAA procedures. -- --* -- -- OBJECTIVE: -- Check that Ada.Containers.Bounded_Doubly_Linked_Lists is preelaborated. -- -- Check that type List from an instance of -- Ada.Containers.Bounded_Doubly_Linked_Lists has -- Preeelaborable_Initialization if the element type has -- Preelaborable_Initialization. -- -- Check that an instance of Ada.Containers.Bounded_Doubly_Linked_Lists -- can be used if the element type does not have -- Preelaborable_Initialization. -- -- TEST DESCRIPTION: -- This test is designed to imagine an active mapping program which -- keeps its data in instances of Ada.Containers.Bounded_Lists. Static -- items are kept in one list and movable items are kept in a different -- list. -- -- The data are declared in a preelaborated package to improve startup -- times. -- -- AI12-0409-1 says that a bounded list has preelaborable initialization -- if and only if the element type has preelaborable initialization. -- But a bounded list should always be usable in contexts where -- preelaborable initialization is not required. -- -- CHANGE HISTORY: -- 23 Dec 2020 RLB Created test. -- 29 Dec 2020 RLB Corrected wrong instance name. -- --! with FXAIB00; with Ada.Containers.Bounded_Doubly_Linked_Lists; package CXAIB04_Data with Preelaborate is package Static_Data is new Ada.Containers.Bounded_Doubly_Linked_Lists ( FXAIB00.Location, FXAIB00."="); Static_Locations : Static_Data.List(10); Sheboygan : Static_Data.Cursor; Madison : Static_Data.Cursor; Green_Bay : Static_Data.Cursor; Wausaw : Static_Data.Cursor; package Moveable_Data is new Ada.Containers.Bounded_Doubly_Linked_Lists ( FXAIB00.Tagged_Location, FXAIB00."="); -- Note: We cannot declare the Moveable_Locations here, as it is not -- required to have preelaborable initialization. --Moveable_Locations : Moveable_Data.List; Mazda_3 : Moveable_Data.Cursor; Windstar : Moveable_Data.Cursor; Forester : Moveable_Data.Cursor; end CXAIB04_Data; with Report; with CXAIB04_Data, FXAIB00; use CXAIB04_Data; with Ada.Containers; procedure CXAIB04 is use type Ada.Containers.Count_Type; -- Make operators visible. use type FXAIB00.Location; -- Make operators visible. Moveable_Locations : Moveable_Data.List(10); -- Preelaborable initialization not required to declare an object here. begin Report.Test ("CXAIB04", "Check that Ada.Containers.Bounded_Doubly_Linked_Lists is " & "preelaborated and that type List has " & "Preeelaborable_Initialization"); -- Check that the containers start empty: if Static_Locations.Length /= 0 then Report.Failed ("Static locations not empty on initialization"); end if; if not Moveable_Locations.Is_Empty then Report.Failed ("Moveable locations not empty on initialization"); end if; -- Insert data, saving cursors: Static_Locations.Insert (Before => Static_Data.No_Element, New_Item => (X => 100, Y => 50), Position => Sheboygan); Static_Locations.Insert (Before => Static_Data.No_Element, New_Item => (X => 0, Y => 0), Position => Madison); Static_Locations.Insert (Before => Static_Data.No_Element, New_Item => (X => 0, Y => 150), Position => Wausaw); Static_Locations.Insert (Before => Static_Data.No_Element, New_Item => (X => 75, Y => 120), Position => Green_Bay); Moveable_Locations.Insert (Before => Moveable_Data.No_Element, New_Item => (Id => <>, Loc => (X => 100, Y => 50)), Position => Windstar); Moveable_Locations.Insert (Before => Moveable_Data.No_Element, New_Item => (Id => <>, Loc => (X => 0, Y => 0)), Position => Mazda_3); Moveable_Locations.Insert (Before => Moveable_Data.No_Element, New_Item => (Id => <>, Loc => (X => -10, Y => 0)), Position => Forester); -- Check that the lengths are correct: if Static_Locations.Length /= 4 then Report.Failed ("Wrong number of static locations after loading"); end if; if Moveable_Locations.Length /= 3 then Report.Failed ("Wrong number of moveable locations after loading"); end if; -- Check a few values (using indexed notation): if Static_Locations(Sheboygan) /= (X => 100, Y => 50) then Report.Failed ("Wrong data - Sheboygan"); end if; if Static_Locations(Green_Bay) /= (X => 75, Y => 120) then Report.Failed ("Wrong data - Green Bay"); end if; if Moveable_Locations(Mazda_3).Loc /= (X => 0, Y => 0) then Report.Failed ("Wrong data - Mazda 3"); end if; if Moveable_Locations(Forester).Loc /= (X => -10, Y => 0) then Report.Failed ("Wrong data - Forester"); end if; -- Move the Mazda 3: Moveable_Locations(Mazda_3).Loc := (X => 100, Y => 50); -- Check that it moved: if Moveable_Locations(Mazda_3).Loc /= (X => 100, Y => 50) then Report.Failed ("Wrong data after moving - Mazda 3"); end if; -- Check that the ids are unique: if Moveable_Locations(Mazda_3).Id = Moveable_Locations(Forester).Id or else Moveable_Locations(Mazda_3).Id = Moveable_Locations(Windstar).Id or else Moveable_Locations(Forester).Id = Moveable_Locations(Windstar).Id then Report.Failed ("Ids not unique for moveable data"); end if; Report.Result; end CXAIB04;