Natools

Check-in [80ce774782]
Login
Overview
Comment:smaz_tests: output base-64 stream directly, for more legibility
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 80ce7747822899b8ad6dc161885af292cd2c59ce
User & Date: nat on 2016-12-24 15:51:16
Other Links: manifest | tags
Context
2016-12-25
21:39
smaz_tests: add dictionary validity tests check-in: bc33d2a603 user: nat tags: trunk
2016-12-24
15:51
smaz_tests: output base-64 stream directly, for more legibility check-in: 80ce774782 user: nat tags: trunk
2016-12-23
20:39
smaz_tests: add a very basic test for base-64 Smaz check-in: a277512ddf user: nat tags: trunk
Changes

Modified tests/natools-smaz_tests.adb from [0d9114d0e8] to [38d86e40d3].

24
25
26
27
28
29
30

31
32
33
34
35
36
37




38
39
40
41
42
43
44
24
25
26
27
28
29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45
46
47
48







+






-
+
+
+
+







with Natools.Smaz_Original;
with Natools.Smaz_Test_Base_64_Hash;

package body Natools.Smaz_Tests is

   generic
      with package Smaz is new Natools.Smaz_Generic (<>);
      with function Image (S : Ada.Streams.Stream_Element_Array) return String;
   procedure Generic_Roundtrip_Test
     (Test : in out NT.Test;
      Dict : in Smaz.Dictionary;
      Decompressed : in String;
      Compressed : in Ada.Streams.Stream_Element_Array);

   function Image (S : Ada.Streams.Stream_Element_Array) return String;
   function Decimal_Image (S : Ada.Streams.Stream_Element_Array) return String;

   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;


   -----------------------
   -- Test Dictionaries --
62
63
64
65
66
67
68
69


70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90







-
+
+








-
+










   ------------------------------
   -- Local Helper Subprograms --
   ------------------------------

   function Image (S : Ada.Streams.Stream_Element_Array) return String is
   function Decimal_Image (S : Ada.Streams.Stream_Element_Array) return String
   is
      use Ada.Strings.Unbounded;
      Result : Unbounded_String;
   begin
      for I in S'Range loop
         Append (Result, Ada.Streams.Stream_Element'Image (S (I)));
      end loop;

      return To_String (Result);
   end Image;
   end Decimal_Image;


   procedure Generic_Roundtrip_Test
     (Test : in out NT.Test;
      Dict : in Smaz.Dictionary;
      Decompressed : in String;
      Compressed : in Ada.Streams.Stream_Element_Array)
155
156
157
158
159
160
161
162


163
164


165
166
167
168
169
170
171
160
161
162
163
164
165
166

167
168
169

170
171
172
173
174
175
176
177
178







-
+
+

-
+
+







            end if;

            Test.Report_Exception (Error, NT.Fail);
      end;
   end Generic_Roundtrip_Test;


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

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



   -------------------------
   -- Complete Test Suite --
   -------------------------