Natools

Check-in [df097015b8]
Login
Overview
Comment:s_expressions-atom_buffers-tests: add a test for the new Invert procedure
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: df097015b80f50a35d33e63d511bd4b6e67a4797
User & Date: nat on 2014-03-24 20:08:08
Other Links: manifest | tags
Context
2014-03-25
19:09
s_expressions-parsers: redesign the whole package around an abstract type with user-provided data source check-in: bdd6a2a904 user: nat tags: trunk
2014-03-24
20:08
s_expressions-atom_buffers-tests: add a test for the new Invert procedure check-in: df097015b8 user: nat tags: trunk
2014-03-23
13:31
s_expressions-printers-pretty-config: fix Read_Screen_Offset mangling its output parameter check-in: a7eba2a389 user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-atom_buffers-tests.adb from [535648874b] to [b20f1beb30].

27
28
29
30
31
32
33

34
35
36
37
38
39
40
      Test_Block_Append (Report);
      Test_Octet_Append (Report);
      Test_Preallocate (Report);
      Test_Query (Report);
      Test_Query_Null (Report);
      Test_Reset (Report);
      Test_Reverse_Append (Report);

   end All_Tests;



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







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
      Test_Block_Append (Report);
      Test_Octet_Append (Report);
      Test_Preallocate (Report);
      Test_Query (Report);
      Test_Query_Null (Report);
      Test_Reset (Report);
      Test_Reverse_Append (Report);
      Test_Invert (Report);
   end All_Tests;



   ----------------------
   -- Individual Tests --
   ----------------------
58
59
60
61
62
63
64


































65
66
67
68
69
70
71

         Test_Tools.Test_Atom (Report, Name, Data, Buffer.Data);
      end;
   exception
      when Error : others => Report.Report_Exception (Name, Error);
   end Test_Block_Append;




































   procedure Test_Octet_Append (Report : in out NT.Reporter'Class) is
      Name : constant String := "Append octet by octet";
      Data : Atom (0 .. 255);
   begin
      for O in Octet loop
         Data (Count (O)) := O;







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







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

         Test_Tools.Test_Atom (Report, Name, Data, Buffer.Data);
      end;
   exception
      when Error : others => Report.Report_Exception (Name, Error);
   end Test_Block_Append;


   procedure Test_Invert (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Invert procedure");
      Source : Atom (1 .. 10);
      Inverse : Atom (1 .. 10);
   begin
      for I in Source'Range loop
         Source (I) := 10 + Octet (I);
         Inverse (11 - I) := Source (I);
      end loop;

      declare
         Buffer : Atom_Buffer;
      begin
         Buffer.Invert;
         Test_Tools.Test_Atom (Test, Null_Atom, Buffer.Data);

         Buffer.Append (Source (1 .. 1));
         Buffer.Invert;
         Test_Tools.Test_Atom (Test, Source (1 .. 1), Buffer.Data);

         Buffer.Append (Source (2 .. 7));
         Buffer.Invert;
         Test_Tools.Test_Atom (Test, Inverse (4 .. 10), Buffer.Data);

         Buffer.Invert;
         Buffer.Append (Source (8 .. 10));
         Buffer.Invert;
         Test_Tools.Test_Atom (Test, Inverse, Buffer.Data);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Test_Invert;


   procedure Test_Octet_Append (Report : in out NT.Reporter'Class) is
      Name : constant String := "Append octet by octet";
      Data : Atom (0 .. 255);
   begin
      for O in Octet loop
         Data (Count (O)) := O;

Modified tests/natools-s_expressions-atom_buffers-tests.ads from [a50548f9b2] to [72b5629fff].

26
27
28
29
30
31
32

33
34
35
36
37
38
39

   package NT renames Natools.Tests;

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

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

   procedure Test_Preallocate (Report : in out NT.Reporter'Class);
   procedure Test_Query (Report : in out NT.Reporter'Class);
   procedure Test_Query_Null (Report : in out NT.Reporter'Class);
   procedure Test_Reset (Report : in out NT.Reporter'Class);
   procedure Test_Reverse_Append (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Atom_Buffers.Tests;







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

   package NT renames Natools.Tests;

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

   procedure Test_Block_Append (Report : in out NT.Reporter'Class);
   procedure Test_Octet_Append (Report : in out NT.Reporter'Class);
   procedure Test_Invert (Report : in out NT.Reporter'Class);
   procedure Test_Preallocate (Report : in out NT.Reporter'Class);
   procedure Test_Query (Report : in out NT.Reporter'Class);
   procedure Test_Query_Null (Report : in out NT.Reporter'Class);
   procedure Test_Reset (Report : in out NT.Reporter'Class);
   procedure Test_Reverse_Append (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Atom_Buffers.Tests;