Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | smaz_tests: add a test for base-4096 input with non-base-64 characters |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
605bfd603c839a7fdef6a245ea91e89a |
| User & Date: | nat 2017-03-02 20:56:11.245 |
Context
|
2017-03-03
| ||
| 20:02 | smaz_implementations-base_64_tools: remove unneeded funct. Symbol_Count check-in: aaf366bd15 user: nat tags: trunk | |
|
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 | |
Changes
Changes to tests/natools-smaz_tests.adb.
| ︙ | ︙ | |||
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
|
| ︙ | ︙ |
Changes to tests/natools-smaz_tests.ads.
| ︙ | ︙ | |||
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 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); | > | 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 Sample_Strings_VLV_256 (Report : in out NT.Reporter'Class); procedure Test_Validity_256 (Report : in out NT.Reporter'Class); procedure Impure_Stream_4096 (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); |
| ︙ | ︙ |