Natools

Check-in [e3eb7b3d2d]
Login
Overview
Comment:static_hash_maps-s_expressions-tests: new test around generated function for S-expression interpreter
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e3eb7b3d2d8743dd01e50b19c8295c3806d81b18
User & Date: nat on 2014-05-29 18:36:26
Other Links: manifest | tags
Context
2014-05-30
20:11
static_hash_maps: add a new option for pragma Pure or Preelaborate on generated packages check-in: 59e052eab5 user: nat tags: trunk
2014-05-29
18:36
static_hash_maps-s_expressions-tests: new test around generated function for S-expression interpreter check-in: e3eb7b3d2d user: nat tags: trunk
2014-05-28
17:28
static_hash_maps-s_expressions: add S-expression bindings for the test child function generation check-in: 0d8d6300c9 user: nat tags: trunk
Changes

Added src/natools-static_hash_maps-s_expressions-command_maps-test.adb version [c33313b3c2].





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
--  Generated at 2014-05-29 18:32:55 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

with Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;
with Natools.Static_Hash_Maps.S_Expressions.Command_Map;
function Natools.Static_Hash_Maps.S_Expressions.Command_Maps.Test
  return Boolean is
begin
   for I in Map_1_Keys'Range loop
      if Natools.Static_Hash_Maps.S_Expressions.Command_Pkg.Hash
           (Map_1_Keys (I).all) /= I
      then
         return False;
      end if;
   end loop;

   for I in Map_2_Keys'Range loop
      if Natools.Static_Hash_Maps.S_Expressions.Command_Map.Hash
           (Map_2_Keys (I).all) /= I
      then
         return False;
      end if;
   end loop;

   return True;
end Natools.Static_Hash_Maps.S_Expressions.Command_Maps.Test;

Added src/natools-static_hash_maps-s_expressions-command_maps-test.ads version [af29308048].











>
>
>
>
>
1
2
3
4
5
--  Generated at 2014-05-29 18:32:55 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

function Natools.Static_Hash_Maps.S_Expressions.Command_Maps.Test
  return Boolean;

Modified src/natools-static_hash_maps-s_expressions-hash_maps.sx from [15b9a7e32e] to [d412302ff5].

1
2

3
4
5
6
7
8
9
(Natools.Static_Hash_Maps.S_Expressions.Command_Maps
   private

   (Package_Command
      (hash-package Natools.Static_Hash_Maps.S_Expressions.Command_Pkg)
      (function To_Package_Command)
      (not-found Extra_Declarations)
      (nodes
         (Extra_Declarations extra-declarations extra-decl)
         (Private_Child private)


>







1
2
3
4
5
6
7
8
9
10
(Natools.Static_Hash_Maps.S_Expressions.Command_Maps
   private
   (test-function Test)
   (Package_Command
      (hash-package Natools.Static_Hash_Maps.S_Expressions.Command_Pkg)
      (function To_Package_Command)
      (not-found Extra_Declarations)
      (nodes
         (Extra_Declarations extra-declarations extra-decl)
         (Private_Child private)

Added tests/natools-static_hash_maps-s_expressions-tests.adb version [6116633193].































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
46
47
------------------------------------------------------------------------------
-- 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         --
-- 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.Static_Hash_Maps.S_Expressions.Command_Maps.Test;

package body Natools.Static_Hash_Maps.S_Expressions.Tests is

   -------------------------
   -- Complete Test Suite --
   -------------------------

   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Test_Hash_Functions (Report);
   end All_Tests;



   -----------------------
   -- Inidividual Tests --
   -----------------------

   procedure Test_Hash_Functions (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item
        ("Hash functions for S-expression interpreter");
   begin
      if not S_Expressions.Command_Maps.Test then
         Test.Fail;
      end if;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Test_Hash_Functions;

end Natools.Static_Hash_Maps.S_Expressions.Tests;

Added tests/natools-static_hash_maps-s_expressions-tests.ads version [c1e349ba52].















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
------------------------------------------------------------------------------
-- 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         --
-- 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.Static_Hash_Maps.S_Expressions.Tests provides a very limited     --
-- test suite for the static hash map generator.                            --
-- Since Natools.Static_Hash_Maps is only a code generator, it is not used  --
-- directly and does not need much testing. Testing should instead target   --
-- the generated code, so that issues with the generator show up in when    --
-- compiling or testing the generated code.                                 --
-- Currently the test suite here only runs the generated self-test of the   --
-- hash map used to decode S-expressions, so that generate_static_hash_map  --
-- tool can be run without silent error.                                    --
------------------------------------------------------------------------------

with Natools.Tests;

package Natools.Static_Hash_Maps.S_Expressions.Tests is

   package NT renames Natools.Tests;

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

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

end Natools.Static_Hash_Maps.S_Expressions.Tests;

Modified tests/test_all.adb from [f858f83fe4] to [6950136de8].

30
31
32
33
34
35
36

37
38
39
40
41
42
43
with Natools.S_Expressions.Encodings.Tests;
with Natools.S_Expressions.Interpreter_Tests;
with Natools.S_Expressions.Lockable.Tests;
with Natools.S_Expressions.Parsers.Tests;
with Natools.S_Expressions.Printers.Tests;
with Natools.S_Expressions.Printers.Pretty.Tests;
with Natools.S_Expressions.Printers.Pretty.Config.Tests;

with Natools.String_Slice_Set_Tests;
with Natools.String_Slice_Tests;
with Natools.Tests.Text_IO;

procedure Test_All is
   package Uneven_Chunked_Strings is new Natools.Chunked_Strings
     (Default_Allocation_Unit => 7,







>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
with Natools.S_Expressions.Encodings.Tests;
with Natools.S_Expressions.Interpreter_Tests;
with Natools.S_Expressions.Lockable.Tests;
with Natools.S_Expressions.Parsers.Tests;
with Natools.S_Expressions.Printers.Tests;
with Natools.S_Expressions.Printers.Pretty.Tests;
with Natools.S_Expressions.Printers.Pretty.Config.Tests;
with Natools.Static_Hash_Maps.S_Expressions.Tests;
with Natools.String_Slice_Set_Tests;
with Natools.String_Slice_Tests;
with Natools.Tests.Text_IO;

procedure Test_All is
   package Uneven_Chunked_Strings is new Natools.Chunked_Strings
     (Default_Allocation_Unit => 7,
118
119
120
121
122
123
124




125
126
127
128
129
130
131
   Report.Section ("S_Expressions.Printers.Pretty");
   Natools.S_Expressions.Printers.Pretty.Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("S_Expressions.Printers.Pretty.Config");
   Natools.S_Expressions.Printers.Pretty.Config.Tests.All_Tests (Report);
   Report.End_Section;





   Report.Section ("String_Slices");
   Natools.String_Slice_Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("String_Slices.Slice_Sets");
   Natools.String_Slice_Set_Tests.All_Tests (Report);







>
>
>
>







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
   Report.Section ("S_Expressions.Printers.Pretty");
   Natools.S_Expressions.Printers.Pretty.Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("S_Expressions.Printers.Pretty.Config");
   Natools.S_Expressions.Printers.Pretty.Config.Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("Static_Hash_Maps.S_Expressions");
   Natools.Static_Hash_Maps.S_Expressions.Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("String_Slices");
   Natools.String_Slice_Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("String_Slices.Slice_Sets");
   Natools.String_Slice_Set_Tests.All_Tests (Report);