Natools

Check-in [46b1fe3862]
Login
Overview
Comment:smaz_tests: check base-4096 roundtrip of a few sample strings
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 46b1fe3862d4c8b1d5d96a566fc69a94917e4739
User & Date: nat on 2017-02-02 20:16:44
Other Links: manifest | tags
Context
2017-02-03
21:08
smaz_tests: fix base-4096 sample string test by actually calling it check-in: b4e3aec058 user: nat tags: trunk
2017-02-02
20:16
smaz_tests: check base-4096 roundtrip of a few sample strings check-in: 46b1fe3862 user: nat tags: trunk
2017-02-01
21:37
smaz_tests: add a base-4096 test harness check-in: 1d5eb501bc user: nat tags: trunk
Changes

Modified tests/natools-smaz_tests.adb from [d2e73ca1c9] to [e310324b1a].

47
48
49
50
51
52
53




54
55
56
57
58
59
60
   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 Test_Validity_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary);


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







>
>
>
>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
   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 Test_Validity_4096
     (Report : in out NT.Reporter'Class;
      Dictionary : in Smaz_4096.Dictionary);


   -----------------------
   -- Test Dictionaries --
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
      end;
   end Generic_Roundtrip_Test;


   procedure Roundtrip_Test is new Generic_Roundtrip_Test
     (Natools.Smaz_256, Decimal_Image);

--   procedure Roundtrip_Test is new Generic_Roundtrip_Test
--     (Natools.Smaz_4096, Direct_Image);

   procedure Roundtrip_Test is new Generic_Roundtrip_Test
     (Natools.Smaz_64, Direct_Image);



   -------------------------







|
|







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
      end;
   end Generic_Roundtrip_Test;


   procedure Roundtrip_Test is new Generic_Roundtrip_Test
     (Natools.Smaz_256, Decimal_Image);

   procedure Roundtrip_Test is new Generic_Roundtrip_Test
     (Natools.Smaz_4096, Direct_Image);

   procedure Roundtrip_Test is new Generic_Roundtrip_Test
     (Natools.Smaz_64, Direct_Image);



   -------------------------
481
482
483
484
485
486
487
















































488
489
490
491
492
493
494
   end Test_Validity_256;



   --------------------------------
   -- Individual Base-4096 Tests --
   --------------------------------

















































   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







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







485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
   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
      Roundtrip_Test (Test, Dictionary,
         "This is a small string",
         To_SEA ("yJYuAgYuAgBhAgcsVXBsAgczcOak"));
      Roundtrip_Test (Test, Dictionary,
         "foobar",
         To_SEA ("Xca5Vd"));
      Roundtrip_Test (Test, Dictionary,
         "the end",
         To_SEA ("dBBlAgXBBk"));
      Roundtrip_Test (Test, Dictionary,
         "not-a-g00d-Exampl333",
         To_SEA ("asB0AtBhAtBnEABkAtsTVYbdKx"));
      Roundtrip_Test (Test, Dictionary,
         "Smaz is a simple compression library",
         To_SEA ("x0VlAgYuAgBhAgcoaTAgWOaTcKcyYqBuAgZyV3VdB5"));
      Roundtrip_Test (Test, Dictionary,
         "Nothing is more difficult, and therefore more precious, "
           & "than to be able to decide",
         To_SEA ("v0dBYpBnAgYuAgaScKAgWiXTYedfB0AsAgVZBkAgdBXFW5bJBlAgaScKAg"
           & "bjW2YqdmAsAgdBVZAgdIAgVqAgVNZuAgdIAgWeWIWe"));
      Roundtrip_Test (Test, Dictionary,
         "this is an example of what works very well with smaz",
         To_SEA ("dBYuAgYuAgVZAgXLVYbdBlAga9AgePVfAgeWcQBzAgdyceAgeMZ1Ag"
           & "eQdBAgcsVl"));
      Roundtrip_Test (Test, Dictionary,
         "1000 numbers 2000 will 10 20 30 compress very little",
         To_SEA ("HIAwAgayaFXFBzAgIsAwAgeQZ1AgEKAgEUAgEeAgWOaTcKcyAg"
           & "dyceAgZydNZu"));
      Roundtrip_Test (Test, Dictionary,
         ": : : :",
         To_SEA ("/5OiA6IDogOgo"));
   exception
      when Error : others => Test.Report_Exception (Error);
   end Sample_Strings_4096;


   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

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

25
26
27
28
29
30
31

32
33
34
35
36
37
38
   procedure All_Tests_256 (Report : in out NT.Reporter'Class);
   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 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;







>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
   procedure All_Tests_256 (Report : in out NT.Reporter'Class);
   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;