Natools

Diff
Login

Differences From Artifact [6cf26c7206]:

To Artifact [09428966e6]:


104
105
106
107
108
109
110

111
112
113
114
115
116
117

   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Test_Conversions (Report);
      Test_Exceptions (Report);
      Test_Interval_Arithmetic (Report);
      Test_Navigation (Report);

      Test_Tokenization (Report);
   end All_Tests;



   ----------------------
   -- Individual tests --







>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Test_Conversions (Report);
      Test_Exceptions (Report);
      Test_Interval_Arithmetic (Report);
      Test_Navigation (Report);
      Test_Slices (Report);
      Test_Tokenization (Report);
   end All_Tests;



   ----------------------
   -- Individual tests --
868
869
870
871
872
873
874

































875
876
877
878
879
880
881
      end;

      Report.Item (Name, NT.Success);
   exception
      when Error : others => Report.Report_Exception (Name, Error);
   end Test_Navigation;



































   procedure Test_Tokenization (Report : in out NT.Reporter'Class) is
      Name : constant String := "Simple tokenization";
      Space : constant Ada.Strings.Maps.Character_Set
        := Ada.Strings.Maps.To_Set (" ");

      function Has_Spaces (S : String) return Boolean;







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







869
870
871
872
873
874
875
876
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
      end;

      Report.Item (Name, NT.Success);
   exception
      when Error : others => Report.Report_Exception (Name, Error);
   end Test_Navigation;


   procedure Test_Slices (Report : in out NT.Reporter'Class) is
      Name : constant String := "Slice-based operations";
      Parent : constant String_Slices.Slice
        := String_Slices.To_Slice (Parent_String);
      Unrelated : constant String_Slices.Slice
        := String_Slices.To_Slice (Name);
      Set_1, Set_2, Set_3 : Slice_Sets.Slice_Set;

      use type Slice_Sets.Slice_Set;
   begin
      Set_1.Include_Slice (Unrelated.Subslice (10, 9));
      Set_1.Add_Slice (Parent);
      Set_2.Add_Slice (Parent.Subslice (20, 29));
      Set_2.Add_Slice (Unrelated.Subslice (25, 24));
      Set_2.Include_Slice (Parent);
      Set_3.Include_Slice (Parent.Subslice (20, 29));
      Set_3.Add_Slice (Parent.Subslice (35, 39));
      Set_3.Include_Slice (Parent);

      if Set_1 = Set_2 and Set_1 = Set_3 then
         Report.Item (Name, NT.Success);
      else
         Report.Item (Name, NT.Fail);
         Report.Info ("Add_Slice and Include_Slice not equivalent");
         Dump (Report, Set_1);
         Dump (Report, Set_2);
         Dump (Report, Set_3);
      end if;
   exception
      when Error : others => Report.Report_Exception (Name, Error);
   end Test_Slices;


   procedure Test_Tokenization (Report : in out NT.Reporter'Class) is
      Name : constant String := "Simple tokenization";
      Space : constant Ada.Strings.Maps.Character_Set
        := Ada.Strings.Maps.To_Set (" ");

      function Has_Spaces (S : String) return Boolean;