47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
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
|
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_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
|
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
|