--------------------------------- COPYRIGHT ------------------------------------
-- (C) 1987 Swiss Federal Institute of Technology (EPFL).                     --
--     Represented by A. Strohmeier DMA-EPFL 1015 Lausanne Switzerland.       --
--     All Rights Reserved.                                                   --
--------------------------------------------------------------------------------
--+ TITLE : TEST PROCEDURE FOR PACKAGE
--+				   TABLE_OF_STRINGS_AND_DYNAMIC_VALUES_G
--+ SUPPORT : Jean-Jos# de Rus DMA-EPFL CH-1015 Lausanne
--+ CREATION : 14-DEC-1987 by Jean-jos# de Rus

with Text_Io;
use Text_Io;
with Integer_Text_Io;
with Table_Of_Strings_And_Dynamic_Values_G;
with Generator_Of_V_Strings_And_Dyn_Values;
use Generator_Of_V_Strings_And_Dyn_Values;
procedure Table_Of_V_Strings_And_Dyn_Values_Test is
------------------------------
--+ OVERVIEW:
--+   This procedure tests behaviour of the package
--+ TABLE_OF_STRINGS_AND_DYNAMIC_VALUES_G
--+ It tests all primitives exported by this package in each particular and
--+ critical situation.
--+   Reference vector  in package GENERATOR_OF_STRINGS_AND_DYN_VALUES is
--+ used to initialize and compare elements of tables involved in these tests.
-------------------------------------------------------------------------------

    package Table_Of_Strings is
       new Table_Of_Strings_And_Dynamic_Values_G
              (Less, Equals, Value_Type, Assign, Destroy);
    use Table_Of_Strings;

    package Set_Operations is new Set_Operations_G;
    use Set_Operations;

    use Var_String;

    Vector_Size : constant Positive := 100;
    Vector, Vector2, Descending_Vector, Ascending_Vector :
       Vector_Type (1 .. Vector_Size);

    Step : Integer;
    -- Step indicator for error location.
    Actual_Max_Free_List_Size : Natural := 0;
    -- Actual maximum free list size positioned with SET_MAX_FREE_LIST_SIZE;

    Key_In : V_String;
    Key_Out, Key_Out2 : String (1 .. 10);
    Val, Val2 : Value_Type;
    Error : Boolean := False;
    Last, Last2 : Natural;

    Test_Error : exception;
    -- Raised on unsuccesful test.

    --/ GENERAL PURPOSE PROCEDURES:

-------------------------------------------------------------------------------
    function "=" (Left, Right : Value_Type) return Boolean is
        -- Used on equality (or inequality) tests with VALUE_TYPE values.
    begin
        return Equals (Left, Right);
    end "=";
-------------------------------------------------------------------------------

    procedure Display_Error_Location (Step : in Integer; Number : in Integer) is
        -- Displays error location and assigns value "TRUE" to ERROR
        -- which stops program execution at the end of a STEP.
    begin
        Error := True;
        Put ("*** ERROR: ");
        Integer_Text_Io.Put (Number);
        Put ("  AT STEP");
        Integer_Text_Io.Put (Step);
        Put ("  FOR MAX_FREE_LIST_SIZE =");
        Integer_Text_Io.Put (Actual_Max_Free_List_Size);
        New_Line;
    end Display_Error_Location;

-------------------------------------------------------------------------------

    procedure Null_Act (Key : in String;
                        Val : in Value_Type;
                        Order_Number : in Positive;
                        Continue : in out Boolean) is
        -- Used in tests of traversals.
    begin
        null;
    end Null_Act;

-------------------------------------------------------------------------------

    procedure Null_Modify_Val (Key : in String;
                               Val : in out Value_Type;
                               Order_Number : in Positive;
                               Continue : in out Boolean) is
        -- Used in tests of traversals.
    begin
        null;
    end Null_Modify_Val;

-------------------------------------------------------------------------------

    procedure Traverse_Asc_Without_Action is new Traverse_Asc_G (Null_Act);
    procedure Traverse_Desc_Without_Action is new Traverse_Desc_G (Null_Act);
    procedure Disorder_Traverse_Without_Action is
       new Disorder_Traverse_G (Null_Act);
    procedure Traverse_Asc_Without_Modify_Value is
       new Traverse_Asc_And_Update_Value_G (Null_Modify_Val);
    procedure Traverse_Desc_Without_Modify_Value is
       new Traverse_Desc_And_Update_Value_G (Null_Modify_Val);
    procedure Disorder_Traverse_Without_Modify_Value is
       new Disorder_Traverse_And_Update_Value_G (Null_Modify_Val);

-------------------------------------------------------------------------------

    procedure Initialize (Table : in out Table_Type;
                          Number_Of_Elements : in Positive) is
        -- Initializes a TABLE with first NUMBER_OF_ELEMENTS
        -- elements of VECTOR.
    begin
        Destroy (Table);
        for I in 1 .. Number_Of_Elements loop
            Insert (Table, To_String (Vector (I).Key), Vector (I).Val);
        end loop;
    end Initialize;
--------------------------------------------------------------------------------

    procedure Initialize2 (Table : in out Table_Type;
                           Number_Of_Elements : in Positive) is
        -- Initializes a TABLE with first NUMBER_OF_ELEMENTS
        -- elements of VECTOR2.
        -- VECTOR and VECTOR2 are quite different
    begin
        Destroy (Table);
        for I in 1 .. Number_Of_Elements loop
            Insert (Table, To_String (Vector2 (I).Key), Vector2 (I).Val);
        end loop;
    end Initialize2;
