Natools

Check-in [ed46bbdd62]
Login
Overview
Comment:s_expressions-printers-pretty-tests: add test for output width in hexadecimal and base-64 atom encodings
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ed46bbdd62b3aa15d5b80fd724c4e62b5cf5c2f4
User & Date: nat on 2014-01-28 19:40:23
Other Links: manifest | tags
Context
2014-01-29
21:08
s_expressions-printers-pretty: fix width handling in hexadecimal and base-64 atom encodings check-in: f1e8b35069 user: nat tags: trunk
2014-01-28
19:40
s_expressions-printers-pretty-tests: add test for output width in hexadecimal and base-64 atom encodings check-in: ed46bbdd62 user: nat tags: trunk
2014-01-27
20:04
s_expressions-printers-pretty-tests: first draft of a test suite for S-expression pretty printer check-in: e8c225e03c user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-printers-pretty-tests.adb from [8abc99d280] to [dc72f94eed].

107
108
109
110
111
112
113

114
115
116
117
118
119
120
   -------------------------

   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Basic_Printing (Report);
      Atom_Encodings (Report);
      Separators (Report);

   end All_Tests;



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







>







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
   -------------------------

   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Basic_Printing (Report);
      Atom_Encodings (Report);
      Separators (Report);
      Atom_Width (Report);
   end All_Tests;



   -----------------------
   -- Inidividual Tests --
   -----------------------
150
151
152
153
154
155
156



























































157
158
159
160
161
162
163
      Param.Token := Extended_Token;
      Parse_Print_Test (Test, Param,
        To_Atom ("(extended token 123 encoding)"));
   exception
      when Error : others => Test.Report_Exception (Error);
   end Atom_Encodings;





























































   procedure Basic_Printing (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Basic printing");
   begin
      declare
         Output : aliased Test_Tools.Memory_Stream;
         P : Printer (Output'Access);







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







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
      Param.Token := Extended_Token;
      Parse_Print_Test (Test, Param,
        To_Atom ("(extended token 123 encoding)"));
   exception
      when Error : others => Test.Report_Exception (Error);
   end Atom_Encodings;


   procedure Atom_Width (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Atom width");
      Param : Parameters
        := (Width => 10,
            Newline_At => (others => (others => False)),
            Space_At => (others => (others => False)),
            Tab_Stop => 8,
            Indentation => 3,
            Indent => Spaces,
            Quoted => No_Quoted,
            Token => No_Token,
            Hex_Casing => Encodings.Upper,
            Quoted_Escape => Hex_Escape,
            Char_Encoding => ASCII,
            Fallback => Hexadecimal,
            Newline => LF);
   begin
      declare
         Output : aliased Test_Tools.Memory_Stream;
         Pr : Printer (Output'Access);
      begin
         Output.Set_Expected (To_Atom ("(" & Latin_1.LF
            & "   #303132" & Latin_1.LF
            & "    333435" & Latin_1.LF
            & "    3637#)"));
         Pr.Set_Parameters (Param);

         Pr.Open_List;
         Pr.Append_Atom (To_Atom ("01234567"));
         Pr.Close_List;

         Check_Stream (Test, Output);
      end;

      Param.Fallback := Base64;

      declare
         Output : aliased Test_Tools.Memory_Stream;
         Pr : Printer (Output'Access);
      begin
         Output.Set_Expected (To_Atom ("(" & Latin_1.LF
            & "   |  YWJj" & Latin_1.LF
            & "      REVG" & Latin_1.LF
            & "      Z2hp" & Latin_1.LF
            & "      SktM" & Latin_1.LF
            & "   |)"));
         Pr.Set_Parameters (Param);

         Pr.Open_List;
         Pr.Append_Atom (To_Atom ("abcDEFghiJKL"));
         Pr.Close_List;

         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Atom_Width;


   procedure Basic_Printing (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Basic printing");
   begin
      declare
         Output : aliased Test_Tools.Memory_Stream;
         P : Printer (Output'Access);

Modified tests/natools-s_expressions-printers-pretty-tests.ads from [18ef868bf5] to [2536e8dc4b].

25
26
27
28
29
30
31

32
33
34
35
   pragma Preelaborate (Tests);

   package NT renames Natools.Tests;

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

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

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

end Natools.S_Expressions.Printers.Pretty.Tests;







>




25
26
27
28
29
30
31
32
33
34
35
36
   pragma Preelaborate (Tests);

   package NT renames Natools.Tests;

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

   procedure Atom_Encodings (Report : in out NT.Reporter'Class);
   procedure Atom_Width (Report : in out NT.Reporter'Class);
   procedure Basic_Printing (Report : in out NT.Reporter'Class);
   procedure Separators (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Printers.Pretty.Tests;