50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
function Direct_Image (S : Ada.Streams.Stream_Element_Array) return String
renames Natools.S_Expressions.To_String;
function To_SEA (S : String) return Ada.Streams.Stream_Element_Array
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);
|
>
>
>
>
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
function Direct_Image (S : Ada.Streams.Stream_Element_Array) return String
renames Natools.S_Expressions.To_String;
function To_SEA (S : String) return Ada.Streams.Stream_Element_Array
renames Natools.S_Expressions.To_Atom;
procedure Impure_Stream_4096
(Report : in out NT.Reporter'Class;
Dictionary : in Smaz_4096.Dictionary);
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);
|
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
begin
declare
Dict : constant Smaz_4096.Dictionary := Dictionary_4096 (False);
begin
Report.Section ("Without variable-length verbatim");
Test_Validity_4096 (Report, Dict);
Sample_Strings_4096 (Report, Dict);
Report.End_Section;
end;
declare
Dict : constant Smaz_4096.Dictionary := Dictionary_4096 (True);
begin
Report.Section ("With variable-length verbatim");
|
>
|
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
begin
declare
Dict : constant Smaz_4096.Dictionary := Dictionary_4096 (False);
begin
Report.Section ("Without variable-length verbatim");
Test_Validity_4096 (Report, Dict);
Sample_Strings_4096 (Report, Dict);
Impure_Stream_4096 (Report, Dict);
Report.End_Section;
end;
declare
Dict : constant Smaz_4096.Dictionary := Dictionary_4096 (True);
begin
Report.Section ("With variable-length verbatim");
|
600
601
602
603
604
605
606
607
608
609
610
611
612
613
|
end Test_Validity_256;
--------------------------------
-- Individual Base-4096 Tests --
--------------------------------
procedure Sample_Strings_4096
(Report : in out NT.Reporter'Class;
Dictionary : in Smaz_4096.Dictionary)
is
Test : NT.Test := Report.Item ("Roundtrip on sample strings");
begin
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
end Test_Validity_256;
--------------------------------
-- Individual Base-4096 Tests --
--------------------------------
procedure Impure_Stream_4096
(Report : in out NT.Reporter'Class;
Dictionary : in Smaz_4096.Dictionary)
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 ("0vBdpYoBuYwAJbmB iWTXeYfdzCkAha3A" & CRLF
& "GYKccXKcwAJbmBjb 2WqYmd//sA3ACYvB" & CRLF
& "IdlAmBNVuZ3AwBeW IWeW" & CRLF);
Output : constant String := Smaz_4096.Decompress (Dictionary, Input);
Expected : constant String
:= "Nothing is more difficult, and therefore more precious, "
& "than to be able to decide";
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_4096;
procedure Impure_Stream_4096 (Report : in out NT.Reporter'Class) is
begin
Impure_Stream_4096 (Report, Dictionary_4096 (False));
end Impure_Stream_4096;
procedure Sample_Strings_4096
(Report : in out NT.Reporter'Class;
Dictionary : in Smaz_4096.Dictionary)
is
Test : NT.Test := Report.Item ("Roundtrip on sample strings");
begin
|