Natools

Check-in [36dd585941]
Login
Overview
Comment:string_slice_set_tests: test slice-based interface
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 36dd585941aabccd48a96711bc394197d1591bee
User & Date: nat on 2013-10-13 15:47:00
Other Links: manifest | tags
Context
2013-10-27
15:49
string_slice_set_tests: check reduction operations check-in: 5ac45318fd user: nat tags: trunk
2013-10-13
15:47
string_slice_set_tests: test slice-based interface check-in: 36dd585941 user: nat tags: trunk
2013-10-12
17:23
string_slice_set_tests: check exceptions raised check-in: c84924dbd6 user: nat tags: trunk
Changes

Modified tests/natools-string_slice_set_tests.adb from [6cf26c7206] to [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;

Modified tests/natools-string_slice_set_tests.ads from [bbd1d51c6c] to [4dcbf41014].

28
29
30
31
32
33
34

35
36
37

   procedure All_Tests (Report : in out NT.Reporter'Class);

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

   procedure Test_Tokenization (Report : in out NT.Reporter'Class);

end Natools.String_Slice_Set_Tests;







>



28
29
30
31
32
33
34
35
36
37
38

   procedure All_Tests (Report : in out NT.Reporter'Class);

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

end Natools.String_Slice_Set_Tests;