Natools

Check-in [4a8ff2de3d]
Login
Overview
Comment:s_expressions-printers-pretty-tests: new test for parameter mutators (this makes the test suite cover all the reachable code)
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4a8ff2de3de8c2059e677b9b5a00066202487af6
User & Date: nat on 2014-02-08 17:17:33
Other Links: manifest | tags
Context
2014-02-09
20:52
s_expressions-generic_caches: new package for simnple memory container of S-expression check-in: a23e614377 user: nat tags: trunk
2014-02-08
17:17
s_expressions-printers-pretty-tests: new test for parameter mutators (this makes the test suite cover all the reachable code) check-in: 4a8ff2de3d user: nat tags: trunk
2014-02-07
21:50
s_expressions-printers-pretty-tests: new test for correctness of token encoding end markers check-in: a450c7e1d4 user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-printers-pretty-tests.adb from [95cc049bee] to [facab2d13a].

112
113
114
115
116
117
118

119
120
121
122
123
124
125
      Atom_Encodings (Report);
      Separators (Report);
      Atom_Width (Report);
      Quoted_String_Escapes (Report);
      Indentation (Report);
      Newline_Formats (Report);
      Token_Separation (Report);

   end All_Tests;



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







>







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
      Atom_Encodings (Report);
      Separators (Report);
      Atom_Width (Report);
      Quoted_String_Escapes (Report);
      Indentation (Report);
      Newline_Formats (Report);
      Token_Separation (Report);
      Parameter_Mutators (Report);
   end All_Tests;



   -----------------------
   -- Inidividual Tests --
   -----------------------
391
392
393
394
395
396
397




























































398
399
400
401
402
403
404
         Print (Pr);
         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Newline_Formats;






























































   procedure Quoted_String_Escapes (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Escapes in quoted string atoms");
      Source : constant Atom (0 .. 123) := To_Atom
        ("Special: "  --  indices 0 .. 17
         & Latin_1.BS & Latin_1.HT & Latin_1.LF
         & Latin_1.VT & Latin_1.FF & Latin_1.CR







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







392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
         Print (Pr);
         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Newline_Formats;


   procedure Parameter_Mutators (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Parameter mutators");
      Initial : constant Parameters
        := (Width => 0,
            Newline_At => (others => (others => False)),
            Space_At => (others => (others => False)),
            Tab_Stop => 8,
            Indentation => 0,
            Indent => Spaces,
            Quoted => No_Quoted,
            Token => No_Token,
            Hex_Casing => Encodings.Upper,
            Quoted_Escape => Octal_Escape,
            Char_Encoding => ASCII,
            Fallback => Verbatim,
            Newline => LF);
      Final : constant Parameters
        := (Width => 79,
            Newline_At => (others => (others => True)),
            Space_At => (others => (others => True)),
            Tab_Stop => 4,
            Indentation => 1,
            Indent => Tabs,
            Quoted => When_Shorter,
            Token => Standard_Token,
            Hex_Casing => Encodings.Lower,
            Quoted_Escape => Hex_Escape,
            Char_Encoding => UTF_8,
            Fallback => Hexadecimal,
            Newline => CR_LF);
   begin
      declare
         Output : aliased Test_Tools.Memory_Stream;
         Pr : Printer (Output'Access);
      begin
         Pr.Set_Parameters (Initial);

         Pr.Set_Width (Final.Width);
         Pr.Set_Newline_At (Final.Newline_At);
         Pr.Set_Space_At (Final.Space_At);
         Pr.Set_Tab_Stop (Final.Tab_Stop);
         Pr.Set_Indentation (Final.Indentation);
         Pr.Set_Indent (Final.Indent);
         Pr.Set_Quoted (Final.Quoted);
         Pr.Set_Token (Final.Token);
         Pr.Set_Hex_Casing (Final.Hex_Casing);
         Pr.Set_Quoted_Escape (Final.Quoted_Escape);
         Pr.Set_Char_Encoding (Final.Char_Encoding);
         Pr.Set_Fallback (Final.Fallback);
         Pr.Set_Newline (Final.Newline);

         if Pr.Get_Parameters /= Final then
            Test.Fail;
         end if;
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Parameter_Mutators;


   procedure Quoted_String_Escapes (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Escapes in quoted string atoms");
      Source : constant Atom (0 .. 123) := To_Atom
        ("Special: "  --  indices 0 .. 17
         & Latin_1.BS & Latin_1.HT & Latin_1.LF
         & Latin_1.VT & Latin_1.FF & Latin_1.CR

Modified tests/natools-s_expressions-printers-pretty-tests.ads from [47d92373a2] to [7a44a4daac].

29
30
31
32
33
34
35

36
37
38
39
40
   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 Indentation (Report : in out NT.Reporter'Class);
   procedure Newline_Formats (Report : in out NT.Reporter'Class);

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

end Natools.S_Expressions.Printers.Pretty.Tests;







>





29
30
31
32
33
34
35
36
37
38
39
40
41
   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 Indentation (Report : in out NT.Reporter'Class);
   procedure Newline_Formats (Report : in out NT.Reporter'Class);
   procedure Parameter_Mutators (Report : in out NT.Reporter'Class);
   procedure Quoted_String_Escapes (Report : in out NT.Reporter'Class);
   procedure Separators (Report : in out NT.Reporter'Class);
   procedure Token_Separation (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Printers.Pretty.Tests;