-------------------------------------------------------------------------------
    procedure Check_Empty_Structure (Structure : in out Table_Type) is
        -- Tests behaviour of the exported procedures while
        -- the STRUCTURE is empty.
        -- Tests the exception EMPTY_STRUCTURE_ERROR.
        Found : Boolean;
        Number_Deleted : Natural;
    begin
        Assign (Key_In, Vector (1).Key);
        if Size (Structure) /= 0 then
            Display_Error_Location (Step, 5);
        end if;
        if not Is_Empty (Structure) then
            Display_Error_Location (Step, 10);
        end if;
        if Is_Present (Structure, To_String (Key_In)) then
            Display_Error_Location (Step, 15);
        end if;
        Remove (Structure, To_String (Ascending_Vector (1).Key), Found);
        if Found then
            Display_Error_Location (Step, 25);
        end if;
        begin
            Remove (Structure, To_String (Ascending_Vector (1).Key));
            Display_Error_Location (Step, 30);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Remove (Structure, To_String (Ascending_Vector (1).Key),
                    Ascending_Vector (1).Val);
            Display_Error_Location (Step, 31);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Remove_Max (Structure);
            Display_Error_Location (Step, 35);
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Remove_Min (Structure);
            Display_Error_Location (Step, 45);
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Max_Key (Structure, Key_Out, Last);
            Display_Error_Location (Step, 55);
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Assign (Key_Out, Max_Key (Structure));
            Display_Error_Location (Step, 60);
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Min_Key (Structure, Key_Out, Last);
            Display_Error_Location (Step, 65);
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Assign (Key_Out, Min_Key (Structure));
            Display_Error_Location (Step, 70);
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Value (Structure, To_String (Key_In), Val);
            Display_Error_Location (Step, 95);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Assign (Val, Value (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 96);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Min_Item (Structure, Key_Out, Last, Val);
            Display_Error_Location (Step, 103);
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Max_Item (Structure, Key_Out, Last, Val);
            Display_Error_Location (Step, 104);
        exception
            when Empty_Structure_Error =>
                null;
        end;
        if Structure /= Structure then
            Display_Error_Location (Step, 105);
        end if;
        declare
            procedure Modify_Val (Key : in String; Value : in out Value_Type) is
            begin
                Assign (Value, Vector (Vector_Size).Val);
            end Modify_Val;
            procedure Update_Val_Status is
               new Update_Value_Or_Status_G (Modify_Val);
        begin
            Traverse_Asc_Without_Action (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 115);
        end;
        begin
            Traverse_Desc_Without_Action (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 120);
        end;
        begin
            Disorder_Traverse_Without_Action (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 125);
        end;
        begin
            Traverse_Asc_Without_Modify_Value (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 130);
        end;
        begin
            Traverse_Desc_Without_Modify_Value (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 135);
        end;
        begin
            Disorder_Traverse_Without_Modify_Value (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 140);
        end;
        begin
            Destroy (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 145);
        end;
        begin
            Assign (Structure, Structure);
        exception
            when others =>
                Display_Error_Location (Step, 150);
        end;
        if Structure /= Structure then
            Display_Error_Location (Step, 155);
        end if;
        begin
            Assign (Key_Out, Less_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 160);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 165);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Assign (Key_Out, Less_Or_Equal_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 180);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Or_Equal_Key
               (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 185);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Item (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 191);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Or_Equal_Item
               (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 193);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Assign (Key_Out, Greater_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 195);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 200);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Assign (Key_Out, Greater_Or_Equal_Key
                                (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 210);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Or_Equal_Key
               (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 215);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Item (Structure, To_String (Key_In),
                              Key_Out, Last, Val);
            Display_Error_Location (Step, 221);
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Or_Equal_Item
               (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 223);
        exception
            when Missing_Item_Error =>
                null;
        end;
    exception
        when others =>
            Display_Error_Location (Step, 225);
            -- Presence of an undefined error!
    end Check_Empty_Structure;

-------------------------------------------------------------------------------

    procedure Check_Between_Two_Empty_Structures
                 (Dest, Source : in out Table_Type) is
        -- Check relations and assignment between two empty tables.
    begin
        if Dest /= Source then
            Display_Error_Location (Step, 5);
        end if;
        if Dest < Source then
            Display_Error_Location (Step, 10);
        end if;
        if Dest > Source then
            Display_Error_Location (Step, 15);
        end if;
        if not (Dest >= Source) then
            Display_Error_Location (Step, 20);
        end if;
        if not (Dest <= Source) then
            Display_Error_Location (Step, 25);
        end if;
        begin
            Assign (Dest, Source);
        exception
            when others =>
                Display_Error_Location (Step, 30);
        end;

    exception
        when others =>
            Display_Error_Location (Step, 35);
            -- Presence of an undefined error!
    end Check_Between_Two_Empty_Structures;

-------------------------------------------------------------------------------

    procedure Check_Unary_Operations (Number : in Positive;
                                      Min_Value_Key : in V_String;
                                      Max_Value_Key : in V_String;
                                      Min_Value_Val : in Value_Type;
                                      Max_Value_Val : in Value_Type;
                                      Structure : in out Table_Type) is
        -- Check unary operations on TABLE.
        Found : Boolean;
    begin
        if Number = 1 then
            -- tests only for structures of size 1.
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last).Key);
                Remove (Structure, To_String (Key_In), Found);
                if Found then
                    Display_Error_Location (Step, 5);
                end if;
                if Less_Key (Structure, To_String (Key_In)) /=
                   Max_Key (Structure) then
                    Display_Error_Location (Step, 10);
                end if;
                Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Max_Key (Structure) then
                    Display_Error_Location (Step, 15);
                end if;
                Get_Less_Item (Structure, To_String (Key_In),
                               Key_Out, Last, Val);
                Get_Max_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out (1 .. Last) /= Key_Out2 (1 .. Last2) or
                   Val /= Val2 then
                    Display_Error_Location (Step, 16);
                end if;
                if Less_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   Max_Key (Structure) then
                    Display_Error_Location (Step, 25);
                end if;
                Get_Less_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Max_Key (Structure) then
                    Display_Error_Location (Step, 30);
                end if;
                Get_Less_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                Get_Max_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out (1 .. Last) /= Key_Out2 (1 .. Last2) or
                   Val /= Val2 then
                    Display_Error_Location (Step, 31);
                end if;
                Destroy (Structure);
                Insert (Structure, To_String
                                      (Ascending_Vector (Vector'Last).Key),
                        Ascending_Vector (Vector'Last).Val);
                Assign (Key_In, Ascending_Vector (Vector'First).Key);
                if Greater_Key (Structure, To_String (Key_In)) /=
                   Min_Key (Structure) then
                    Display_Error_Location (Step, 40);
                end if;
                Get_Greater_Item (Structure, To_String (Key_In),
                                  Key_Out, Last, Val);
                Get_Min_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out2 (1 .. Last2) /= Key_Out (1 .. Last) or
                   Val2 /= Val then
                    Display_Error_Location (Step, 41);
                end if;
                Get_Greater_Key (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Min_Key (Structure) then
                    Display_Error_Location (Step, 45);
                end if;
                if Greater_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   Min_Key (Structure) then
                    Display_Error_Location (Step, 55);
                end if;
                Get_Greater_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Min_Key (Structure) then
                    Display_Error_Location (Step, 60);
                end if;
                Get_Greater_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                Get_Min_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out2 (1 .. Last2) /= Key_Out (1 .. Last) or
                   Val2 /= Val then
                    Display_Error_Location (Step, 61);
                end if;
                Assign (Key_In, Ascending_Vector (Vector'Last).Key);
                if Less_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   To_String (Key_In) or
                   Less_Or_Equal_Key (Structure, To_String (Key_In)) /=
                      Max_Key (Structure) then
                    Display_Error_Location (Step, 70);
                end if;
                Get_Less_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Max_Key (Structure) then
                    Display_Error_Location (Step, 75);
                end if;
                Get_Less_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                Get_Max_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out2 (1 .. Last2) /= Key_Out (1 .. Last) or
                   Val2 /= Val then
                    Display_Error_Location (Step, 76);
                end if;
                if Greater_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   To_String (Key_In) or
                   Greater_Or_Equal_Key (Structure, To_String (Key_In)) /=
                      Min_Key (Structure) then
                    Display_Error_Location (Step, 90);
                end if;
                Get_Greater_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Min_Key (Structure) then
                    Display_Error_Location (Step, 95);
                end if;
                Get_Greater_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                Get_Min_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out2 (1 .. Last2) /= Key_Out (1 .. Last) or
                   Val2 /= Val then
                    Display_Error_Location (Step, 96);
                end if;
                Destroy (Structure);
                Insert (Structure, To_String (Ascending_Vector (1).Key),
                        Ascending_Vector (1).Val);
            end;
        else
            -- tests only for structures of size VECTOR_SIZE.
            begin
                Assign (Key_In, Max_Value_Key);
                if Less_Key (Structure, To_String (Key_In)) /=
                   To_String (Ascending_Vector (Vector_Size - 1).Key) then
                    Display_Error_Location (Step, 105);
                end if;
                Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /=
                   To_String (Ascending_Vector (Vector_Size - 1).Key) then
                    Display_Error_Location (Step, 110);
                end if;
                Get_Less_Item (Structure, To_String (Key_In),
                               Key_Out, Last, Val);
                if Key_Out (1 .. Last) /=
                   To_String (Ascending_Vector (Vector_Size - 1).Key) or
                   Val /= Ascending_Vector (Vector_Size - 1).Val then
                    Display_Error_Location (Step, 111);
                end if;
                if Less_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   To_String (Ascending_Vector (Vector_Size).Key) or
                   Less_Or_Equal_Key (Structure, To_String (Key_In)) /=
                      To_String (Max_Value_Key) then
                    Display_Error_Location (Step, 120);
                end if;
                Get_Less_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= To_String (Max_Value_Key) then
                    Display_Error_Location (Step, 125);
                end if;
                Get_Less_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                if Key_Out (1 .. Last) /= To_String (Max_Value_Key) or
                   Val /= Max_Value_Val then
                    Display_Error_Location (Step, 126);
                end if;
                Assign (Key_In, Min_Value_Key);
                if Less_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   To_String (Min_Value_Key) then
                    Display_Error_Location (Step, 140);
                end if;
                Get_Less_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= To_String (Min_Value_Key) then
                    Display_Error_Location (Step, 145);
                end if;
                Get_Less_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                if Key_Out (1 .. Last) /= To_String (Min_Value_Key) or
                   Val /= Min_Value_Val then
                    Display_Error_Location (Step, 146);
                end if;
                if Greater_Key (Structure, To_String (Key_In)) /=
                   To_String (Ascending_Vector (Vector'First + 1).Key) then
                    Display_Error_Location (Step, 155);
                end if;
                if Greater_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   To_String (Min_Value_Key) then
                    Display_Error_Location (Step, 170);
                end if;
                Get_Greater_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= To_String (Min_Value_Key) then
                    Display_Error_Location (Step, 175);
                end if;
                Get_Greater_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                if Key_Out (1 .. Last) /= To_String (Min_Value_Key) or
                   Val /= Min_Value_Val then
                    Display_Error_Location (Step, 176);
                end if;
                Assign (Key_In, Max_Value_Key);
                if Greater_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   To_String (Max_Value_Key) then
                    Display_Error_Location (Step, 185);
                end if;
                Get_Greater_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= To_String (Max_Value_Key) then
                    Display_Error_Location (Step, 190);
                end if;
                Get_Greater_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                if Key_Out (1 .. Last) /= To_String (Max_Value_Key) or
                   Val /= Max_Value_Val then
                    Display_Error_Location (Step, 191);
                end if;
                Remove_Max (Structure);
                if Less_Key (Structure, To_String (Key_In)) /=
                   Max_Key (Structure) then
                    Display_Error_Location (Step, 200);
                end if;
                Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Max_Key (Structure) then
                    Display_Error_Location (Step, 205);
                end if;
                Get_Less_Item (Structure, To_String (Key_In),
                               Key_Out, Last, Val);
                Get_Max_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out2 (1 .. Last2) /= Key_Out (1 .. Last) or
                   Val2 /= Val then
                    Display_Error_Location (Step, 206);
                end if;
                if Less_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   Max_Key (Structure) then
                    Display_Error_Location (Step, 215);
                end if;
                Get_Less_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Max_Key (Structure) then
                    Display_Error_Location (Step, 220);
                end if;
                Get_Less_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                Get_Max_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out2 (1 .. Last2) /= Key_Out (1 .. Last) or
                   Val2 /= Val then
                    Display_Error_Location (Step, 221);
                end if;
                Assign (Key_In, Min_Value_Key);
                Remove_Min (Structure);
                if Greater_Key (Structure, To_String (Key_In)) /=
                   Min_Key (Structure) then
                    Display_Error_Location (Step, 245);
                end if;
                Get_Greater_Key (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Min_Key (Structure) then
                    Display_Error_Location (Step, 250);
                end if;
                Get_Greater_Item (Structure, To_String (Key_In),
                                  Key_Out, Last, Val);
                Get_Min_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out2 (1 .. Last2) /= Key_Out (1 .. Last) or
                   Val2 /= Val then
                    Display_Error_Location (Step, 251);
                end if;
                if Greater_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   Min_Key (Structure) then
                    Display_Error_Location (Step, 260);
                end if;
                Get_Greater_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= Min_Key (Structure) then
                    Display_Error_Location (Step, 265);
                end if;
                Get_Greater_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                Get_Min_Item (Structure, Key_Out2, Last2, Val2);
                if Key_Out2 (1 .. Last2) /= Key_Out (1 .. Last) or
                   Val2 /= Val then
                    Display_Error_Location (Step, 266);
                end if;
                Remove (Structure, To_String (Key_In), Found);
                if Found then
                    Display_Error_Location (Step, 285);
                end if;
                Initialize (Structure, Vector_Size);
            end;

            declare
                Middle_Item_Key, Less_Item_Key, Greater_Item_Key : V_String;
                Middle_Item_Val, Less_Item_Val, Greater_Item_Val : Value_Type;
            begin
                Assign (Middle_Item_Key,
                        Ascending_Vector (Vector_Size / 2).Key);
                Assign (Key_In, Middle_Item_Key);
                Assign (Less_Item_Key,
                        Ascending_Vector (Vector_Size / 2 - 1).Key);
                Assign (Greater_Item_Key,
                        Ascending_Vector (Vector_Size / 2 + 1).Key);
                Assign (Middle_Item_Val,
                        Ascending_Vector (Vector_Size / 2).Val);
                Assign (Less_Item_Val,
                        Ascending_Vector (Vector_Size / 2 - 1).Val);
                Assign (Greater_Item_Val,
                        Ascending_Vector (Vector_Size / 2 + 1).Val);
                Remove (Structure, To_String (Middle_Item_Key));
                if Less_Key (Structure, To_String (Key_In)) /=
                   To_String (Less_Item_Key) then
                    Display_Error_Location (Step, 290);
                end if;
                Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= To_String (Less_Item_Key) then
                    Display_Error_Location (Step, 295);
                end if;
                if Less_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   To_String (Less_Item_Key) then
                    Display_Error_Location (Step, 305);
                end if;
                Get_Less_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= To_String (Less_Item_Key) then
                    Display_Error_Location (Step, 310);
                end if;
                if Greater_Key (Structure, To_String (Key_In)) /=
                   To_String (Greater_Item_Key) then
                    Display_Error_Location (Step, 320);
                end if;
                if Greater_Or_Equal_Key (Structure, To_String (Key_In)) /=
                   To_String (Greater_Item_Key) then
                    Display_Error_Location (Step, 330);
                end if;
                Get_Greater_Or_Equal_Key
                   (Structure, To_String (Key_In), Key_Out, Last);
                if Key_Out (1 .. Last) /= To_String (Greater_Item_Key) then
                    Display_Error_Location (Step, 335);
                end if;
                Get_Less_Item (Structure, To_String (Key_In),
                               Key_Out, Last, Val);
                if Key_Out (1 .. Last) /= To_String (Less_Item_Key) or
                   Val /= Less_Item_Val then
                    Display_Error_Location (Step, 345);
                end if;
                Get_Less_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                if Key_Out (1 .. Last) /= To_String (Less_Item_Key) or
                   Val /= Less_Item_Val then
                    Display_Error_Location (Step, 350);
                end if;
                Get_Greater_Item (Structure, To_String (Key_In),
                                  Key_Out, Last, Val);
                if Key_Out (1 .. Last) /= To_String (Greater_Item_Key) or
                   Val /= Greater_Item_Val then
                    Display_Error_Location (Step, 355);
                end if;
                Get_Greater_Or_Equal_Item
                   (Structure, To_String (Key_In), Key_Out, Last, Val);
                if Key_Out (1 .. Last) /= To_String (Greater_Item_Key) or
                   Val /= Greater_Item_Val then
                    Display_Error_Location (Step, 360);
                end if;
                Initialize (Structure, Vector_Size);
            end;
        end if;
        -- Common tests for any size structures.
        if Size (Structure) /= Number then
            Display_Error_Location (Step, 365);
        end if;
        if Is_Empty (Structure) then
            Display_Error_Location (Step, 370);
        end if;
        Get_Max_Key (Structure, Key_Out, Last);
        if Key_Out (1 .. Last) /= To_String (Max_Value_Key) then
            Display_Error_Location (Step, 375);
        end if;
        Get_Max_Item (Structure, Key_Out, Last, Val);
        if Key_Out (1 .. Last) /= To_String (Max_Value_Key) or
           Val /= Max_Value_Val then
            Display_Error_Location (Step, 380);
        end if;
        if Max_Key (Structure) /= To_String (Max_Value_Key) then
            Display_Error_Location (Step, 390);
        end if;
        Get_Min_Key (Structure, Key_Out, Last);
        if Key_Out (1 .. Last) /= To_String (Min_Value_Key) then
            Display_Error_Location (Step, 395);
        end if;
        Get_Min_Item (Structure, Key_Out, Last, Val);
        if Key_Out (1 .. Last) /= To_String (Min_Value_Key) or
           Val /= Min_Value_Val then
            Display_Error_Location (Step, 400);
        end if;
        if Min_Key (Structure) /= To_String (Min_Value_Key) then
            Display_Error_Location (Step, 405);
        end if;
        Remove (Structure, To_String (Max_Value_Key));
        if Size (Structure) /= Number - 1 then
            Display_Error_Location (Step, 425);
        end if;
        Insert (Structure, To_String (Max_Value_Key), Max_Value_Val);
        Remove (Structure, To_String (Max_Value_Key), Found);
        if Size (Structure) /= Number - 1 or not Found then
            Display_Error_Location (Step, 430);
        end if;
        Insert (Structure, To_String (Max_Value_Key), Max_Value_Val);
        Remove_Max (Structure);
        if Size (Structure) /= Number - 1 then
            Display_Error_Location (Step, 435);
        end if;
        Insert (Structure, To_String (Max_Value_Key), Max_Value_Val);
        Remove_Min (Structure);
        if Size (Structure) /= Number - 1 then
            Display_Error_Location (Step, 450);
        end if;
        Insert (Structure, To_String (Min_Value_Key), Min_Value_Val);
        if Size (Structure) /= Number then
            Display_Error_Location (Step, 465);
        end if;
        if Structure /= Structure then
            Display_Error_Location (Step, 470);
        end if;
        declare
            procedure No_Update_Value (Key : String; Val : in out Value_Type) is
            begin
                null;
            end No_Update_Value;

            procedure Update_Except_Val is
               new Update_Value_Or_Exception_G (No_Update_Value);
            procedure Update_Status_Val is
               new Update_Value_Or_Status_G (No_Update_Value);
        begin
            Assign (Key_In, Min_Value_Key);
            Assign (Val, Min_Value_Val);
            begin
                Update_Except_Val (Structure, To_String (Key_In));
            exception
                when Missing_Item_Error =>
                    Display_Error_Location (Step, 485);
            end;
            begin
                Update_Status_Val (Structure, To_String (Key_In), Found);
                if not Found then
                    Display_Error_Location (Step, 490);
                end if;
            exception
                when others =>
                    Display_Error_Location (Step, 495);
            end;
            Remove (Structure, To_String (Min_Value_Key));
            begin
                Update_Status_Val (Structure, To_String (Key_In), Found);
                if Found then
                    Display_Error_Location (Step, 510);
                end if;
            exception
                when others =>
                    Display_Error_Location (Step, 520);
            end;
        end;
        Insert (Structure, To_String (Min_Value_Key), Min_Value_Val, Found);
        if Found then
            Display_Error_Location (Step, 535);
        end if;
        begin
            Traverse_Asc_Without_Action (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 540);
        end;
        begin
            Traverse_Desc_Without_Action (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 545);
        end;
        begin
            Disorder_Traverse_Without_Action (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 550);
        end;
        begin
            Traverse_Asc_Without_Modify_Value (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 555);
        end;
        begin
            Traverse_Desc_Without_Modify_Value (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 565);
        end;
        begin
            Disorder_Traverse_Without_Modify_Value (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 575);
        end;
        if not Is_Present (Structure, To_String (Min_Value_Key)) then
            Display_Error_Location (Step, 590);
        end if;
        declare
            Dest : Table_Type;
        begin
            Assign (Dest, Structure);
            if Dest /= Structure then
                Display_Error_Location (Step, 595);
            end if;
            Assign (Structure, Structure);
            if Dest /= Structure then
                Display_Error_Location (Step, 600);
            end if;
        end;
        Destroy (Structure);
        if not Is_Empty (Structure) then
            Display_Error_Location (Step, 605);
        end if;
    exception
        when others =>
            Display_Error_Location (Step, 610);
            -- Presence of an undefined error!
    end Check_Unary_Operations;

-------------------------------------------------------------------------------

    procedure Check_Equal_Structures (Left, Right : in out Table_Type) is
        -- Check relations and assignment between two equal structures.
    begin
        if Left /= Right then
            Display_Error_Location (Step, 5);
        end if;
        if Left < Right then
            Display_Error_Location (Step, 10);
        end if;
        if Left > Right then
            Display_Error_Location (Step, 15);
        end if;
        if not (Left >= Right) then
            Display_Error_Location (Step, 20);
        end if;
        if not (Left <= Right) then
            Display_Error_Location (Step, 25);
        end if;
        begin
            Assign (Left, Right);
        exception
            when others =>
                Display_Error_Location (Step, 30);
        end;
        begin
            Destroy (Left);
            Assign (Left, Right);
        exception
            when others =>
                Display_Error_Location (Step, 35);
        end;
        begin
            Destroy (Right);
            Assign (Left, Right);
        exception
            when others =>
                Display_Error_Location (Step, 40);
        end;
        if Left /= Right then
            Display_Error_Location (Step, 45);
        end if;
    exception
        when others =>
            Display_Error_Location (Step, 50);
            -- Presence of an undefined error!
    end Check_Equal_Structures;

-------------------------------------------------------------------------------

    procedure Check_Not_Equal_Structures (Left, Right : in out Table_Type) is
        -- Check relations and assignment between two different structures.
        Structure : Table_Type;
        Found, Duplicate_Item : Boolean;

    begin
        if Left = Right then
            Display_Error_Location (Step, 5);
        end if;
        if Right = Left then
            Display_Error_Location (Step, 10);
        end if;
        begin
            Assign (Left, Right);
        exception
            when others =>
                Display_Error_Location (Step, 15);
        end;
        if Left /= Right then
            Display_Error_Location (Step, 20);
        end if;
        Initialize (Structure, Vector_Size - 1);
        Assign (Key_In, Vector (Vector'Last).Key);
        if Is_Present (Structure, To_String (Key_In)) then
            Display_Error_Location (Step, 30);
        end if;
        Assign (Key_In, Vector (Vector'Last).Key);
        Insert (Structure, To_String (Key_In), Val, Duplicate_Item);
        if Duplicate_Item then
            Display_Error_Location (Step, 40);
        end if;
        if Size (Structure) /= Vector_Size then
            Display_Error_Location (Step, 50);
        end if;
    exception
        when others =>
            Display_Error_Location (Step, 55);
            -- Presence of an undefined error!
    end Check_Not_Equal_Structures;

-------------------------------------------------------------------------------
    procedure Check_Set_Operations is

        -- Check procedures
        --			UNION
        --			INTERSECTION
        --			DIFFERENCE
        --			SYMMETRIC_DIFFERENCE
        --			"<" strict set inclusion
        --			"<=" set inclusion
        --			">"
        --			">="
        --			"=" set equality

        Dest, Dest2, Left, Right : Table_Type;
        Key, Max_Value_Key : V_String;
        Val, Max_Value_Val, Min_Value_Val : Value_Type;
        Error : Boolean;

    begin

        Assign (Max_Value_Key, Ascending_Vector (Vector'Last).Key);
        Assign (Max_Value_Val, Ascending_Vector (Vector'Last).Val);
        Assign (Min_Value_Val, Ascending_Vector (Vector'First).Val);

        --/ UNION	
        Initialize (Left, Vector_Size);
        Initialize2 (Right, Vector_Size);
        Union (Dest, Left, Right);
        if Size (Dest) /= Size (Left) + Size (Right) then
            Display_Error_Location (Step, 5);
        end if;
        -- DEST must contain LEFT and RIGHT.
        for I in 1 .. 2 * Vector_Size loop
            Get_Max_Key (Dest, Key_Out, Last);
            Remove_Max (Dest);
            if not (Is_Present (Left, Key_Out (1 .. Last)) or
                    Is_Present (Right, Key_Out (1 .. Last))) then
                Display_Error_Location (Step, 10);
            end if;
        end loop;
        Destroy (Dest);
        Replace_Value (Left, To_String (Max_Value_Key), Min_Value_Val);
        Insert (Right, To_String (Max_Value_Key), Max_Value_Val);
        -- LEFT and RIGHT are different except for one element.
        Union (Dest, Left, Right);
        if (Size (Dest) /= Size (Left) + Size (Right) - 1) then
            Display_Error_Location (Step, 15);
        end if;
        Get_Value (Dest, To_String (Max_Value_Key), Val);
        if Val /= Min_Value_Val then
            Display_Error_Location (Step, 16);
        end if;
        Destroy (Dest);
        Destroy (Left);
        -- LEFT is empty
        Union (Dest, Left, Right);
        if Dest /= Right then
            Display_Error_Location (Step, 20);
        end if;
        if Size (Dest) /= Size (Right) then
            Display_Error_Location (Step, 25);
        end if;
        Destroy (Dest);
        Union (Dest, Right, Left);
        if Dest /= Right then
            Display_Error_Location (Step, 30);
        end if;
        if Size (Dest) /= Size (Right) then
            Display_Error_Location (Step, 35);
        end if;
        Destroy (Dest);
        Union (Dest, Left, Left);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 40);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 45);
        end if;
        Union (Dest, Right, Right);
        if Dest /= Right then
            Display_Error_Location (Step, 50);
        end if;
        if Size (Dest) /= Size (Right) then
            Display_Error_Location (Step, 55);
        end if;
        Destroy (Dest);
        Destroy (Right);
        -- LEFT and RIGHT are both empty.
        Union (Dest, Left, Right);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 60);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 65);
        end if;

        --/ INTERSECTION
        Initialize (Left, Vector_Size);
        Initialize2 (Right, Vector_Size);
        Intersection (Dest, Left, Right);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 70);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 80);
        end if;
        Replace_Value (Left, To_String (Max_Value_Key), Min_Value_Val);
        Insert (Right, To_String (Max_Value_Key), Max_Value_Val);
        -- LEFT and RIGHT are different except for one element.
        Intersection (Dest, Left, Right);
        if Size (Dest) /= 1 then
            Display_Error_Location (Step, 90);
        end if;
        Get_Max_Item (Dest, Key_Out, Last, Val);
        if Val /= Min_Value_Val or Key_Out (1 .. Last) /=
                                      To_String (Max_Value_Key) then
            Display_Error_Location (Step, 91);
        end if;
        Destroy (Dest);
        Destroy (Left);
        -- LEFT is empty.
        Intersection (Dest, Left, Right);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 95);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 100);
        end if;
        Intersection (Dest, Right, Left);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 105);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 110);
        end if;
        Intersection (Dest, Left, Left);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 115);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 120);
        end if;
        Intersection (Dest, Right, Right);
        if Dest /= Right then
            Display_Error_Location (Step, 125);
        end if;
        if Size (Dest) /= Size (Right) then
            Display_Error_Location (Step, 130);
        end if;
        -- DEST and RIGHT must be equals.
        while not Is_Empty (Dest) loop
            Get_Max_Key (Right, Key_Out, Last);
            Remove_Max (Right);
            if not Is_Present (Dest, Key_Out (1 .. Last)) then
                Display_Error_Location (Step, 135);
            end if;
            Remove (Dest, Key_Out (1 .. Last));
        end loop;
        -- LEFT and RIGHT are both empty.
        Intersection (Dest, Left, Right);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 140);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 145);
        end if;

        -- DIFFERENCE
        Initialize (Left, Vector_Size);
        Initialize2 (Right, Vector_Size);
        Difference (Dest, Left, Right);
        if Dest /= Left then
            Display_Error_Location (Step, 150);
        end if;
        if Size (Dest) /= Size (Left) then
            Display_Error_Location (Step, 155);
        end if;
        Destroy (Dest);
        Get_Max_Item (Left, Key_Out, Last, Val);
        Insert (Right, Key_Out (1 .. Last), Val);
        -- LEFT and RIGHT are different except for one element.
        Difference (Dest, Left, Right);
        if Size (Dest) /= Size (Left) - 1 then
            Display_Error_Location (Step, 160);
        end if;
        if Is_Present (Dest, To_String (Key)) then
            Display_Error_Location (Step, 165);
        end if;
        Destroy (Dest);
        Destroy (Left);
        -- LEFT is empty.
        Difference (Dest, Left, Right);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 170);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 175);
        end if;
        -- LEFT is empty and RIGHT is not.
        Difference (Dest, Right, Left);
        if Dest /= Right then
            Display_Error_Location (Step, 180);
        end if;
        if Size (Dest) /= Size (Right) then
            Display_Error_Location (Step, 185);
        end if;
        Destroy (Dest);
        Difference (Dest, Left, Left);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 190);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 195);
        end if;
        Difference (Dest, Right, Right);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 200);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 205);
        end if;
        Destroy (Right);
        -- LEFT and RIGHT are both empty.
        Difference (Dest, Left, Right);
        if not Is_Empty (Dest) then
            Display_Error_Location (Step, 210);
        end if;
        if Size (Dest) /= 0 then
            Display_Error_Location (Step, 215);
        end if;

        -- SYMMETRIC_DIFFERENCE
        declare
            Dest1, Dest2 : Table_Type;

            procedure A_Diff_B_Union_B_Diff_A
                         (Destination, Left, Right : in out Table_Type;
                          Error : out Boolean) is
                Dest1, Dest2 : Table_Type;
            begin
                Destroy (Destination);
                Difference (Dest1, Left, Right);
                Difference (Dest2, Right, Left);
                Union (Destination, Dest1, Dest2);
                Destroy (Dest1);
                Symmetric_Difference (Dest1, Left, Right);
                Error := Dest1 /= Destination;
            end A_Diff_B_Union_B_Diff_A;

            procedure A_Union_B_Diff_A_Inter_B
                         (Destination, Left, Right : in out Table_Type;
                          Error : out Boolean) is
                Dest1, Dest2 : Table_Type;
            begin
                Destroy (Destination);
                Union (Dest1, Left, Right);
                Intersection (Dest2, Left, Right);
                Difference (Destination, Dest1, Dest2);
                Destroy (Dest1);
                Symmetric_Difference (Dest1, Left, Right);
                Error := Dest1 /= Destination;
            end A_Union_B_Diff_A_Inter_B;

            -- The symmetric difference can be obtained, if we consider
            -- two set A and B, by two different ways :
            -- (A UNION B) DIFFERENCE (A INTERSECTION B)
            -- (A DIFFERENCE B) UNION (B DIFFERENCE A)

        begin
            Destroy (Dest);
            Initialize (Left, Vector_Size);
            Initialize2 (Right, Vector_Size);
            Symmetric_Difference (Dest, Left, Right);
            if Is_Empty (Dest) then
                Display_Error_Location (Step, 220);
            end if;
            if Size (Dest) /= Size (Left) + Size (Right) then
                Display_Error_Location (Step, 225);
            end if;
            A_Diff_B_Union_B_Diff_A (Dest1, Left, Right, Error);
            if Error then
                Display_Error_Location (Step, 230);
            end if;
            A_Union_B_Diff_A_Inter_B (Dest2, Left, Right, Error);
            if Error then
                Display_Error_Location (Step, 235);
            end if;
            if Dest1 /= Dest2 then
                Display_Error_Location (Step, 240);
            end if;
            Get_Max_Item (Left, Key_Out, Last, Val);
            Insert (Right, Key_Out (1 .. Last), Val);
            -- LEFT and RIGHT are different except for one element.
            Symmetric_Difference (Dest, Left, Right);
            if Is_Present (Dest, To_String (Key)) then
                Display_Error_Location (Step, 245);
            end if;
            if Size (Dest) /= Size (Left) + Size (Right) - 2 then
                Display_Error_Location (Step, 250);
            end if;
            A_Diff_B_Union_B_Diff_A (Dest1, Left, Right, Error);
            if Error then
                Display_Error_Location (Step, 255);
            end if;
            A_Union_B_Diff_A_Inter_B (Dest2, Left, Right, Error);
            if Error then
                Display_Error_Location (Step, 260);
            end if;
            if Dest1 /= Dest2 then
                Display_Error_Location (Step, 265);
            end if;
            Destroy (Dest);
            Destroy (Left);
            -- LEFT is empty and RIGHT is not.
            Symmetric_Difference (Dest, Left, Right);
            if Is_Empty (Dest) then
                Display_Error_Location (Step, 270);
            end if;
            if Size (Dest) /= Size (Right) then
                Display_Error_Location (Step, 275);
            end if;
            A_Diff_B_Union_B_Diff_A (Dest1, Left, Right, Error);
            if Error then
                Display_Error_Location (Step, 280);
            end if;
            A_Union_B_Diff_A_Inter_B (Dest2, Left, Right, Error);
            if Error then
                Display_Error_Location (Step, 285);
            end if;
            if (Dest1 /= Dest2 and Dest2 /= Dest) then
                Display_Error_Location (Step, 280);
            end if;
            Symmetric_Difference (Dest, Right, Left);
            if Is_Empty (Dest) then
                Display_Error_Location (Step, 295);
            end if;
            if Size (Dest) /= Size (Right) then
                Display_Error_Location (Step, 300);
            end if;
            A_Diff_B_Union_B_Diff_A (Dest1, Right, Left, Error);
            if Error then
                Display_Error_Location (Step, 305);
            end if;
            A_Union_B_Diff_A_Inter_B (Dest2, Right, Left, Error);
            if Error then
                Display_Error_Location (Step, 310);
            end if;
            if (Dest1 /= Dest2 and Dest2 /= Dest) then
                Display_Error_Location (Step, 315);
            end if;
            Symmetric_Difference (Dest, Left, Left);
            if not Is_Empty (Dest) then
                Display_Error_Location (Step, 320);
            end if;
            if Size (Dest) /= 0 then
                Display_Error_Location (Step, 325);
            end if;
            A_Diff_B_Union_B_Diff_A (Dest1, Left, Left, Error);
            if Error then
                Display_Error_Location (Step, 330);
            end if;
            A_Union_B_Diff_A_Inter_B (Dest2, Left, Left, Error);
            if Error then
                Display_Error_Location (Step, 335);
            end if;
            if (Dest1 /= Dest2 and Dest2 /= Dest) then
                Display_Error_Location (Step, 340);
            end if;
            Symmetric_Difference (Dest, Right, Right);
            if not Is_Empty (Dest) then
                Display_Error_Location (Step, 345);
            end if;
            if Size (Dest) /= 0 then
                Display_Error_Location (Step, 350);
            end if;
            A_Diff_B_Union_B_Diff_A (Dest1, Right, Right, Error);
            if Error then
                Display_Error_Location (Step, 355);
            end if;
            A_Union_B_Diff_A_Inter_B (Dest2, Right, Right, Error);
            if Error then
                Display_Error_Location (Step, 360);
            end if;
            if (Dest1 /= Dest2 and Dest2 /= Dest) then
                Display_Error_Location (Step, 365);
            end if;
            Destroy (Right);
            -- LEFT and RIGHT are both empty.
            Symmetric_Difference (Dest, Left, Right);
            if not Is_Empty (Dest) then
                Display_Error_Location (Step, 370);
            end if;
            if Size (Dest) /= 0 then
                Display_Error_Location (Step, 375);
            end if;
            A_Diff_B_Union_B_Diff_A (Dest1, Left, Right, Error);
            if Error then
                Display_Error_Location (Step, 380);
            end if;
            A_Union_B_Diff_A_Inter_B (Dest2, Left, Right, Error);
            if Error then
                Display_Error_Location (Step, 385);
            end if;
            if (Dest1 /= Dest2 and Dest2 /= Dest) then
                Display_Error_Location (Step, 390);
            end if;
        end;

        --/ strict set inclusion "<" and ">"
        Initialize (Left, Vector_Size);
        Initialize2 (Right, Vector_Size);
        -- LEFT and RIGHT are entirely different.
        if Left < Right then
            Display_Error_Location (Step, 395);
        end if;
        if Left > Right then
            Display_Error_Location (Step, 400);
        end if;
        if not ((Left < Right) = (Right > Left)) then
            Display_Error_Location (Step, 405);
        end if;
        Initialize (Right, Vector_Size);
        -- LEFT and RIGHT are identical.
        if Left < Left then
            Display_Error_Location (Step, 410);
        end if;
        if Left > Left then
            Display_Error_Location (Step, 415);
        end if;
        Remove_Max (Left);
        -- RIGHT contains one more element than LEFT.
        if not (Left < Right) then
            Display_Error_Location (Step, 420);
        end if;
        if Left > Right then
            Display_Error_Location (Step, 425);
        end if;
        if not (Right > Left) then
            Display_Error_Location (Step, 430);
        end if;
        Remove_Max (Right);
        Remove_Max (Right);
        -- LEFT contains one more element than RIGHT.
        if Left < Right then
            Display_Error_Location (Step, 435);
        end if;
        Destroy (Left);
        -- LEFT is empty and RIGHT is not.
        if not (Left < Right) then
            Display_Error_Location (Step, 440);
        end if;
        if Left > Right then
            Display_Error_Location (Step, 445);
        end if;
        if Right < Left then
            Display_Error_Location (Step, 450);
        end if;
        if not (Right > Left) then
            Display_Error_Location (Step, 455);
        end if;

        --/ set inclusion "<=" and ">="
        Initialize (Left, Vector_Size);
        Initialize2 (Right, Vector_Size);
        if Left <= Right then
            Display_Error_Location (Step, 460);
        end if;
        if Left >= Right then
            Display_Error_Location (Step, 465);
        end if;
        if not ((Left <= Right) = (Right >= Left)) then
            Display_Error_Location (Step, 470);
        end if;
        Initialize (Right, Vector_Size);
        -- LEFT and RIGHT are identical.
        if not (Left <= Left) then
            Display_Error_Location (Step, 475);
        end if;
        if not (Left >= Left) then
            Display_Error_Location (Step, 480);
        end if;
        Remove_Max (Left);
        -- RIGHT contains one more element than LEFT.
        if not (Left <= Right) then
            Display_Error_Location (Step, 485);
        end if;
        if Left >= Right then
            Display_Error_Location (Step, 490);
        end if;
        if not (Right >= Left) then
            Display_Error_Location (Step, 495);
        end if;
        Remove_Max (Right);
        Remove_Max (Right);
        -- LEFT contains one more element than RIGHT.
        if Left <= Right then
            Display_Error_Location (Step, 500);
        end if;
        Destroy (Left);
        -- LEFT is empty and RIGHT is not.
        if not (Left <= Right) then
            Display_Error_Location (Step, 505);
        end if;
        if Left >= Right then
            Display_Error_Location (Step, 510);
        end if;
        if Right <= Left then
            Display_Error_Location (Step, 515);
        end if;
        if not (Right >= Left) then
            Display_Error_Location (Step, 520);
        end if;
        if not ((Left < Right or Left = Right) = (Left <= Right)) then
            Display_Error_Location (Step, 525);
        end if;
        if not ((Left > Right or Left = Right) = (Left >= Right)) then
            Display_Error_Location (Step, 530);
        end if;

        --/ set equality
        Initialize (Left, Vector_Size);
        Initialize2 (Right, Vector_Size);
        if Left = Right then
            Display_Error_Location (Step, 535);
        end if;
        Initialize (Right, Vector_Size);
        if not (Left = Right) then
            Display_Error_Location (Step, 540);
        end if;
        Remove_Max (Left);
        if Left = Right then
            Display_Error_Location (Step, 545);
        end if;
        if Right = Left then
            Display_Error_Location (Step, 550);
        end if;
    exception
        when others =>
            Display_Error_Location (Step, 555);
    end Check_Set_Operations;

-------------------------------------------------------------------------------
    procedure Check_Asc_Traversal (Table : in out Table_Type;
                                   Last : in Natural;
                                   Ascending_Vector : in Vector_Type) is
        -- Check procedures
        --                  TRAVERSE_ASC_AND_UPDATE_VALUE_G
        --                  TRAVERSE_ASC_G.
        Number : Natural;
        Order_Number_Error, Value_Error, Stop_Error : exception;

        procedure Compare (Key : in String;
                           Val : in Value_Type;
                           Order_Number : in Positive;
                           Continue : in out Boolean) is
        begin
            Number := Number + 1;
            if Number /= Order_Number then
                raise Order_Number_Error;
            end if;
            if Key /= To_String (Ascending_Vector (Number).Key) or
               Val /= Ascending_Vector (Number).Val then
                raise Value_Error;
            end if;
        end Compare;
        procedure Compare_Value (Key : in String;
                                 Val : in out Value_Type;
                                 Order_Number : in Positive;
                                 Continue : in out Boolean) is
        begin
            Number := Number + 1;
            if Number /= Order_Number then
                raise Order_Number_Error;
            end if;
            if Key /= To_String (Ascending_Vector (Number).Key) or
               Val /= Ascending_Vector (Number).Val then
                raise Value_Error;
            end if;
        end Compare_Value;

        procedure Stop_At_Number (Key : in String;
                                  Val : in Value_Type;
                                  Order_Number : in Positive;
                                  Continue : in out Boolean) is
        begin
            if Order_Number = Number then
                Continue := False;
            elsif Order_Number > Number then
                raise Stop_Error;
            end if;
        end Stop_At_Number;

        procedure Stop_At_Number_Value (Key : in String;
                                        Val : in out Value_Type;
                                        Order_Number : in Positive;
                                        Continue : in out Boolean) is
        begin
            if Order_Number = Number then
                Continue := False;
            elsif Order_Number > Number then
                raise Stop_Error;
            end if;
        end Stop_At_Number_Value;

    begin
        declare
            procedure Traverse_Asc is new Traverse_Asc_G (Compare);
        begin
            Number := 0;
            Traverse_Asc (Table);
        exception
            when Order_Number_Error =>
                Display_Error_Location (Step, 5);
            when Value_Error =>
                Display_Error_Location (Step, 10);
        end;

        declare
            procedure Traverse_Asc is new Traverse_Asc_G (Stop_At_Number);
        begin
            Number := 1;
            Traverse_Asc (Table);
            Number := (Last + 1) / 2;
            Traverse_Asc (Table);
            Number := Last - 1;
            if Number > 0 then
                Traverse_Asc (Table);
            end if;
            Number := Last;
            Traverse_Asc (Table);
        exception
            when Stop_Error =>
                Display_Error_Location (Step, 15);
        end;

        declare
            procedure Traverse_Asc is
               new Traverse_Asc_And_Update_Value_G (Compare_Value);
        begin
            Number := 0;
            Traverse_Asc (Table);
        exception
            when Order_Number_Error =>
                Display_Error_Location (Step, 20);
            when Value_Error =>
                Display_Error_Location (Step, 25);
        end;

        declare
            procedure Traverse_Asc is
               new Traverse_Asc_And_Update_Value_G (Stop_At_Number_Value);
        begin
            Number := 1;
            Traverse_Asc (Table);
            Number := (Last + 1) / 2;
            Traverse_Asc (Table);
            Number := Last - 1;
            if Number > 0 then
                Traverse_Asc (Table);
            end if;
            Number := Last;
            Traverse_Asc (Table);
        exception
            when Stop_Error =>
                Display_Error_Location (Step, 30);
        end;

    exception
        when others =>
            Display_Error_Location (Step, 50);
            -- Presence of an undefined error!
    end Check_Asc_Traversal;

-------------------------------------------------------------------------------

    procedure Check_Desc_Traversal (Table : in out Table_Type;
                                    Last : in Natural;
                                    Descending_Vector : in Vector_Type) is
        -- Check procedures
        --                  TRAVERSE_DESC_AND_UPDATE_VALUE_G
        --                  TRAVERSE_DESC_G.
        Number : Natural;
        Order_Number_Error, Value_Error, Stop_Error : exception;

        procedure Compare (Key : in String;
                           Val : in Value_Type;
                           Order_Number : in Positive;
                           Continue : in out Boolean) is
        begin
            Number := Number + 1;
            if Number /= Order_Number then
                raise Order_Number_Error;
            end if;
            if Key /= To_String (Descending_Vector (Number).Key) or
               Val /= Descending_Vector (Number).Val then
                raise Value_Error;
            end if;
        end Compare;

        procedure Compare_Value (Key : in String;
                                 Val : in out Value_Type;
                                 Order_Number : in Positive;
                                 Continue : in out Boolean) is
        begin
            Number := Number + 1;
            if Number /= Order_Number then
                raise Order_Number_Error;
            end if;
            if Key /= To_String (Descending_Vector (Number).Key) or
               Val /= Descending_Vector (Number).Val then
                raise Value_Error;
            end if;
        end Compare_Value;

        procedure Stop_At_Number (Key : in String;
                                  Val : in Value_Type;
                                  Order_Number : in Positive;
                                  Continue : in out Boolean) is
        begin
            if Order_Number = Number then
                Continue := False;
            elsif Order_Number > Number then
                raise Stop_Error;
            end if;
        end Stop_At_Number;

        procedure Stop_At_Number_Value (Key : in String;
                                        Val : in out Value_Type;
                                        Order_Number : in Positive;
                                        Continue : in out Boolean) is
        begin
            if Order_Number = Number then
                Continue := False;
            elsif Order_Number > Number then
                raise Stop_Error;
            end if;
        end Stop_At_Number_Value;

    begin
        declare
            procedure Traverse_Desc is new Traverse_Desc_G (Compare);
        begin
            Number := 0;
            Traverse_Desc (Table);
        exception
            when Order_Number_Error =>
                Display_Error_Location (Step, 40);
            when Value_Error =>
                Display_Error_Location (Step, 45);
        end;

        declare
            procedure Traverse_Desc is new Traverse_Desc_G (Stop_At_Number);
        begin
            Number := 1;
            Traverse_Desc (Table);
            Number := (Last + 1) / 2;
            Traverse_Desc (Table);
            Number := Last - 1;
            if Number > 0 then
                Traverse_Desc (Table);
            end if;
            Number := Last;
            Traverse_Desc (Table);
        exception
            when Stop_Error =>
                Display_Error_Location (Step, 50);
        end;

        declare
            procedure Traverse_Desc is
               new Traverse_Desc_And_Update_Value_G (Compare_Value);
        begin
            Number := 0;
            Traverse_Desc (Table);
        exception
            when Order_Number_Error =>
                Display_Error_Location (Step, 55);
            when Value_Error =>
                Display_Error_Location (Step, 60);
        end;

        declare
            procedure Traverse_Desc is
               new Traverse_Desc_And_Update_Value_G (Stop_At_Number_Value);
        begin
            Number := 1;
            Traverse_Desc (Table);
            Number := (Last + 1) / 2;
            Traverse_Desc (Table);
            Number := Last - 1;
            if Number > 0 then
                Traverse_Desc (Table);
            end if;
            Number := Last;
            Traverse_Desc (Table);
        exception
            when Stop_Error =>
                Display_Error_Location (Step, 65);
        end;

    exception
        when others =>
            Display_Error_Location (Step, 70);
            -- Presence of an undefined error!
    end Check_Desc_Traversal;

-------------------------------------------------------------------------------

    procedure Check_Disorder_Traversal (Structure : in out Table_Type) is

        -- Check procedures
        --                  DISORDER_TRAVERSE_G
        --                  TRAVERSE_AND_UPDATE_VALUE_G.

        procedure Act (Key : in String;
                       Val : in Value_Type;
                       Order_Number : in Positive;
                       Continue : in out Boolean) is
        begin
            if not Is_Present (Structure, Key) or
               Order_Number > Size (Structure) then
                Continue := False;
                Display_Error_Location (Step, 5);
            end if;
        end Act;

        procedure Modif_Val (Key : in String;
                             Val : in out Value_Type;
                             Order_Number : in Positive;
                             Continue : in out Boolean) is
            Temp_Val : Value_Type;
        begin
            Assign (Temp_Val, Val);
            Assign (Val, Temp_Val);
        end Modif_Val;

        procedure Disorder_Traverse is new Disorder_Traverse_G (Act);
        procedure Disorder_Traverse_Update_Val is
           new Disorder_Traverse_And_Update_Value_G (Modif_Val);
    begin
        begin
            Disorder_Traverse (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 10);
        end;
        begin
            Disorder_Traverse_Update_Val (Structure);
        exception
            when others =>
                Display_Error_Location (Step, 15);
        end;
    end Check_Disorder_Traversal;

-------------------------------------------------------------------------------

    procedure Preliminary_Tests is
        -- Preliminary verification of each exported procedure.
        Source, Dest, Structure : Table_Type;
        Found, Duplicate_Item : Boolean;
    begin
        --/ SIZE test
        for I in Vector'Range loop
            Insert (Structure, To_String (Vector (I).Key), Vector (I).Val);
            if Size (Structure) /= I then
                Display_Error_Location (Step, 5);
                exit;
            end if;
        end loop;
        for I in Vector'Range loop
            Remove_Max (Structure);
            if Size (Structure) /= Vector_Size - I then
                Display_Error_Location (Step, 10);
                exit;
            end if;
        end loop;
        Initialize (Structure, Vector_Size);
        for I in Vector'Range loop
            Remove_Min (Structure);
            if Size (Structure) /= Vector_Size - I then
                Display_Error_Location (Step, 15);
                exit;
            end if;
        end loop;
        --/ DESTROY test
        Initialize (Structure, Vector_Size);
        Destroy (Structure);
        if Size (Structure) /= 0 then
            Display_Error_Location (Step, 20);
        end if;
        --/ REMOVE tests
        Initialize (Structure, Vector_Size);
        for I in 1 .. Vector_Size loop
            Get_Max_Item (Structure, Key_Out, Last, Val);
            if Key_Out (1 .. Last) /=
               To_String (Ascending_Vector (Vector_Size + 1 - I).Key) or
               Val /= Ascending_Vector (Vector_Size + 1 - I).Val then
                Display_Error_Location (Step, 35);
                exit;
            end if;
            if Max_Key (Structure) /=
               To_String (Ascending_Vector (Vector_Size + 1 - I).Key) then
                Display_Error_Location (Step, 40);
                exit;
            end if;
            Remove_Max (Structure);
            if Size (Structure) /= Vector_Size - I then
                Display_Error_Location (Step, 45);
                exit;
            end if;
        end loop;
        Initialize (Structure, Vector_Size);
        for I in 1 .. Vector_Size loop
            Get_Min_Key (Structure, Key_Out, Last);
            if Key_Out (1 .. Last) /= To_String (Ascending_Vector (I).Key) then
                Display_Error_Location (Step, 50);
                exit;
            end if;
            if Min_Key (Structure) /= To_String (Ascending_Vector (I).Key) then
                Display_Error_Location (Step, 55);
                exit;
            end if;
            Remove_Min (Structure);
            if Size (Structure) /= Vector_Size - I then
                Display_Error_Location (Step, 60);
                exit;
            end if;
        end loop;
        Initialize (Structure, Vector_Size);
        for I in 1 .. Vector_Size loop
            Get_Min_Item (Structure, Key_Out, Last, Val);
            if Key_Out (1 .. Last) /= To_String (Ascending_Vector (I).Key) or
               Val /= Ascending_Vector (I).Val then
                Display_Error_Location (Step, 61);
                exit;
            end if;
            Remove_Min (Structure);
            if Size (Structure) /= Vector_Size - I then
                Display_Error_Location (Step, 62);
                exit;
            end if;
        end loop;
        Initialize (Structure, Vector_Size);
        for I in 1 .. Vector_Size loop
            Remove (Structure, To_String (Vector (I).Key));
            if Size (Structure) /= Vector_Size - I then
                Display_Error_Location (Step, 65);
                exit;
            end if;
        end loop;
        Initialize (Structure, Vector_Size);
        for I in 1 .. Vector_Size loop
            Remove (Structure, To_String (Vector (I).Key), Found);
            if Size (Structure) /= Vector_Size - I or not Found then
                Display_Error_Location (Step, 70);
                exit;
            end if;
        end loop;
        --/ ASSIGN TEST
        Initialize (Source, Vector_Size);
        Assign (Dest, Source);
        if Dest /= Source then
            Display_Error_Location (Step, 75);
        end if;
        if Dest < Source then
            Display_Error_Location (Step, 80);
        end if;
        if Dest > Source then
            Display_Error_Location (Step, 85);
        end if;
        if not (Dest >= Source) then
            Display_Error_Location (Step, 90);
        end if;
        if not (Dest <= Source) then
            Display_Error_Location (Step, 95);
        end if;
        --/ GET_... tests
        Initialize (Structure, Vector_Size);
        Get_Max_Key (Structure, Key_Out, Last);
        if Key_Out (1 .. Last) /= To_String
                                     (Ascending_Vector (Vector_Size).Key) then
            Display_Error_Location (Step, 100);
        end if;
        Get_Max_Item (Structure, Key_Out, Last, Val);
        if Key_Out (1 .. Last) /= To_String
                                     (Ascending_Vector (Vector_Size).Key) or
           Val /= Ascending_Vector (Vector_Size).Val then
            Display_Error_Location (Step, 101);
        end if;
        Get_Min_Key (Structure, Key_Out, Last);
        if Key_Out (1 .. Last) /= To_String (Ascending_Vector (1).Key) then
            Display_Error_Location (Step, 105);
        end if;
        Get_Min_Item (Structure, Key_Out, Last, Val);
        if Key_Out (1 .. Last) /= To_String (Ascending_Vector (1).Key) or
           Val /= Ascending_Vector (1).Val then
            Display_Error_Location (Step, 106);
        end if;
        Assign (Key_In, Ascending_Vector (Vector_Size / 2).Key);
        Get_Value (Structure, To_String (Key_In), Val);
        if Val /= Ascending_Vector (Vector_Size / 2).Val then
            Display_Error_Location (Step, 111);
        end if;
        --/ "=", "<", ">", ">=", "<=" tests
        Initialize (Source, Vector_Size);
        Initialize (Dest, Vector_Size);
        if Source /= Dest then
            Display_Error_Location (Step, 120);
        end if;
        if Source < Dest then
            Display_Error_Location (Step, 125);
        end if;
        if Source > Dest then
            Display_Error_Location (Step, 130);
        end if;
        if not (Source >= Dest) then
            Display_Error_Location (Step, 135);
        end if;
        if not (Source <= Dest) then
            Display_Error_Location (Step, 140);
        end if;
        --/ IS_PRESENT tests
        if not Is_Present
                  (Structure, To_String
                                 (Ascending_Vector (Vector_Size / 2).Key)) then
            Display_Error_Location (Step, 150);
        end if;
        --/ REPLACE, INSERT_OR_REPLACE tests.
        Initialize (Structure, Vector_Size - 1);
        Assign (Key_In, Vector (Vector'Last).Key);
        Assign (Val, Vector (Vector'Last).Val);
        Replace_Value (Structure, To_String (Key_In), Val, Found);
        if Found then
            Display_Error_Location (Step, 155);
        end if;
        Insert_Or_Replace_Value (Structure, To_String (Key_In), Val);
        if Size (Structure) /= Vector_Size then
            Display_Error_Location (Step, 160);
        end if;
        Replace_Value (Structure, To_String (Key_In), Val, Found);
        if not Found then
            Display_Error_Location (Step, 170);
        end if;
        Remove (Structure, To_String (Key_In));
        if Is_Present (Structure, To_String (Key_In)) then
            Display_Error_Location (Step, 180);
        end if;
        Insert (Structure, To_String (Key_In), Val, Duplicate_Item);
        if Duplicate_Item then
            Display_Error_Location (Step, 195);
        end if;
        Insert (Structure, To_String (Key_In), Val, Duplicate_Item);
        if not Duplicate_Item then
            Display_Error_Location (Step, 200);
        end if;
        Assign (Val2, Value (Structure, To_String (Key_In)));
        if Val2 /= Vector (Vector'Last).Val then
            Display_Error_Location (Step, 205);
        end if;
        Get_Value (Structure, To_String (Key_In), Val);
        if Val /= Vector (Vector'Last).Val then
            Display_Error_Location (Step, 206);
        end if;
        if Size (Structure) /= Vector_Size then
            Display_Error_Location (Step, 210);
        end if;
        Destroy (Structure);
        Insert (Structure, To_String (Key_In), Val, Duplicate_Item);
        if Duplicate_Item then
            Display_Error_Location (Step, 215);
        end if;
        Remove (Structure, To_String (Key_In));
        Replace_Value (Structure, To_String (Key_In), Val, Found);
        if Found then
            Display_Error_Location (Step, 220);
        end if;
        Insert_Or_Replace_Value (Structure, To_String (Key_In), Val);
        if Size (Structure) /= 1 then
            Display_Error_Location (Step, 225);
        end if;
        Replace_Value (Structure, To_String (Key_In), Val);
        if Size (Structure) /= 1 then
            Display_Error_Location (Step, 235);
        end if;

        --/ tests of ITERATORS
        declare
            Compare_Error : exception;
            procedure Compare_Each (Key : in String;
                                    Val : in Value_Type;
                                    Order_Number : in Positive;
                                    Continue : in out Boolean) is
                -- Compares the current element of the TABLE with corresponding
                -- element of the ASCENDING_VECTOR.
            begin
                if Key /= To_String (Ascending_Vector (Order_Number).Key) or
                   Val /= Ascending_Vector (Order_Number).Val then
                    raise Compare_Error;
                end if;
            end Compare_Each;
            procedure Traverse_Asc_Test is new Traverse_Asc_G (Compare_Each);
        begin
            Initialize (Structure, Vector_Size);
            Traverse_Asc_Test (Structure);
        exception
            when Compare_Error =>
                Display_Error_Location (Step, 240);
        end;
        declare
            Compare_Error : exception;
            procedure Compare_Each (Key : in String;
                                    Val : in Value_Type;
                                    Order_Number : in Positive;
                                    Continue : in out Boolean) is
                -- Compares the current element of the TABLE with corresponding
                -- element of the DESCENDING_VECTOR.
            begin
                if Key /= To_String (Descending_Vector (Order_Number).Key) or
                   Val /= Descending_Vector (Order_Number).Val then
                    raise Compare_Error;
                end if;
            end Compare_Each;
            procedure Traverse_Desc_Test is new Traverse_Desc_G (Compare_Each);
        begin
            Initialize (Structure, Vector_Size);
            Traverse_Desc_Test (Structure);
        exception
            when Compare_Error =>
                Display_Error_Location (Step, 245);
        end;
    exception
        when others =>
            Display_Error_Location (Step, 250);
            -- Presence of an undefined error!
    end Preliminary_Tests;

-------------------------------------------------------------------------------

    procedure Check_Exceptions is

        Structure : Table_Type;
    begin
        --/ EMPTY_STRUCTURE_ERROR tests:
        Initialize (Structure, Vector_Size);
        Destroy (Structure);
        begin
            Remove_Max (Structure);
            Display_Error_Location (Step, 5); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Remove_Min (Structure);
            Display_Error_Location (Step, 15); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Min_Key (Structure, Key_Out, Last);
            Display_Error_Location (Step, 25); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Min_Item (Structure, Key_Out, Last, Val);
            Display_Error_Location (Step, 26); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Assign (Key_Out, Min_Key (Structure));
            Display_Error_Location (Step, 30); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Max_Key (Structure, Key_Out, Last);
            Display_Error_Location (Step, 35); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Assign (Key_Out, Max_Key (Structure));
            Display_Error_Location (Step, 40); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        Insert (Structure, To_String (Ascending_Vector (1).Key),
                Ascending_Vector (1).Val);
        Remove_Min (Structure);
        begin
            Remove_Max (Structure);
            Display_Error_Location (Step, 45); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Remove_Min (Structure);
            Display_Error_Location (Step, 55); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Min_Key (Structure, Key_Out, Last);
            Display_Error_Location (Step, 65); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Min_Item (Structure, Key_Out, Last, Val);
            Display_Error_Location (Step, 66); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Max_Key (Structure, Key_Out, Last);
            Display_Error_Location (Step, 70); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        begin
            Get_Max_Item (Structure, Key_Out, Last, Val);
            Display_Error_Location (Step, 70); -- exception not raised
        exception
            when Empty_Structure_Error =>
                null;
        end;
        --/ MISSING_ITEM_ERROR tests
        Destroy (Structure);
        Assign (Key_In, Vector (1).Key);
        Assign (Val, Vector (1).Val);
        begin
            Replace_Value (Structure, To_String (Key_In), Val);
            Display_Error_Location (Step, 165);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Remove (Structure, To_String (Key_In));
            Display_Error_Location (Step, 170);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Remove (Structure, To_String (Key_In), Val);
            Display_Error_Location (Step, 171);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Initialize (Structure, Vector_Size - 1);
        Assign (Key_In, Vector (Vector_Size).Key);
        Assign (Val, Vector (Vector_Size).Val);
        begin
            Replace_Value (Structure, To_String (Key_In), Val);
            Display_Error_Location (Step, 175);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Remove (Structure, To_String (Key_In));
            Display_Error_Location (Step, 180);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Remove (Structure, To_String (Key_In), Val);
            Display_Error_Location (Step, 181);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Destroy (Structure);
        Initialize (Structure, 1);
        begin
            Remove (Structure, To_String (Key_In));
            Display_Error_Location (Step, 185);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Remove (Structure, To_String (Key_In), Val);
            Display_Error_Location (Step, 186);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Destroy (Structure);
        declare
            procedure Modify_Value (Key : String; Val : in out Value_Type) is
            begin
                Assign (Val, Vector (Vector_Size).Val);
            end Modify_Value;
            procedure Update_Except_Value is
               new Update_Value_Or_Exception_G (Modify_Value);
        begin
            Update_Except_Value (Structure, To_String (Key_In));
            Display_Error_Location (Step, 190);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Initialize (Structure, Vector_Size - 1);
        Assign (Key_In, Vector (Vector_Size).Key);
        begin
            Assign (Val2, Value (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 202);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Value (Structure, To_String (Key_In), Val);
            Display_Error_Location (Step, 203);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Destroy (Structure);
        Insert (Structure, To_String (Ascending_Vector (Vector'Last).Key),
                Ascending_Vector (Vector'Last).Val);
        begin
            Assign (Key_In, Ascending_Vector (Vector'First).Key);
            Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 205);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Assign (Key_In, Ascending_Vector (Vector'First).Key);
            Get_Less_Item (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 206);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Assign (Key_In, Ascending_Vector (Vector'Last).Key);
            Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 207);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Assign (Key_In, Ascending_Vector (Vector'Last).Key);
            Get_Less_Item (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 208);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Assign (Key_In, Ascending_Vector (Vector'First).Key);
        begin
            Assign (Key_Out, Less_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 220);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Item (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 221);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Assign (Key_In, Ascending_Vector (Vector'First).Key);
        begin
            Assign (Key_Out, Less_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 225);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Item (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 226);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Initialize (Structure, Vector_Size);
        Get_Min_Item (Structure, Key_Out, Last, Val);
        begin
            Assign (Key_Out, Less_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 230);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Item (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 231);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 235);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Remove_Min (Structure);
        begin
            Assign (Key_Out, Less_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 240);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 245);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Item (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 246);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Destroy (Structure);
        Insert (Structure, To_String (Ascending_Vector (Vector'Last).Key),
                Ascending_Vector (Vector'Last).Val);
        Assign (Key_In, Ascending_Vector (Vector'First).Key);
        begin
            Assign (Key_Out, Less_Or_Equal_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 250);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Or_Equal_Key
               (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 255);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Or_Equal_Item
               (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 256);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Initialize (Structure, Vector_Size);
        Get_Min_Item (Structure, Key_Out, Last, Val);
        Remove_Min (Structure);
        begin
            Assign (Key_Out, Less_Or_Equal_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 260);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Or_Equal_Key
               (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 265);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Less_Or_Equal_Item
               (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 266);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Destroy (Structure);
        Insert (Structure, To_String (Ascending_Vector (Vector'First).Key),
                Ascending_Vector (Vector'First).Val);
        Assign (Key_In, Ascending_Vector (Vector'First).Key);
        begin
            Assign (Key_Out, Greater_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 270);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 275);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Item (Structure, To_String (Key_In),
                              Key_Out, Last, Val);
            Display_Error_Location (Step, 276);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Assign (Key_In, Ascending_Vector (Vector'Last).Key);
        begin
            Assign (Key_Out, Greater_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 280);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 285);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Item (Structure, To_String (Key_In),
                              Key_Out, Last, Val);
            Display_Error_Location (Step, 285);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Initialize (Structure, Vector_Size);
        Get_Max_Item (Structure, Key_Out, Last, Val);
        Remove_Min (Structure);
        begin
            Assign (Key_Out, Greater_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 290);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 295);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Item (Structure, To_String (Key_In),
                              Key_Out, Last, Val);
            Display_Error_Location (Step, 296);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Remove_Max (Structure);
        begin
            Assign (Key_Out, Greater_Key (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 300);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Key (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 305);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Item (Structure, To_String (Key_In),
                              Key_Out, Last, Val);
            Display_Error_Location (Step, 306);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Destroy (Structure);
        Insert (Structure, To_String (Ascending_Vector (Vector'First).Key),
                Ascending_Vector (Vector'First).Val);
        Assign (Key_In, Ascending_Vector (Vector'Last).Key);
        begin
            Assign (Key_Out, Greater_Or_Equal_Key
                                (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 310);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Or_Equal_Key
               (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 315);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Or_Equal_Item
               (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 316);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        Initialize (Structure, Vector_Size);
        Get_Max_Item (Structure, Key_Out, Last, Val);
        Remove_Max (Structure);
        begin
            Assign (Key_Out, Greater_Or_Equal_Key
                                (Structure, To_String (Key_In)));
            Display_Error_Location (Step, 320);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Or_Equal_Key
               (Structure, To_String (Key_In), Key_Out, Last);
            Display_Error_Location (Step, 325);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        begin
            Get_Greater_Or_Equal_Item
               (Structure, To_String (Key_In), Key_Out, Last, Val);
            Display_Error_Location (Step, 326);-- exception not raised
        exception
            when Missing_Item_Error =>
                null;
        end;
        --/ DUPLICATE_ITEM_ERROR tests
        Initialize (Structure, Vector_Size);
        Assign (Key_In, Vector (Vector'First).Key);
        Assign (Val, Vector (Vector'First).Val);
        begin
            Insert (Structure, To_String (Key_In), Val);
            Display_Error_Location (Step, 330);-- exception not raised
        exception
            when Duplicate_Item_Error =>
                null;
        end;
        --/ STRING_CONSTRAINT_ERROR tests
        declare
            Too_Short : String (1 .. 1);
        begin
            Initialize (Structure, Vector_Size);
            begin
                Get_Max_Item (Structure, Too_Short, Last, Val);
                Display_Error_Location (Step, 335);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Get_Min_Item (Structure, Too_Short, Last, Val);
                Display_Error_Location (Step, 340);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Get_Min_Key (Structure, Too_Short, Last);
                Display_Error_Location (Step, 345);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Get_Max_Key (Structure, Too_Short, Last);
                Display_Error_Location (Step, 350);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last).Key);
                Get_Less_Item (Structure, To_String (Key_In),
                               Too_Short, Last, Val);
                Display_Error_Location (Step, 355);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last).Key);
                Get_Less_Or_Equal_Item
                   (Structure, To_String (Key_In), Too_Short, Last, Val);
                Display_Error_Location (Step, 360);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last - 1).Key);
                Get_Greater_Item (Structure, To_String (Key_In),
                                  Too_Short, Last, Val);
                Display_Error_Location (Step, 365);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last).Key);
                Get_Greater_Or_Equal_Item
                   (Structure, To_String (Key_In), Too_Short, Last, Val);
                Display_Error_Location (Step, 370);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last).Key);
                Get_Less_Key (Structure, To_String (Key_In), Too_Short, Last);
                Display_Error_Location (Step, 375);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last).Key);
                Get_Less_Or_Equal_Key
                   (Structure, To_String (Key_In), Too_Short, Last);
                Display_Error_Location (Step, 380);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last - 1).Key);
                Get_Greater_Key (Structure, To_String (Key_In),
                                 Too_Short, Last);
                Display_Error_Location (Step, 385);
            exception
                when String_Constraint_Error =>
                    null;
            end;
            begin
                Assign (Key_In, Ascending_Vector (Vector'Last).Key);
                Get_Greater_Or_Equal_Key
                   (Structure, To_String (Key_In), Too_Short, Last);
                Display_Error_Location (Step, 390);
            exception
                when String_Constraint_Error =>
                    null;
            end;
        end;
    exception
        when others =>
            Display_Error_Location (Step, 395);
    end Check_Exceptions;

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------


--/ MAIN TEST PROCEDURE:
begin
    Put ("Tests for TABLE_OF_STRING_AND_DYNAMIC_VALUES_G...");
    New_Line;
    Generate_Descending (Descending_Vector);
    Generate_Ascending (Ascending_Vector);
    Generate (Vector);
    Generate2 (Vector2);
    for Pass in 1 .. 3 loop
        -- Repeat tests for different VALUEs of MAX_FREE_LIST_SIZE.
        -- If PASS = 1 then MAX_FREE_LIST_SIZE = 0 by default.
        if Pass = 2 then
            Release_Free_List;
            Set_Max_Free_List_Size (Vector_Size / 2);
            Actual_Max_Free_List_Size := Vector_Size / 2;
        elsif Pass = 3 then
            Release_Free_List;
            Set_Max_Free_List_Size (Vector_Size);
            Actual_Max_Free_List_Size := Vector_Size;
        end if;

        declare
            Structure, Dest, Source : Table_Type;
            -- tables involved in tests.
        begin

            --/ TESTS FOR EXCEPTIONS, CONSTRUCTORS, QUERIES AND ITERATORS:

            --/ A declared object must be empty:
            Step := 1;
            Check_Empty_Structure (Structure);
            if Error then
                raise Test_Error;
            end if;

            --/ Check between two declared objects who must be empty:
            Step := 2;
            Check_Between_Two_Empty_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ Basic tests of operations
            Step := 3;
            Preliminary_Tests;
            if Error then
                raise Test_Error;
            end if;

            --/ Basic test of exceptions
            Step := 4;
            Check_Exceptions;
            if Error then
                raise Test_Error;
            end if;

            --/ Particular situations tests:
            --/ Check unary operations on the TABLE of size 1:
            Step := 5;
            Destroy (Structure);
            Insert (Structure, To_String (Ascending_Vector (1).Key),
                    Ascending_Vector (1).Val);
            Check_Unary_Operations (1, Ascending_Vector (1).Key,
                                    Ascending_Vector (1).Key,
                                    Ascending_Vector (1).Val,
                                    Ascending_Vector (1).Val, Structure);
            if Error then
                raise Test_Error;
            end if;

            --/Check unary operations on the TABLE of size VECTOR_SIZE:
            Step := 6;
            Initialize (Structure, Vector_Size);
            Check_Unary_Operations
               (Vector_Size, Ascending_Vector (1).Key,
                Ascending_Vector (Vector_Size).Key, Ascending_Vector (1).Val,
                Ascending_Vector (Vector_Size).Val, Structure);
            if Error then
                raise Test_Error;
            end if;

            --/ A TABLE must be empty: check of an empty structure:
            Step := 7;
            Check_Empty_Structure (Structure);
            if Error then
                raise Test_Error;
            end if;

            --/ Successives INSERTs and REMOVEs must leave the TABLE empty:
            Step := 8;
            Initialize (Structure, Vector_Size);      -- INSERT(STRUCTURE...);
            for I in 1 .. Vector_Size / 2 loop
                Remove_Min (Structure);
                Remove_Max (Structure);
            end loop;
            Check_Empty_Structure (Structure);
            if Error then
                raise Test_Error;
            end if;

            --/ Destroy must leave the TABLE empty:
            Step := 9;
            Initialize (Structure, Vector_Size);
            Destroy (Structure);
            Check_Empty_Structure (Structure);
            if Error then
                raise Test_Error;
            end if;

            --/ Check of equal structures:
            Step := 10;
            Initialize (Source, Vector_Size);
            Initialize (Dest, Vector_Size);
            Assign (Key_In, Vector (1).Key);
            Assign (Val, Vector (1).Val);
            Remove (Source, To_String (Key_In));
            Insert (Source, To_String (Key_In), Val);
            Check_Equal_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ Check of two empty structures:
            Step := 11;
            Destroy (Source);
            Destroy (Dest);
            Check_Between_Two_Empty_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ Check of not equal structures:
            --/ different number of elements.
            Step := 12;
            Initialize (Source, Vector_Size);
            Initialize (Dest, Vector_Size);
            Remove_Min (Dest);
            Check_Not_Equal_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ Check of not equal structures:
            --/ same number of elements; greatest element is different.
            Step := 13;
            Initialize (Source, Vector_Size);
            Initialize (Dest, Vector_Size);
            Remove (Source, To_String (Ascending_Vector (Vector_Size - 1).Key));
            Remove (Dest, To_String (Ascending_Vector (Vector_Size).Key));
            Check_Not_Equal_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ Check of not equal structures:
            --/ same number of elements; intermediate element is different.
            Step := 14;
            Initialize (Source, Vector_Size);
            Initialize (Dest, Vector_Size);
            Remove (Source, To_String
                               (Ascending_Vector (Vector_Size / 2 - 1).Key));
            Remove (Dest, To_String (Ascending_Vector (Vector_Size / 2).Key));
            Check_Not_Equal_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ Check of not equal structures;
            --/ same number of elements; smallest element is different.
            Step := 15;
            Initialize (Source, Vector_Size);
            Initialize (Dest, Vector_Size);
            Remove_Min (Source);
            Remove (Dest, To_String (Ascending_Vector (2).Key));
            Check_Not_Equal_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ Check of not equal structures;
            --/ DEST is empty;
            Step := 16;
            Initialize (Source, Vector_Size);
            Initialize (Dest, Vector_Size);
            Destroy (Dest);
            Check_Not_Equal_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ Check of not equal structures;
            --/ SOURCE is empty;
            Step := 17;
            Initialize (Source, Vector_Size);
            Initialize (Dest, Vector_Size);
            Destroy (Source);
            Check_Not_Equal_Structures (Dest, Source);
            if Error then
                raise Test_Error;
            end if;

            --/ check of set operations;
            Step := 18;
            Check_Set_Operations;
            if Error then
                raise Test_Error;
            end if;

            --/ Check traversal; 1 elements in the TABLE.
            Step := 19;
            Destroy (Structure);
            Insert (Structure, To_String (Ascending_Vector (1).Key),
                    Ascending_Vector (1).Val);
            Check_Asc_Traversal (Structure, 1, Ascending_Vector);
            if Error then
                raise Test_Error;
            end if;

            --/ Check traversal; All elements in the TABLE.
            Step := 20;
            Initialize (Structure, Vector_Size);
            Check_Asc_Traversal (Structure, Vector_Size, Ascending_Vector);
            if Error then
                raise Test_Error;
            end if;
            Destroy (Structure);
            Destroy (Source);
            Destroy (Dest);

            --/ Check traversal; 1 elements in the TABLE.
            Step := 21;
            Destroy (Structure);
            Insert (Structure, To_String (Descending_Vector (1).Key),
                    Descending_Vector (1).Val);
            Check_Desc_Traversal (Structure, 1, Descending_Vector);
            if Error then
                raise Test_Error;
            end if;

            --/ Check traversal; All elements in the TABLE.
            Step := 22;
            Initialize (Structure, Vector_Size);
            Check_Desc_Traversal (Structure, Vector_Size, Descending_Vector);
            if Error then
                raise Test_Error;
            end if;

            --/ check disorder traversal, TABLE is empty.
            Step := 23;
            Destroy (Structure);
            Check_Disorder_Traversal (Structure);
            if Error then
                raise Test_Error;
            end if;

            --/ check disorder traversal, 1 element in the TABLE.
            Step := 24;
            Insert (Structure, To_String (Vector (Vector'First).Key),
                    Vector (Vector'First).Val);
            Check_Disorder_Traversal (Structure);
            if Error then
                raise Test_Error;
            end if;

            --/ check disorder traversal, all elements in the TABLE.
            Step := 25;
            Initialize (Structure, Vector_Size);
            Check_Disorder_Traversal (Structure);
            if Error then
                raise Test_Error;
            end if;

            Destroy (Structure);
            Destroy (Source);
            Destroy (Dest);

        end;
    end loop;

    --/HEAP MANAGEMENT TESTS:

    declare
        Structure, Dest, Source : Table_Type;
        -- tables involved in tests.
    begin
        Initialize (Structure, Vector_Size);
        Release_Free_List;
        Set_Max_Free_List_Size (Vector_Size);
        Actual_Max_Free_List_Size := Vector_Size;

        --/ Free list management tests on INSERT/REMOVE:
        Step := 26;
        declare
            Free_List_Size_Error : exception;
        begin
            for I in 1 .. Vector_Size loop
                Remove_Min (Structure);
                if Free_List_Size /= I then
                    raise Free_List_Size_Error;
                end if;
            end loop;
        exception
            when Free_List_Size_Error =>
                Display_Error_Location (Step, 5);
        end;
        declare
            Free_List_Size_Error : exception;
        begin
            for I in 1 .. Vector_Size loop
                Insert (Structure, To_String (Ascending_Vector (I).Key),
                        Ascending_Vector (I).Val);
                if Free_List_Size /= Vector_Size - I then
                    raise Free_List_Size_Error;
                end if;
            end loop;
        exception
            when Free_List_Size_Error =>
                Display_Error_Location (Step, 10);
        end;
        if Error then
            raise Test_Error;
        end if;

        --/ SET_MAX_FREE_LIST test:
        Step := 27;
        Set_Max_Free_List_Size (Vector_Size / 2);
        Actual_Max_Free_List_Size := Vector_Size / 2;
        declare
            Free_List_Size_Error : exception;
        begin
            for I in 1 .. Vector_Size / 2 loop
                Remove_Min (Structure);
                if Free_List_Size /= I then
                    raise Free_List_Size_Error;
                end if;
            end loop;
        exception
            when Free_List_Size_Error =>
                Display_Error_Location (Step, 5);
        end;
        declare
            Free_List_Size_Error : exception;
        begin
            while Size (Structure) /= 0 loop
                Remove_Min (Structure);
                if Free_List_Size /= Vector_Size / 2 then
                    raise Free_List_Size_Error;
                end if;
            end loop;
        exception
            when Free_List_Size_Error =>
                Display_Error_Location (Step, 10);
        end;
        Insert (Structure, To_String (Ascending_Vector (1).Key),
                Ascending_Vector (1).Val);
        if Free_List_Size /= Vector_Size / 2 - 1 then
            Display_Error_Location (Step, 15);
        end if;
        if Error then
            raise Test_Error;
        end if;

        --/ RELEASE_FREE_LIST test:
        Step := 28;
        Set_Max_Free_List_Size (Vector_Size);
        Actual_Max_Free_List_Size := Vector_Size;
        Initialize (Structure, Vector_Size);
        for I in 1 .. Vector_Size loop
            Remove_Min (Structure);
        end loop;
        if Free_List_Size /= Vector_Size then
            Display_Error_Location (Step, 5);
        end if;
        Release_Free_List;
        if Free_List_Size /= 0 then
            Display_Error_Location (Step, 10);
        end if;
        if Error then
            raise Test_Error;
        end if;

        --/ Free list management test on DESTROY:
        Step := 29;
        Initialize (Structure, Vector_Size);
        Destroy (Structure);
        if Free_List_Size /= Vector_Size then
            Display_Error_Location (Step, 5);
        end if;
        if Error then
            raise Test_Error;
        end if;

        --/ Free list management test on ASSIGN:
        Step := 30;
        Release_Free_List;
        Initialize (Source, Vector_Size - 10);
        Initialize (Dest, Vector_Size);
        Destroy (Dest);
        -- Free list contains VECTOR_SIZE elements.
        Assign (Dest, Source);
        -- DEST contains VECTOR_SIZE-10 elements
        -- Free list must contain 10 elements
        if Free_List_Size /= 10 then
            Display_Error_Location (Step, 5);
        end if;
        begin
            Destroy (Source);
            -- Free list contains VECTOR_SIZE elements.
            Assign (Dest, Source);
            -- Free list must contain VECTOR_SIZE elements
            if Free_List_Size /= Vector_Size then
                Display_Error_Location (Step, 10);
            end if;
        exception
            when others =>
                Display_Error_Location (Step, 15);
                -- presence of an undefined error!
        end;
        if Error then
            raise Test_Error;
        end if;
    end;

    Put_Line ("successfuly completed.");

exception
    when Test_Error =>
        Put_Line ("Test procedure cannot continue.");
end Table_Of_V_Strings_And_Dyn_Values_Test;