Natools

Check-in [ef378b3624]
Login
Overview
Comment:s_expressions-enumeration_io-tests: new test suite for S-expression I/O for enumeration values
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ef378b362420ff5d479229a0527ef8b79baa5cfc
User & Date: nat on 2015-05-13 17:46:23
Other Links: manifest | tags
Context
2015-06-24
18:20
s_expressions-templates-dates: add a new command to override the time zone check-in: 0bd7339369 user: nat tags: trunk
2015-05-13
17:46
s_expressions-enumeration_io-tests: new test suite for S-expression I/O for enumeration values check-in: ef378b3624 user: nat tags: trunk
2015-05-12
20:52
s_expressions-enumeration_io; new package providing tools to help I/O of enumerations in S-expressions check-in: dd030195a1 user: nat tags: trunk
Changes

Added tests/natools-s_expressions-enumeration_io-tests.adb version [d5e4658c45].







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
------------------------------------------------------------------------------
-- Copyright (c) 2015, 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.Streams.Stream_IO;
with Natools.S_Expressions.Test_Tools;

package body Natools.S_Expressions.Enumeration_IO.Tests is

   package Stream_IO renames Ada.Streams.Stream_IO;

   package Test_IO is new Typed_IO (Stream_IO.File_Mode);


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

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



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

   procedure Basic_Usage (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Basic usage with Stream_IO.File_Mode");
      use type Stream_IO.File_Mode;
   begin
      Test_Tools.Test_Atom
        (Test,
         To_Atom ("append-file"),
         Test_IO.Image (Stream_IO.Append_File));

      declare
         Expected : constant Stream_IO.File_Mode := Stream_IO.Out_File;
         Found : constant Stream_IO.File_Mode
           := Test_IO.Value (To_Atom ("out-file"));
      begin
         if Expected /= Found then
            Test.Fail ("Test_IO.Value returned "
              & Stream_IO.File_Mode'Image (Found)
              & ", expected "
              & Stream_IO.File_Mode'Image (Expected));
         end if;
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Basic_Usage;

end Natools.S_Expressions.Enumeration_IO.Tests;

Added tests/natools-s_expressions-enumeration_io-tests.ads version [09ddadd74c].

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
------------------------------------------------------------------------------
-- Copyright (c) 2015, 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.Tests;

package Natools.S_Expressions.Enumeration_IO.Tests is
   pragma Preelaborate;

   package NT renames Natools.Tests;

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

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

end Natools.S_Expressions.Enumeration_IO.Tests;

Modified tests/test_all.adb from [dfe547ea27] to [c6f080431e].

28
29
30
31
32
33
34

35
36
37
38
39
40
41
with Natools.Reference_Tests;
with Natools.Reference_Tests.Pools;
with Natools.S_Expressions.Atom_Buffers.Tests;
with Natools.S_Expressions.Cache_Tests;
with Natools.S_Expressions.Conditionals.Tests;
with Natools.S_Expressions.Dynamic_Interpreter_Tests;
with Natools.S_Expressions.Encodings.Tests;

with Natools.S_Expressions.File_RW_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;







>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
with Natools.Reference_Tests;
with Natools.Reference_Tests.Pools;
with Natools.S_Expressions.Atom_Buffers.Tests;
with Natools.S_Expressions.Cache_Tests;
with Natools.S_Expressions.Conditionals.Tests;
with Natools.S_Expressions.Dynamic_Interpreter_Tests;
with Natools.S_Expressions.Encodings.Tests;
with Natools.S_Expressions.Enumeration_IO.Tests;
with Natools.S_Expressions.File_RW_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;
121
122
123
124
125
126
127




128
129
130
131
132
133
134
   Report.Section ("S_Expressions.Dynamic_Interpreters");
   Natools.S_Expressions.Dynamic_Interpreter_Tests.All_Tests (Report);
   Report.End_Section;

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





   Report.Section ("S_Expressions.File_Readers and File_Writers");
   Natools.S_Expressions.File_RW_Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("S_Expressions.Interpreters");
   Natools.S_Expressions.Interpreter_Tests.All_Tests (Report);







>
>
>
>







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
   Report.Section ("S_Expressions.Dynamic_Interpreters");
   Natools.S_Expressions.Dynamic_Interpreter_Tests.All_Tests (Report);
   Report.End_Section;

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

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

   Report.Section ("S_Expressions.File_Readers and File_Writers");
   Natools.S_Expressions.File_RW_Tests.All_Tests (Report);
   Report.End_Section;

   Report.Section ("S_Expressions.Interpreters");
   Natools.S_Expressions.Interpreter_Tests.All_Tests (Report);