Natools

Check-in [cf6b7c828f]
Login
Overview
Comment:smaz_tests: add base-4096 variable-length verbatim sample string test
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cf6b7c828f249c2c8c89dead516c6f4d539cd01a
User & Date: nat on 2017-02-12 21:52:38
Other Links: manifest | tags
Context
2017-02-13
21:12
smaz_tests: add multi-block base-4096 verbatim, to reach full coverage check-in: 3110e5329d user: nat tags: trunk
2017-02-12
21:52
smaz_tests: add base-4096 variable-length verbatim sample string test check-in: cf6b7c828f user: nat tags: trunk
2017-02-11
20:52
smaz_tests: fix verbatim parts of expected base-4096 streams

Why didn't just use standard base-64!? check-in: 0d15ccca30 user: nat tags: trunk

Changes

Modified tests/natools-smaz_tests.adb from [8e7b5af6d7] to [af670744d8].

51
52
53
54
55
56
57




58
59
60
61
62
63
64
     renames Natools.S_Expressions.To_Atom;


   procedure Sample_Strings_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary);





   procedure Test_Validity_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary);


   -----------------------
   -- Test Dictionaries --







>
>
>
>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
     renames Natools.S_Expressions.To_Atom;


   procedure Sample_Strings_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary);

   procedure Sample_Strings_VLV_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary);

   procedure Test_Validity_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary);


   -----------------------
   -- Test Dictionaries --
456
457
458
459
460
461
462

463
464
465
466
467
468
469
      end;

      declare
         Dict : constant Smaz_4096.Dictionary := Dictionary_4096 (True);
      begin
         Report.Section ("With variable-length verbatim");
         Test_Validity_4096 (Report, Dict);

         Report.End_Section;
      end;
   end All_Tests_4096;


   procedure All_Tests_64 (Report : in out NT.Reporter'Class) is
   begin







>







460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
      end;

      declare
         Dict : constant Smaz_4096.Dictionary := Dictionary_4096 (True);
      begin
         Report.Section ("With variable-length verbatim");
         Test_Validity_4096 (Report, Dict);
         Sample_Strings_VLV_4096 (Report, Dict);
         Report.End_Section;
      end;
   end All_Tests_4096;


   procedure All_Tests_64 (Report : in out NT.Reporter'Class) is
   begin
593
594
595
596
597
598
599





























































600
601
602
603
604
605
606


   procedure Sample_Strings_4096 (Report : in out NT.Reporter'Class) is
   begin
      Sample_Strings_4096 (Report, Dictionary_4096 (False));
   end Sample_Strings_4096;































































   procedure Test_Validity_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary)
   is
      Test : NT.Test := Report.Item ("Test dictionary validity");
   begin







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







598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672


   procedure Sample_Strings_4096 (Report : in out NT.Reporter'Class) is
   begin
      Sample_Strings_4096 (Report, Dictionary_4096 (False));
   end Sample_Strings_4096;


   procedure Sample_Strings_VLV_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary)
   is
      Test : NT.Test := Report.Item ("Roundtrip on sample strings");
   begin
      Roundtrip_Test (Test, Dictionary,
         "This is a small string",
         To_SEA ("JyuYsA0BiBscXVtBzcOcka"));
         --       This is a small string
      Roundtrip_Test (Test, Dictionary,
         "foobar",
         To_SEA ("cX5adV"));
         --       foobar
      Roundtrip_Test (Test, Dictionary,
         "the end",
         To_SEA ("BdmBBX+/kB"));
         --       the en<d >
      Roundtrip_Test (Test, Dictionary,
         "not-a-g00d-Exampl333",
         To_SEA ("sa2/01SYtcGMwQWLTsYVdbxK"));
         --       no< t-a -g0 0d->Exampl333
         --  t-a  001011_10  1011_0100  10_000110
         --  -g0  101101_00  1110_0110  00_001100
         --  0d-  000011_00  0010_0110  10_110100
      Roundtrip_Test (Test, Dictionary,
         "Smaz is a simple compression library",
         To_SEA ("0xlVsA0BiBocTauZmAEbjbGXocFbvAdYGcec"));
         --       Smaz is a simple compression library
      Roundtrip_Test (Test, Dictionary,
         "Nothing is more difficult, and therefore more precious, "
           & "than to be able to decide",
         To_SEA ("0vBdpYoBuYwAJbmBiWTXeYfdzCkAha3AGYKccXKcwAJbmBjb2WqYmd+/sA"
         --       Nothing is more difficult, and therefore more precious< ,>
           & "3ACYvBIdlAmBNVuZ3AwBeWIWeW"));
         --    than to be able to decide
      Roundtrip_Test (Test, Dictionary,
         "this is an example of what works very well with smaz",
         To_SEA ("BduYsA0BZVoAieTauZyAnBPefV6AJbiZ5AFX6BMe1Z6AvYpBsclV"));
         --       this is an example of what works very well with smaz
      Roundtrip_Test (Test, Dictionary,
         "1000 numbers 2000 will 10 20 30 compress very little",
         To_SEA ("IH+AyaFaFX0BsI+AQe1ZBA+AUEDA+AOWTaKcyc5AFX6ByZNduZ"));
         --      1000 numbers 2*0 will 10 20 30 compress very little",
      Roundtrip_Test (Test, Dictionary,
         ": : : :",
         To_SEA ("4/6AiOgoDI6A"));
         --  :_:  010111_00  0000_0100  01_011100
         --  _:_  000001_00  0101_1100  00_000100
         --  :    010111_00  0000
   exception
      when Error : others => Test.Report_Exception (Error);
   end Sample_Strings_VLV_4096;


   procedure Sample_Strings_VLV_4096 (Report : in out NT.Reporter'Class) is
   begin
      Sample_Strings_VLV_4096 (Report, Dictionary_4096 (True));
   end Sample_Strings_VLV_4096;


   procedure Test_Validity_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary)
   is
      Test : NT.Test := Report.Item ("Test dictionary validity");
   begin

Modified tests/natools-smaz_tests.ads from [726fff783c] to [20f555eafb].

26
27
28
29
30
31
32

33
34
35
36
37
38
39
   procedure All_Tests_4096 (Report : in out NT.Reporter'Class);
   procedure All_Tests_64 (Report : in out NT.Reporter'Class);

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

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

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

   procedure Sample_Strings_64 (Report : in out NT.Reporter'Class);
   procedure Sample_Strings_VLV_64 (Report : in out NT.Reporter'Class);
   procedure Test_Validity_64 (Report : in out NT.Reporter'Class);

end Natools.Smaz_Tests;







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
   procedure All_Tests_4096 (Report : in out NT.Reporter'Class);
   procedure All_Tests_64 (Report : in out NT.Reporter'Class);

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

   procedure Sample_Strings_4096 (Report : in out NT.Reporter'Class);
   procedure Sample_Strings_VLV_4096 (Report : in out NT.Reporter'Class);
   procedure Test_Validity_4096 (Report : in out NT.Reporter'Class);

   procedure Sample_Strings_64 (Report : in out NT.Reporter'Class);
   procedure Sample_Strings_VLV_64 (Report : in out NT.Reporter'Class);
   procedure Test_Validity_64 (Report : in out NT.Reporter'Class);

end Natools.Smaz_Tests;