Natools

Diff
Login

Differences From Artifact [d6079ac7f7]:

To Artifact [a608e64af8]:


1
2
3
4
5
6
7
8
9
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté                                        --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --

|







1
2
3
4
5
6
7
8
9
------------------------------------------------------------------------------
-- Copyright (c) 2014-2017, Natacha Porté                                   --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
108
109
110
111
112
113
114

115
116
117
118
119
120
121
      Unsafe_Map_Roundtrip (Report);
      Ada_2012_Indexing (Report);
      Ada_2012_Iteration (Report);
      Ada_2012_Errors (Report);
      Range_Iterators (Report);
      Update_Constructors (Report);
      Update_Constructor_Exceptions (Report);

   end All_Tests;



   ----------------------
   -- Individual Tests --
   ----------------------







>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
      Unsafe_Map_Roundtrip (Report);
      Ada_2012_Indexing (Report);
      Ada_2012_Iteration (Report);
      Ada_2012_Errors (Report);
      Range_Iterators (Report);
      Update_Constructors (Report);
      Update_Constructor_Exceptions (Report);
      Rank (Report);
   end All_Tests;



   ----------------------
   -- Individual Tests --
   ----------------------
876
877
878
879
880
881
882








































883
884
885
886
887
888
889
         end loop;
         Test_Element (24);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Range_Iterators;










































   procedure Unsafe_Map_Roundtrip (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Constant_Map <-> Unsafe_Map roundtrip");
   begin
      declare
         use type Test_Maps.Unsafe_Maps.Map;








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
         end loop;
         Test_Element (24);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Range_Iterators;


   procedure Rank (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Rank function");
   begin
      declare
         Map : constant Test_Maps.Updatable_Map := Sample_Map;

         procedure Test_Rank
           (Cursor : in Test_Maps.Cursor;
            Expected : in Ada.Containers.Count_Type;
            Name : in String);

         procedure Test_Rank
           (Cursor : in Test_Maps.Cursor;
            Expected : in Ada.Containers.Count_Type;
            Name : in String)
         is
            use type Ada.Containers.Count_Type;

            Actual : constant Ada.Containers.Count_Type
              := Test_Maps.Rank (Cursor);
         begin
            if Actual /= Expected then
               Test.Fail ("Expected rank"
                 & Ada.Containers.Count_Type'Image (Expected)
                 & " for " & Name & ", found"
                 & Ada.Containers.Count_Type'Image (Actual));
            end if;
         end Test_Rank;
      begin
         Test_Rank (Test_Maps.No_Element, 0, "No_Element");
         Test_Rank (Map.First, 1, "Map.First");
         Test_Rank (Map.Last, 20, "Map.Last");
         Test_Rank (Test_Maps.Next (Map.First), 2, "Next (Map.First)");
         Test_Rank (Test_Maps.Next (Map.Last), 0, "Next (Map.Last)");
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Rank;


   procedure Unsafe_Map_Roundtrip (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Constant_Map <-> Unsafe_Map roundtrip");
   begin
      declare
         use type Test_Maps.Unsafe_Maps.Map;