Natools

Check-in [8c5686ece7]
Login
Overview
Comment:smaz_tests: add a test for base-64 input with non-base-64 characters
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8c5686ece70500410396ed955307f595ffdb4d52
User & Date: nat on 2017-03-01 21:38:33
Other Links: manifest | tags
Context
2017-03-02
20:56
smaz_tests: add a test for base-4096 input with non-base-64 characters check-in: 605bfd603c user: nat tags: trunk
2017-03-01
21:38
smaz_tests: add a test for base-64 input with non-base-64 characters check-in: 8c5686ece7 user: nat tags: trunk
2017-02-28
20:13
smaz_implementations-base_4096: check end-of-input in Read_Code check-in: 3b9dae1e75 user: nat tags: trunk
Changes

Modified tests/natools-smaz_tests.adb from [35d69f7dcc] to [d227266864].

483
484
485
486
487
488
489

490
491
492
493
494
495
496
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497







+









   procedure All_Tests_64 (Report : in out NT.Reporter'Class) is
   begin
      Test_Validity_64 (Report);
      Sample_Strings_64 (Report);
      Sample_Strings_VLV_64 (Report);
      Impure_Stream_64 (Report);
   end All_Tests_64;



   -------------------------------
   -- Individual Base-256 Tests --
   -------------------------------
757
758
759
760
761
762
763























764
765
766
767
768
769
770
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







   end Test_Validity_4096;



   ------------------------------
   -- Individual Base-64 Tests --
   ------------------------------

   procedure Impure_Stream_64 (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Input stream with non-base-64 symbols");
   begin
      declare
         CRLF : constant String := (Character'Val (13), Character'Val (10));
         Input : constant Ada.Streams.Stream_Element_Array
           := To_SEA ("090kTgIW enLK3NFE FAEKs/Ao" & CRLF
                    & "92dAFAzo +iBF1Sep HOvDJB0=");
         Output : constant String := Smaz_64.Decompress (Dict_64, Input);
         Expected : constant String
           := "'49 bytes of data to show a verbatim count issue'";
      begin
         if Output /= Expected then
            Test.Fail ("Bad decompression");
            Test.Info ("Found:   """ & Output & '"');
            Test.Info ("Expected:""" & Expected & '"');
         end if;
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Impure_Stream_64;


   procedure Sample_Strings_64 (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Roundtrip on sample strings");
   begin
      Roundtrip_Test (Test, Dict_64,
         "Simple Test",
         To_SEA ("+TBGSVYA+UBQE"));

Modified tests/natools-smaz_tests.ads from [7f2d16922f] to [a5c89942f8].

30
31
32
33
34
35
36

37
38
39
40
41
30
31
32
33
34
35
36
37
38
39
40
41
42







+





   procedure Sample_Strings_VLV_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 Impure_Stream_64 (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;