Natools

Check-in [278fda3aa5]
Login
Overview
Comment:chunked_strings-tests-bugfixes: new test case exposing a bug
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 278fda3aa5fcfc736bdfc177b6edd5a813e03f1f
User & Date: nat on 2013-10-10 21:23:47
Other Links: manifest | tags
Context
2013-10-11
21:51
chunked_strings: fix a bug where Index checks beyond string upper bound check-in: b2d601f43d user: nat tags: trunk
2013-10-10
21:23
chunked_strings-tests-bugfixes: new test case exposing a bug check-in: 278fda3aa5 user: nat tags: trunk
2013-10-09
21:10
chunked_strings: improive Find_Token implementation check-in: 75f285cc82 user: nat tags: trunk
Changes

Added tests/natools-chunked_strings-tests-bugfixes.adb version [a3a7278e83].














































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
------------------------------------------------------------------------------
-- Copyright (c) 2013, 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         --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

with Ada.Strings.Maps;

procedure Natools.Chunked_Strings.Tests.Bugfixes
  (Report : in out Natools.Tests.Reporter'Class)
is
   package NT renames Natools.Tests;
begin
   Report.Section ("Extra tests for complete coverage");

   declare
      Name : constant String := "Overreach of Index";
      CS : Chunked_String := To_Chunked_String ("abcd0123");
      N : Natural;
   begin
      CS.Head (4);
      N := CS.Index (Ada.Strings.Maps.To_Set ("0123456789"));

      if N /= 0 then
         Report.Item (Name, NT.Fail);
         Report.Info ("Index of digit" & Natural'Image (N) & ", expected 0.");
      else
         Report.Item (Name, NT.Success);
      end if;
   exception
      when Error : others => NT.Report_Exception (Report, Name, Error);
   end;

   Report.End_Section;
end Natools.Chunked_Strings.Tests.Bugfixes;

Added tests/natools-chunked_strings-tests-bugfixes.ads version [ef8bcba8fa].



























1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
------------------------------------------------------------------------------
-- Copyright (c) 2013, 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         --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

------------------------------------------------------------------------------
-- Natools.Chunked_Strings.Tests.Bugfixes contains test cases for known     --
-- (and hopefully fixed) bugs.                                              --
------------------------------------------------------------------------------

with Natools.Tests;

generic procedure Natools.Chunked_Strings.Tests.Bugfixes
  (Report : in out Natools.Tests.Reporter'Class);
pragma Preelaborate (Bugfixes);

Modified tests/natools-chunked_strings-tests.adb from [8cd7cb1ae5] to [3b5e5ac5c1].

10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50


51
52
53
54
55
56
57
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61







+



















+















+
+







-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

with Natools.Chunked_Strings.Tests.Bugfixes;
with Natools.Chunked_Strings.Tests.Coverage;
with Natools.Chunked_Strings.Tests.CXA4010;
with Natools.Chunked_Strings.Tests.CXA4011;
with Natools.Chunked_Strings.Tests.CXA4030;
with Natools.Chunked_Strings.Tests.CXA4031;
with Natools.Chunked_Strings.Tests.CXA4032;
with Natools.Chunked_Strings.Tests.Memory;
with Natools.Accumulators.Tests;

package body Natools.Chunked_Strings.Tests is
   package NT renames Natools.Tests;

   procedure All_Blackbox_Tests (Report : in out Natools.Tests.Reporter'Class)
   is
      procedure Test_CXA4010 is new CXA4010;
      procedure Test_CXA4011 is new CXA4011;
      procedure Test_CXA4030 is new CXA4030;
      procedure Test_CXA4031 is new CXA4031;
      procedure Test_CXA4032 is new CXA4032;
      procedure Test_Bugfixes is new Bugfixes;
   begin
      NT.Section (Report, "Blackbox tests of Chunked_Strings");
      Test_CXA4010 (Report);
      Test_CXA4011 (Report);
      Test_CXA4030 (Report);
      Test_CXA4031 (Report);
      Test_CXA4032 (Report);

      NT.Section (Report, "String_Accumulator interface");
      declare
         Acc : Chunked_String;
      begin
         Accumulators.Tests.Test (Report, Acc);
      end;
      NT.End_Section (Report);

      Test_Bugfixes (Report);
      NT.End_Section (Report);
   end All_Blackbox_Tests;


   procedure All_Greybox_Tests (Report : in out Natools.Tests.Reporter'Class)
   is
      procedure Test_Coverage is new Coverage;