adsp 1.0.4 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/adsp/test/common.rb +2 -0
 - data/lib/adsp/test/{file.test.rb → file.rb} +23 -17
 - data/lib/adsp/test/stream/{minitar.test.rb → minitar.rb} +0 -2
 - data/lib/adsp/test/stream/raw/{compressor.test.rb → compressor.rb} +12 -10
 - data/lib/adsp/test/stream/raw/{decompressor.test.rb → decompressor.rb} +12 -10
 - data/lib/adsp/test/stream/{reader.test.rb → reader.rb} +8 -6
 - data/lib/adsp/test/stream/{reader_helpers.test.rb → reader_helpers.rb} +16 -13
 - data/lib/adsp/test/stream/{writer.test.rb → writer.rb} +8 -6
 - data/lib/adsp/test/stream/{writer_helpers.test.rb → writer_helpers.rb} +16 -13
 - data/lib/adsp/test/{string.test.rb → string.rb} +21 -15
 - data/lib/adsp/test/{version.test.rb → version.rb} +0 -2
 - data/lib/adsp/version.rb +1 -1
 - data/test/file.test.rb +7 -0
 - data/test/stream/minitar.test.rb +7 -0
 - data/test/stream/raw/compressor.test.rb +7 -0
 - data/test/stream/raw/decompressor.test.rb +7 -0
 - data/test/stream/reader.test.rb +7 -0
 - data/test/stream/reader_helpers.test.rb +7 -0
 - data/test/stream/writer.test.rb +7 -0
 - data/test/stream/writer_helpers.test.rb +7 -0
 - data/test/string.test.rb +7 -0
 - data/test/version.test.rb +7 -0
 - metadata +22 -12
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e422087dd802af37956a5f68224104aa5bc6956bdecfc8c2546afe1aba2ad189
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 47a1458df2da0dc26e4418f3ebe4da7d5e1bc8c38eeef2e774fdd1ed25f8cefd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 04b24a5bb4869c0c41fc984716fb998949e20fb7d9d2df527f8e731b41c6cbe054b040efd674a526dcf70ad3aa47d72d1509a6493b5ad4feb05d10f13589eb03
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: acb3eb79200e4eab7fc9afdb6f973c99bca529a69ed6d10f109537c077be9f96b3310f3f5ddbe1de3c07b8358da15493a5e015f19efd02d869a62b6fd9893f20
         
     | 
    
        data/lib/adsp/test/common.rb
    CHANGED
    
    | 
         @@ -12,7 +12,9 @@ module ADSP 
     | 
|
| 
       12 
12 
     | 
    
         
             
                # ADSP::Test::Common module.
         
     | 
| 
       13 
13 
     | 
    
         
             
                module Common
         
     | 
| 
       14 
14 
     | 
    
         
             
                  BASE_PATH = ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "..", "..")).freeze
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       15 
16 
     | 
    
         
             
                  TEMP_PATH = ::File.join(BASE_PATH, "tmp").freeze
         
     | 
| 
      
 17 
     | 
    
         
            +
                  FileUtils.mkdir_p TEMP_PATH
         
     | 
| 
       16 
18 
     | 
    
         | 
| 
       17 
19 
     | 
    
         
             
                  SOURCE_PATH  = ::File.join(TEMP_PATH, "source").freeze
         
     | 
| 
       18 
20 
     | 
    
         
             
                  ARCHIVE_PATH = ::File.join(TEMP_PATH, "archive").freeze
         
     | 
| 
         @@ -14,8 +14,8 @@ module ADSP 
     | 
|
| 
       14 
14 
     | 
    
         
             
              module Test
         
     | 
| 
       15 
15 
     | 
    
         
             
                # ADSP::Test::File class.
         
     | 
| 
       16 
16 
     | 
    
         
             
                class File < Minitest::Test
         
     | 
| 
       17 
     | 
    
         
            -
                  Option = Test::Option
         
     | 
| 
       18 
17 
     | 
    
         
             
                  Target = Mock::File
         
     | 
| 
      
 18 
     | 
    
         
            +
                  Option = Test::Option
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                  SOURCE_PATH  = Common::SOURCE_PATH
         
     | 
| 
       21 
21 
     | 
    
         
             
                  ARCHIVE_PATH = Common::ARCHIVE_PATH
         
     | 
| 
         @@ -32,31 +32,31 @@ module ADSP 
     | 
|
| 
       32 
32 
     | 
    
         
             
                  def test_invalid_arguments
         
     | 
| 
       33 
33 
     | 
    
         
             
                    Validation::INVALID_STRINGS.each do |invalid_path|
         
     | 
| 
       34 
34 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       35 
     | 
    
         
            -
                         
     | 
| 
      
 35 
     | 
    
         
            +
                        target.compress invalid_path, ARCHIVE_PATH
         
     | 
| 
       36 
36 
     | 
    
         
             
                      end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       39 
     | 
    
         
            -
                         
     | 
| 
      
 39 
     | 
    
         
            +
                        target.compress SOURCE_PATH, invalid_path
         
     | 
| 
       40 
40 
     | 
    
         
             
                      end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       43 
     | 
    
         
            -
                         
     | 
| 
      
 43 
     | 
    
         
            +
                        target.decompress invalid_path, SOURCE_PATH
         
     | 
| 
       44 
44 
     | 
    
         
             
                      end
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       47 
     | 
    
         
            -
                         
     | 
| 
      
 47 
     | 
    
         
            +
                        target.decompress ARCHIVE_PATH, invalid_path
         
     | 
| 
       48 
48 
     | 
    
         
             
                      end
         
     | 
| 
       49 
49 
     | 
    
         
             
                    end
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
                    get_invalid_compressor_options do |invalid_options|
         
     | 
| 
       52 
52 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       53 
     | 
    
         
            -
                         
     | 
| 
      
 53 
     | 
    
         
            +
                        target.compress SOURCE_PATH, ARCHIVE_PATH, invalid_options
         
     | 
| 
       54 
54 
     | 
    
         
             
                      end
         
     | 
| 
       55 
55 
     | 
    
         
             
                    end
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
                    get_invalid_decompressor_options do |invalid_options|
         
     | 
| 
       58 
58 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       59 
     | 
    
         
            -
                         
     | 
| 
      
 59 
     | 
    
         
            +
                        target.decompress ARCHIVE_PATH, SOURCE_PATH, invalid_options
         
     | 
| 
       60 
60 
     | 
    
         
             
                      end
         
     | 
| 
       61 
61 
     | 
    
         
             
                    end
         
     | 
| 
       62 
62 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -68,10 +68,10 @@ module ADSP 
     | 
|
| 
       68 
68 
     | 
    
         | 
| 
       69 
69 
     | 
    
         
             
                      TEXTS.each do |text|
         
     | 
| 
       70 
70 
     | 
    
         
             
                        ::File.write source_path, text, :mode => "wb"
         
     | 
| 
       71 
     | 
    
         
            -
                         
     | 
| 
      
 71 
     | 
    
         
            +
                        target.compress source_path, archive_path, compressor_options
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
73 
     | 
    
         
             
                        get_compatible_decompressor_options compressor_options do |decompressor_options|
         
     | 
| 
       74 
     | 
    
         
            -
                           
     | 
| 
      
 74 
     | 
    
         
            +
                          target.decompress archive_path, source_path, decompressor_options
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
76 
     | 
    
         
             
                          decompressed_text = ::File.read source_path, :mode => "rb"
         
     | 
| 
       77 
77 
     | 
    
         
             
                          decompressed_text.force_encoding text.encoding
         
     | 
| 
         @@ -88,8 +88,8 @@ module ADSP 
     | 
|
| 
       88 
88 
     | 
    
         
             
                      archive_path = Common.get_path ARCHIVE_PATH, worker_index
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
90 
     | 
    
         
             
                      ::File.write source_path, text, :mode => "wb"
         
     | 
| 
       91 
     | 
    
         
            -
                       
     | 
| 
       92 
     | 
    
         
            -
                       
     | 
| 
      
 91 
     | 
    
         
            +
                      target.compress source_path, archive_path
         
     | 
| 
      
 92 
     | 
    
         
            +
                      target.decompress archive_path, source_path
         
     | 
| 
       93 
93 
     | 
    
         | 
| 
       94 
94 
     | 
    
         
             
                      decompressed_text = ::File.read source_path, :mode => "rb"
         
     | 
| 
       95 
95 
     | 
    
         
             
                      decompressed_text.force_encoding text.encoding
         
     | 
| 
         @@ -101,22 +101,28 @@ module ADSP 
     | 
|
| 
       101 
101 
     | 
    
         
             
                  # -----
         
     | 
| 
       102 
102 
     | 
    
         | 
| 
       103 
103 
     | 
    
         
             
                  def get_invalid_compressor_options(&block)
         
     | 
| 
       104 
     | 
    
         
            -
                     
     | 
| 
      
 104 
     | 
    
         
            +
                    option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
         
     | 
| 
       105 
105 
     | 
    
         
             
                  end
         
     | 
| 
       106 
106 
     | 
    
         | 
| 
       107 
107 
     | 
    
         
             
                  def get_invalid_decompressor_options(&block)
         
     | 
| 
       108 
     | 
    
         
            -
                     
     | 
| 
      
 108 
     | 
    
         
            +
                    option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
         
     | 
| 
       109 
109 
     | 
    
         
             
                  end
         
     | 
| 
       110 
110 
     | 
    
         | 
| 
       111 
111 
     | 
    
         
             
                  def parallel_compressor_options(&block)
         
     | 
| 
       112 
     | 
    
         
            -
                    Common.parallel_options  
     | 
| 
      
 112 
     | 
    
         
            +
                    Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
         
     | 
| 
       113 
113 
     | 
    
         
             
                  end
         
     | 
| 
       114 
114 
     | 
    
         | 
| 
       115 
115 
     | 
    
         
             
                  def get_compatible_decompressor_options(compressor_options, &block)
         
     | 
| 
       116 
     | 
    
         
            -
                     
     | 
| 
      
 116 
     | 
    
         
            +
                    option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
         
     | 
| 
       117 
117 
     | 
    
         
             
                  end
         
     | 
| 
       118 
     | 
    
         
            -
                end
         
     | 
| 
       119 
118 
     | 
    
         | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
      
 119 
     | 
    
         
            +
                  protected def target
         
     | 
| 
      
 120 
     | 
    
         
            +
                    self.class::Target
         
     | 
| 
      
 121 
     | 
    
         
            +
                  end
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                  protected def option
         
     | 
| 
      
 124 
     | 
    
         
            +
                    self.class::Option
         
     | 
| 
      
 125 
     | 
    
         
            +
                  end
         
     | 
| 
      
 126 
     | 
    
         
            +
                end
         
     | 
| 
       121 
127 
     | 
    
         
             
              end
         
     | 
| 
       122 
128 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,7 +3,6 @@ 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            require_relative "abstract"
         
     | 
| 
       5 
5 
     | 
    
         
             
            require_relative "../../common"
         
     | 
| 
       6 
     | 
    
         
            -
            require_relative "../../minitest"
         
     | 
| 
       7 
6 
     | 
    
         
             
            require_relative "../../mock/stream/raw/compressor"
         
     | 
| 
       8 
7 
     | 
    
         
             
            require_relative "../../mock/string"
         
     | 
| 
       9 
8 
     | 
    
         
             
            require_relative "../../option"
         
     | 
| 
         @@ -17,6 +16,7 @@ module ADSP 
     | 
|
| 
       17 
16 
     | 
    
         
             
                    # ADSP::Test::Stream::Raw::Compressor class.
         
     | 
| 
       18 
17 
     | 
    
         
             
                    class Compressor < Abstract
         
     | 
| 
       19 
18 
     | 
    
         
             
                      Target = Mock::Stream::Raw::Compressor
         
     | 
| 
      
 19 
     | 
    
         
            +
                      Option = Test::Option
         
     | 
| 
       20 
20 
     | 
    
         
             
                      String = Mock::String
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                      TEXTS                 = Common::TEXTS
         
     | 
| 
         @@ -30,13 +30,13 @@ module ADSP 
     | 
|
| 
       30 
30 
     | 
    
         
             
                      def test_invalid_initialize
         
     | 
| 
       31 
31 
     | 
    
         
             
                        get_invalid_compressor_options do |invalid_options|
         
     | 
| 
       32 
32 
     | 
    
         
             
                          assert_raises ValidateError do
         
     | 
| 
       33 
     | 
    
         
            -
                             
     | 
| 
      
 33 
     | 
    
         
            +
                            target.new invalid_options
         
     | 
| 
       34 
34 
     | 
    
         
             
                          end
         
     | 
| 
       35 
35 
     | 
    
         
             
                        end
         
     | 
| 
       36 
36 
     | 
    
         
             
                      end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                      def test_invalid_write
         
     | 
| 
       39 
     | 
    
         
            -
                        compressor =  
     | 
| 
      
 39 
     | 
    
         
            +
                        compressor = target.new
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                        Validation::INVALID_STRINGS.each do |invalid_string|
         
     | 
| 
       42 
42 
     | 
    
         
             
                          assert_raises ValidateError do
         
     | 
| 
         @@ -63,7 +63,7 @@ module ADSP 
     | 
|
| 
       63 
63 
     | 
    
         
             
                              compressed_buffer.set_encoding ::Encoding::BINARY
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
                              writer     = proc { |portion| compressed_buffer << portion }
         
     | 
| 
       66 
     | 
    
         
            -
                              compressor =  
     | 
| 
      
 66 
     | 
    
         
            +
                              compressor = target.new compressor_options
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
                              begin
         
     | 
| 
       69 
69 
     | 
    
         
             
                                source      = "".b
         
     | 
| 
         @@ -117,7 +117,7 @@ module ADSP 
     | 
|
| 
       117 
117 
     | 
    
         
             
                          compressed_buffer.set_encoding ::Encoding::BINARY
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
       119 
119 
     | 
    
         
             
                          writer     = proc { |portion| compressed_buffer << portion }
         
     | 
| 
       120 
     | 
    
         
            -
                          compressor =  
     | 
| 
      
 120 
     | 
    
         
            +
                          compressor = target.new
         
     | 
| 
       121 
121 
     | 
    
         | 
| 
       122 
122 
     | 
    
         
             
                          begin
         
     | 
| 
       123 
123 
     | 
    
         
             
                            source      = "".b
         
     | 
| 
         @@ -149,19 +149,21 @@ module ADSP 
     | 
|
| 
       149 
149 
     | 
    
         
             
                      # -----
         
     | 
| 
       150 
150 
     | 
    
         | 
| 
       151 
151 
     | 
    
         
             
                      def get_invalid_compressor_options(&block)
         
     | 
| 
       152 
     | 
    
         
            -
                         
     | 
| 
      
 152 
     | 
    
         
            +
                        option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
         
     | 
| 
       153 
153 
     | 
    
         
             
                      end
         
     | 
| 
       154 
154 
     | 
    
         | 
| 
       155 
155 
     | 
    
         
             
                      def parallel_compressor_options(&block)
         
     | 
| 
       156 
     | 
    
         
            -
                        Common.parallel_options  
     | 
| 
      
 156 
     | 
    
         
            +
                        Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
         
     | 
| 
       157 
157 
     | 
    
         
             
                      end
         
     | 
| 
       158 
158 
     | 
    
         | 
| 
       159 
159 
     | 
    
         
             
                      def get_compatible_decompressor_options(compressor_options, &block)
         
     | 
| 
       160 
     | 
    
         
            -
                         
     | 
| 
      
 160 
     | 
    
         
            +
                        option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
         
     | 
| 
       161 
161 
     | 
    
         
             
                      end
         
     | 
| 
       162 
     | 
    
         
            -
                    end
         
     | 
| 
       163 
162 
     | 
    
         | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
      
 163 
     | 
    
         
            +
                      def option
         
     | 
| 
      
 164 
     | 
    
         
            +
                        self.class::Option
         
     | 
| 
      
 165 
     | 
    
         
            +
                      end
         
     | 
| 
      
 166 
     | 
    
         
            +
                    end
         
     | 
| 
       165 
167 
     | 
    
         
             
                  end
         
     | 
| 
       166 
168 
     | 
    
         
             
                end
         
     | 
| 
       167 
169 
     | 
    
         
             
              end
         
     | 
| 
         @@ -3,7 +3,6 @@ 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            require_relative "abstract"
         
     | 
| 
       5 
5 
     | 
    
         
             
            require_relative "../../common"
         
     | 
| 
       6 
     | 
    
         
            -
            require_relative "../../minitest"
         
     | 
| 
       7 
6 
     | 
    
         
             
            require_relative "../../mock/stream/raw/decompressor"
         
     | 
| 
       8 
7 
     | 
    
         
             
            require_relative "../../mock/string"
         
     | 
| 
       9 
8 
     | 
    
         
             
            require_relative "../../option"
         
     | 
| 
         @@ -17,6 +16,7 @@ module ADSP 
     | 
|
| 
       17 
16 
     | 
    
         
             
                    # ADSP::Test::Stream::Raw::Decompressor class.
         
     | 
| 
       18 
17 
     | 
    
         
             
                    class Decompressor < Abstract
         
     | 
| 
       19 
18 
     | 
    
         
             
                      Target = Mock::Stream::Raw::Decompressor
         
     | 
| 
      
 19 
     | 
    
         
            +
                      Option = Test::Option
         
     | 
| 
       20 
20 
     | 
    
         
             
                      String = Mock::String
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                      TEXTS                 = Common::TEXTS
         
     | 
| 
         @@ -30,13 +30,13 @@ module ADSP 
     | 
|
| 
       30 
30 
     | 
    
         
             
                      def test_invalid_initialize
         
     | 
| 
       31 
31 
     | 
    
         
             
                        get_invalid_decompressor_options do |invalid_options|
         
     | 
| 
       32 
32 
     | 
    
         
             
                          assert_raises ValidateError do
         
     | 
| 
       33 
     | 
    
         
            -
                             
     | 
| 
      
 33 
     | 
    
         
            +
                            target.new invalid_options
         
     | 
| 
       34 
34 
     | 
    
         
             
                          end
         
     | 
| 
       35 
35 
     | 
    
         
             
                        end
         
     | 
| 
       36 
36 
     | 
    
         
             
                      end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                      def test_invalid_read
         
     | 
| 
       39 
     | 
    
         
            -
                        decompressor =  
     | 
| 
      
 39 
     | 
    
         
            +
                        decompressor = target.new
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                        Validation::INVALID_STRINGS.each do |invalid_string|
         
     | 
| 
       42 
42 
     | 
    
         
             
                          assert_raises ValidateError do
         
     | 
| 
         @@ -66,7 +66,7 @@ module ADSP 
     | 
|
| 
       66 
66 
     | 
    
         
             
                                decompressed_buffer.set_encoding ::Encoding::BINARY
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
                                writer       = proc { |portion| decompressed_buffer << portion }
         
     | 
| 
       69 
     | 
    
         
            -
                                decompressor =  
     | 
| 
      
 69 
     | 
    
         
            +
                                decompressor = target.new decompressor_options
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
71 
     | 
    
         
             
                                begin
         
     | 
| 
       72 
72 
     | 
    
         
             
                                  source                 = "".b
         
     | 
| 
         @@ -119,7 +119,7 @@ module ADSP 
     | 
|
| 
       119 
119 
     | 
    
         
             
                          decompressed_buffer.set_encoding ::Encoding::BINARY
         
     | 
| 
       120 
120 
     | 
    
         | 
| 
       121 
121 
     | 
    
         
             
                          writer       = proc { |portion| decompressed_buffer << portion }
         
     | 
| 
       122 
     | 
    
         
            -
                          decompressor =  
     | 
| 
      
 122 
     | 
    
         
            +
                          decompressor = target.new
         
     | 
| 
       123 
123 
     | 
    
         | 
| 
       124 
124 
     | 
    
         
             
                          begin
         
     | 
| 
       125 
125 
     | 
    
         
             
                            source                 = "".b
         
     | 
| 
         @@ -149,19 +149,21 @@ module ADSP 
     | 
|
| 
       149 
149 
     | 
    
         
             
                      # -----
         
     | 
| 
       150 
150 
     | 
    
         | 
| 
       151 
151 
     | 
    
         
             
                      def get_invalid_decompressor_options(&block)
         
     | 
| 
       152 
     | 
    
         
            -
                         
     | 
| 
      
 152 
     | 
    
         
            +
                        option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
         
     | 
| 
       153 
153 
     | 
    
         
             
                      end
         
     | 
| 
       154 
154 
     | 
    
         | 
| 
       155 
155 
     | 
    
         
             
                      def parallel_compressor_options(&block)
         
     | 
| 
       156 
     | 
    
         
            -
                        Common.parallel_options  
     | 
| 
      
 156 
     | 
    
         
            +
                        Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
         
     | 
| 
       157 
157 
     | 
    
         
             
                      end
         
     | 
| 
       158 
158 
     | 
    
         | 
| 
       159 
159 
     | 
    
         
             
                      def get_compatible_decompressor_options(compressor_options, &block)
         
     | 
| 
       160 
     | 
    
         
            -
                         
     | 
| 
      
 160 
     | 
    
         
            +
                        option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
         
     | 
| 
       161 
161 
     | 
    
         
             
                      end
         
     | 
| 
       162 
     | 
    
         
            -
                    end
         
     | 
| 
       163 
162 
     | 
    
         | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
      
 163 
     | 
    
         
            +
                      def option
         
     | 
| 
      
 164 
     | 
    
         
            +
                        self.class::Option
         
     | 
| 
      
 165 
     | 
    
         
            +
                      end
         
     | 
| 
      
 166 
     | 
    
         
            +
                    end
         
     | 
| 
       165 
167 
     | 
    
         
             
                  end
         
     | 
| 
       166 
168 
     | 
    
         
             
                end
         
     | 
| 
       167 
169 
     | 
    
         
             
              end
         
     | 
| 
         @@ -7,7 +7,6 @@ require "stringio" 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            require_relative "abstract"
         
     | 
| 
       9 
9 
     | 
    
         
             
            require_relative "../common"
         
     | 
| 
       10 
     | 
    
         
            -
            require_relative "../minitest"
         
     | 
| 
       11 
10 
     | 
    
         
             
            require_relative "../option"
         
     | 
| 
       12 
11 
     | 
    
         
             
            require_relative "../validation"
         
     | 
| 
       13 
12 
     | 
    
         
             
            require_relative "../mock/stream/reader"
         
     | 
| 
         @@ -20,6 +19,7 @@ module ADSP 
     | 
|
| 
       20 
19 
     | 
    
         
             
                  # ADSP::Test::Stream::Reader class.
         
     | 
| 
       21 
20 
     | 
    
         
             
                  class Reader < Abstract
         
     | 
| 
       22 
21 
     | 
    
         
             
                    Target = Mock::Stream::Reader
         
     | 
| 
      
 22 
     | 
    
         
            +
                    Option = Test::Option
         
     | 
| 
       23 
23 
     | 
    
         
             
                    String = Mock::String
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                    ARCHIVE_PATH          = Common::ARCHIVE_PATH
         
     | 
| 
         @@ -627,19 +627,21 @@ module ADSP 
     | 
|
| 
       627 
627 
     | 
    
         
             
                    end
         
     | 
| 
       628 
628 
     | 
    
         | 
| 
       629 
629 
     | 
    
         
             
                    def get_invalid_decompressor_options(&block)
         
     | 
| 
       630 
     | 
    
         
            -
                       
     | 
| 
      
 630 
     | 
    
         
            +
                      option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
         
     | 
| 
       631 
631 
     | 
    
         
             
                    end
         
     | 
| 
       632 
632 
     | 
    
         | 
| 
       633 
633 
     | 
    
         
             
                    def parallel_compressor_options(&block)
         
     | 
| 
       634 
     | 
    
         
            -
                      Common.parallel_options  
     | 
| 
      
 634 
     | 
    
         
            +
                      Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
         
     | 
| 
       635 
635 
     | 
    
         
             
                    end
         
     | 
| 
       636 
636 
     | 
    
         | 
| 
       637 
637 
     | 
    
         
             
                    def get_compatible_decompressor_options(compressor_options, &block)
         
     | 
| 
       638 
     | 
    
         
            -
                       
     | 
| 
      
 638 
     | 
    
         
            +
                      option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
         
     | 
| 
       639 
639 
     | 
    
         
             
                    end
         
     | 
| 
       640 
     | 
    
         
            -
                  end
         
     | 
| 
       641 
640 
     | 
    
         | 
| 
       642 
     | 
    
         
            -
             
     | 
| 
      
 641 
     | 
    
         
            +
                    def option
         
     | 
| 
      
 642 
     | 
    
         
            +
                      self.class::Option
         
     | 
| 
      
 643 
     | 
    
         
            +
                    end
         
     | 
| 
      
 644 
     | 
    
         
            +
                  end
         
     | 
| 
       643 
645 
     | 
    
         
             
                end
         
     | 
| 
       644 
646 
     | 
    
         
             
              end
         
     | 
| 
       645 
647 
     | 
    
         
             
            end
         
     | 
| 
         @@ -18,6 +18,7 @@ module ADSP 
     | 
|
| 
       18 
18 
     | 
    
         
             
                  # ADSP::Test::Stream::ReaderHelpers class.
         
     | 
| 
       19 
19 
     | 
    
         
             
                  class ReaderHelpers < Minitest::Test
         
     | 
| 
       20 
20 
     | 
    
         
             
                    Target = Mock::Stream::Reader
         
     | 
| 
      
 21 
     | 
    
         
            +
                    Option = Test::Option
         
     | 
| 
       21 
22 
     | 
    
         
             
                    String = Mock::String
         
     | 
| 
       22 
23 
     | 
    
         | 
| 
       23 
24 
     | 
    
         
             
                    ARCHIVE_PATH      = Common::ARCHIVE_PATH
         
     | 
| 
         @@ -53,7 +54,7 @@ module ADSP 
     | 
|
| 
       53 
54 
     | 
    
         
             
                          write_archive archive_path, text, compressor_options
         
     | 
| 
       54 
55 
     | 
    
         | 
| 
       55 
56 
     | 
    
         
             
                          get_compatible_decompressor_options compressor_options do |decompressor_options|
         
     | 
| 
       56 
     | 
    
         
            -
                             
     | 
| 
      
 57 
     | 
    
         
            +
                            target.open archive_path, decompressor_options do |instance|
         
     | 
| 
       57 
58 
     | 
    
         
             
                              # getbyte
         
     | 
| 
       58 
59 
     | 
    
         | 
| 
       59 
60 
     | 
    
         
             
                              byte = instance.getbyte
         
     | 
| 
         @@ -101,7 +102,7 @@ module ADSP 
     | 
|
| 
       101 
102 
     | 
    
         
             
                          write_archive archive_path, text, compressor_options
         
     | 
| 
       102 
103 
     | 
    
         | 
| 
       103 
104 
     | 
    
         
             
                          get_compatible_decompressor_options compressor_options do |decompressor_options|
         
     | 
| 
       104 
     | 
    
         
            -
                             
     | 
| 
      
 105 
     | 
    
         
            +
                            target.open archive_path, decompressor_options do |instance|
         
     | 
| 
       105 
106 
     | 
    
         
             
                              # getc
         
     | 
| 
       106 
107 
     | 
    
         | 
| 
       107 
108 
     | 
    
         
             
                              char = instance.getc
         
     | 
| 
         @@ -142,7 +143,7 @@ module ADSP 
     | 
|
| 
       142 
143 
     | 
    
         
             
                            target_text = text.encode internal_encoding, **TRANSCODE_OPTIONS
         
     | 
| 
       143 
144 
     | 
    
         | 
| 
       144 
145 
     | 
    
         
             
                            get_compatible_decompressor_options compressor_options do |decompressor_options|
         
     | 
| 
       145 
     | 
    
         
            -
                               
     | 
| 
      
 146 
     | 
    
         
            +
                              target.open archive_path, decompressor_options do |instance|
         
     | 
| 
       146 
147 
     | 
    
         
             
                                instance.set_encoding external_encoding, internal_encoding, TRANSCODE_OPTIONS
         
     | 
| 
       147 
148 
     | 
    
         | 
| 
       148 
149 
     | 
    
         
             
                                # getc
         
     | 
| 
         @@ -225,7 +226,7 @@ module ADSP 
     | 
|
| 
       225 
226 
     | 
    
         
             
                            end
         
     | 
| 
       226 
227 
     | 
    
         | 
| 
       227 
228 
     | 
    
         
             
                          get_compatible_decompressor_options compressor_options do |decompressor_options|
         
     | 
| 
       228 
     | 
    
         
            -
                             
     | 
| 
      
 229 
     | 
    
         
            +
                            target.open archive_path, decompressor_options do |instance|
         
     | 
| 
       229 
230 
     | 
    
         
             
                              # lineno
         
     | 
| 
       230 
231 
     | 
    
         | 
| 
       231 
232 
     | 
    
         
             
                              assert_equal 0, instance.lineno
         
     | 
| 
         @@ -313,7 +314,7 @@ module ADSP 
     | 
|
| 
       313 
314 
     | 
    
         
             
                              end
         
     | 
| 
       314 
315 
     | 
    
         | 
| 
       315 
316 
     | 
    
         
             
                            get_compatible_decompressor_options compressor_options do |decompressor_options|
         
     | 
| 
       316 
     | 
    
         
            -
                               
     | 
| 
      
 317 
     | 
    
         
            +
                              target.open archive_path, decompressor_options do |instance|
         
     | 
| 
       317 
318 
     | 
    
         
             
                                instance.set_encoding external_encoding, internal_encoding, TRANSCODE_OPTIONS
         
     | 
| 
       318 
319 
     | 
    
         | 
| 
       319 
320 
     | 
    
         
             
                                # gets
         
     | 
| 
         @@ -358,13 +359,13 @@ module ADSP 
     | 
|
| 
       358 
359 
     | 
    
         
             
                    def test_invalid_open
         
     | 
| 
       359 
360 
     | 
    
         
             
                      Validation::INVALID_STRINGS.each do |invalid_string|
         
     | 
| 
       360 
361 
     | 
    
         
             
                        assert_raises ValidateError do
         
     | 
| 
       361 
     | 
    
         
            -
                           
     | 
| 
      
 362 
     | 
    
         
            +
                          target.open(invalid_string) {} # no-op
         
     | 
| 
       362 
363 
     | 
    
         
             
                        end
         
     | 
| 
       363 
364 
     | 
    
         
             
                      end
         
     | 
| 
       364 
365 
     | 
    
         | 
| 
       365 
366 
     | 
    
         
             
                      # Proc is required.
         
     | 
| 
       366 
367 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       367 
     | 
    
         
            -
                         
     | 
| 
      
 368 
     | 
    
         
            +
                        target.open ARCHIVE_PATH
         
     | 
| 
       368 
369 
     | 
    
         
             
                      end
         
     | 
| 
       369 
370 
     | 
    
         
             
                    end
         
     | 
| 
       370 
371 
     | 
    
         | 
| 
         @@ -376,7 +377,7 @@ module ADSP 
     | 
|
| 
       376 
377 
     | 
    
         
             
                          write_archive archive_path, text, compressor_options
         
     | 
| 
       377 
378 
     | 
    
         | 
| 
       378 
379 
     | 
    
         
             
                          get_compatible_decompressor_options compressor_options do |decompressor_options|
         
     | 
| 
       379 
     | 
    
         
            -
                            decompressed_text =  
     | 
| 
      
 380 
     | 
    
         
            +
                            decompressed_text = target.open archive_path, decompressor_options, &:read
         
     | 
| 
       380 
381 
     | 
    
         
             
                            decompressed_text.force_encoding text.encoding
         
     | 
| 
       381 
382 
     | 
    
         | 
| 
       382 
383 
     | 
    
         
             
                            assert_equal text, decompressed_text
         
     | 
| 
         @@ -390,7 +391,7 @@ module ADSP 
     | 
|
| 
       390 
391 
     | 
    
         
             
                        archive_path = Common.get_path ARCHIVE_PATH, worker_index
         
     | 
| 
       391 
392 
     | 
    
         
             
                        write_archive archive_path, text
         
     | 
| 
       392 
393 
     | 
    
         | 
| 
       393 
     | 
    
         
            -
                        decompressed_text =  
     | 
| 
      
 394 
     | 
    
         
            +
                        decompressed_text = target.open archive_path, &:read
         
     | 
| 
       394 
395 
     | 
    
         
             
                        decompressed_text.force_encoding text.encoding
         
     | 
| 
       395 
396 
     | 
    
         | 
| 
       396 
397 
     | 
    
         
             
                        assert_equal text, decompressed_text
         
     | 
| 
         @@ -405,19 +406,21 @@ module ADSP 
     | 
|
| 
       405 
406 
     | 
    
         
             
                    end
         
     | 
| 
       406 
407 
     | 
    
         | 
| 
       407 
408 
     | 
    
         
             
                    def parallel_compressor_options(&block)
         
     | 
| 
       408 
     | 
    
         
            -
                      Common.parallel_options  
     | 
| 
      
 409 
     | 
    
         
            +
                      Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
         
     | 
| 
       409 
410 
     | 
    
         
             
                    end
         
     | 
| 
       410 
411 
     | 
    
         | 
| 
       411 
412 
     | 
    
         
             
                    def get_compatible_decompressor_options(compressor_options, &block)
         
     | 
| 
       412 
     | 
    
         
            -
                       
     | 
| 
      
 413 
     | 
    
         
            +
                      option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
         
     | 
| 
       413 
414 
     | 
    
         
             
                    end
         
     | 
| 
       414 
415 
     | 
    
         | 
| 
       415 
416 
     | 
    
         
             
                    protected def target
         
     | 
| 
       416 
417 
     | 
    
         
             
                      self.class::Target
         
     | 
| 
       417 
418 
     | 
    
         
             
                    end
         
     | 
| 
       418 
     | 
    
         
            -
                  end
         
     | 
| 
       419 
419 
     | 
    
         | 
| 
       420 
     | 
    
         
            -
             
     | 
| 
      
 420 
     | 
    
         
            +
                    protected def option
         
     | 
| 
      
 421 
     | 
    
         
            +
                      self.class::Option
         
     | 
| 
      
 422 
     | 
    
         
            +
                    end
         
     | 
| 
      
 423 
     | 
    
         
            +
                  end
         
     | 
| 
       421 
424 
     | 
    
         
             
                end
         
     | 
| 
       422 
425 
     | 
    
         
             
              end
         
     | 
| 
       423 
426 
     | 
    
         
             
            end
         
     | 
| 
         @@ -7,7 +7,6 @@ require "stringio" 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            require_relative "abstract"
         
     | 
| 
       9 
9 
     | 
    
         
             
            require_relative "../common"
         
     | 
| 
       10 
     | 
    
         
            -
            require_relative "../minitest"
         
     | 
| 
       11 
10 
     | 
    
         
             
            require_relative "../option"
         
     | 
| 
       12 
11 
     | 
    
         
             
            require_relative "../mock/stream/writer"
         
     | 
| 
       13 
12 
     | 
    
         
             
            require_relative "../mock/string"
         
     | 
| 
         @@ -19,6 +18,7 @@ module ADSP 
     | 
|
| 
       19 
18 
     | 
    
         
             
                  # ADSP::Test::Stream::Writer class.
         
     | 
| 
       20 
19 
     | 
    
         
             
                  class Writer < Abstract
         
     | 
| 
       21 
20 
     | 
    
         
             
                    Target = Mock::Stream::Writer
         
     | 
| 
      
 21 
     | 
    
         
            +
                    Option = Test::Option
         
     | 
| 
       22 
22 
     | 
    
         
             
                    String = Mock::String
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                    ARCHIVE_PATH          = Common::ARCHIVE_PATH
         
     | 
| 
         @@ -594,19 +594,21 @@ module ADSP 
     | 
|
| 
       594 
594 
     | 
    
         
             
                    end
         
     | 
| 
       595 
595 
     | 
    
         | 
| 
       596 
596 
     | 
    
         
             
                    def get_invalid_compressor_options(&block)
         
     | 
| 
       597 
     | 
    
         
            -
                       
     | 
| 
      
 597 
     | 
    
         
            +
                      option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
         
     | 
| 
       598 
598 
     | 
    
         
             
                    end
         
     | 
| 
       599 
599 
     | 
    
         | 
| 
       600 
600 
     | 
    
         
             
                    def parallel_compressor_options(&block)
         
     | 
| 
       601 
     | 
    
         
            -
                      Common.parallel_options  
     | 
| 
      
 601 
     | 
    
         
            +
                      Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
         
     | 
| 
       602 
602 
     | 
    
         
             
                    end
         
     | 
| 
       603 
603 
     | 
    
         | 
| 
       604 
604 
     | 
    
         
             
                    def get_compatible_decompressor_options(compressor_options, &block)
         
     | 
| 
       605 
     | 
    
         
            -
                       
     | 
| 
      
 605 
     | 
    
         
            +
                      option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
         
     | 
| 
       606 
606 
     | 
    
         
             
                    end
         
     | 
| 
       607 
     | 
    
         
            -
                  end
         
     | 
| 
       608 
607 
     | 
    
         | 
| 
       609 
     | 
    
         
            -
             
     | 
| 
      
 608 
     | 
    
         
            +
                    protected def option
         
     | 
| 
      
 609 
     | 
    
         
            +
                      self.class::Option
         
     | 
| 
      
 610 
     | 
    
         
            +
                    end
         
     | 
| 
      
 611 
     | 
    
         
            +
                  end
         
     | 
| 
       610 
612 
     | 
    
         
             
                end
         
     | 
| 
       611 
613 
     | 
    
         
             
              end
         
     | 
| 
       612 
614 
     | 
    
         
             
            end
         
     | 
| 
         @@ -18,6 +18,7 @@ module ADSP 
     | 
|
| 
       18 
18 
     | 
    
         
             
                  # ADSP::Test::Stream::WriterHelpers class.
         
     | 
| 
       19 
19 
     | 
    
         
             
                  class WriterHelpers < Minitest::Test
         
     | 
| 
       20 
20 
     | 
    
         
             
                    Target = Mock::Stream::Writer
         
     | 
| 
      
 21 
     | 
    
         
            +
                    Option = Test::Option
         
     | 
| 
       21 
22 
     | 
    
         
             
                    String = Mock::String
         
     | 
| 
       22 
23 
     | 
    
         | 
| 
       23 
24 
     | 
    
         
             
                    ARCHIVE_PATH          = Common::ARCHIVE_PATH
         
     | 
| 
         @@ -37,7 +38,7 @@ module ADSP 
     | 
|
| 
       37 
38 
     | 
    
         
             
                          PORTION_LENGTHS.each do |portion_length|
         
     | 
| 
       38 
39 
     | 
    
         
             
                            sources = get_sources text, portion_length
         
     | 
| 
       39 
40 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                             
     | 
| 
      
 41 
     | 
    
         
            +
                            target.open archive_path, compressor_options do |instance|
         
     | 
| 
       41 
42 
     | 
    
         
             
                              sources.each { |current_source| instance << current_source }
         
     | 
| 
       42 
43 
     | 
    
         
             
                            end
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
         @@ -65,7 +66,7 @@ module ADSP 
     | 
|
| 
       65 
66 
     | 
    
         
             
                            sources.each { |source| target_text << (source + field_separator) }
         
     | 
| 
       66 
67 
     | 
    
         
             
                            target_text << record_separator
         
     | 
| 
       67 
68 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                             
     | 
| 
      
 69 
     | 
    
         
            +
                            target.open archive_path, compressor_options do |instance|
         
     | 
| 
       69 
70 
     | 
    
         
             
                              keyword_args = { :field_separator => field_separator, :record_separator => record_separator }
         
     | 
| 
       70 
71 
     | 
    
         
             
                              instance.print(*sources, **keyword_args)
         
     | 
| 
       71 
72 
     | 
    
         
             
                            end
         
     | 
| 
         @@ -88,7 +89,7 @@ module ADSP 
     | 
|
| 
       88 
89 
     | 
    
         
             
                          PORTION_LENGTHS.each do |portion_length|
         
     | 
| 
       89 
90 
     | 
    
         
             
                            sources = get_sources text, portion_length
         
     | 
| 
       90 
91 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
                             
     | 
| 
      
 92 
     | 
    
         
            +
                            target.open archive_path, compressor_options do |instance|
         
     | 
| 
       92 
93 
     | 
    
         
             
                              sources.each { |source| instance.printf "%s", source }
         
     | 
| 
       93 
94 
     | 
    
         
             
                            end
         
     | 
| 
       94 
95 
     | 
    
         | 
| 
         @@ -117,7 +118,7 @@ module ADSP 
     | 
|
| 
       117 
118 
     | 
    
         
             
                        archive_path = Common.get_path ARCHIVE_PATH, worker_index
         
     | 
| 
       118 
119 
     | 
    
         | 
| 
       119 
120 
     | 
    
         
             
                        TEXTS.each do |text|
         
     | 
| 
       120 
     | 
    
         
            -
                           
     | 
| 
      
 121 
     | 
    
         
            +
                          target.open archive_path, compressor_options do |instance|
         
     | 
| 
       121 
122 
     | 
    
         
             
                            # Putc should process numbers and strings.
         
     | 
| 
       122 
123 
     | 
    
         
             
                            text.chars.each.with_index do |char, index|
         
     | 
| 
       123 
124 
     | 
    
         
             
                              if index.even?
         
     | 
| 
         @@ -154,7 +155,7 @@ module ADSP 
     | 
|
| 
       154 
155 
     | 
    
         
             
                            target_text = "".encode text.encoding
         
     | 
| 
       155 
156 
     | 
    
         
             
                            sources.each { |source| target_text << (source + newline) }
         
     | 
| 
       156 
157 
     | 
    
         | 
| 
       157 
     | 
    
         
            -
                             
     | 
| 
      
 158 
     | 
    
         
            +
                            target.open archive_path, compressor_options do |instance|
         
     | 
| 
       158 
159 
     | 
    
         
             
                              # Puts should ignore additional newlines and process arrays.
         
     | 
| 
       159 
160 
     | 
    
         
             
                              args = sources.map.with_index do |source, index|
         
     | 
| 
       160 
161 
     | 
    
         
             
                                if index.even?
         
     | 
| 
         @@ -180,13 +181,13 @@ module ADSP 
     | 
|
| 
       180 
181 
     | 
    
         
             
                    def test_invalid_open
         
     | 
| 
       181 
182 
     | 
    
         
             
                      Validation::INVALID_STRINGS.each do |invalid_string|
         
     | 
| 
       182 
183 
     | 
    
         
             
                        assert_raises ValidateError do
         
     | 
| 
       183 
     | 
    
         
            -
                           
     | 
| 
      
 184 
     | 
    
         
            +
                          target.open(invalid_string) {} # no-op
         
     | 
| 
       184 
185 
     | 
    
         
             
                        end
         
     | 
| 
       185 
186 
     | 
    
         
             
                      end
         
     | 
| 
       186 
187 
     | 
    
         | 
| 
       187 
188 
     | 
    
         
             
                      # Proc is required.
         
     | 
| 
       188 
189 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       189 
     | 
    
         
            -
                         
     | 
| 
      
 190 
     | 
    
         
            +
                        target.open ARCHIVE_PATH
         
     | 
| 
       190 
191 
     | 
    
         
             
                      end
         
     | 
| 
       191 
192 
     | 
    
         
             
                    end
         
     | 
| 
       192 
193 
     | 
    
         | 
| 
         @@ -195,7 +196,7 @@ module ADSP 
     | 
|
| 
       195 
196 
     | 
    
         
             
                        archive_path = Common.get_path ARCHIVE_PATH, worker_index
         
     | 
| 
       196 
197 
     | 
    
         | 
| 
       197 
198 
     | 
    
         
             
                        TEXTS.each do |text|
         
     | 
| 
       198 
     | 
    
         
            -
                           
     | 
| 
      
 199 
     | 
    
         
            +
                          target.open(archive_path, compressor_options) { |instance| instance.write text }
         
     | 
| 
       199 
200 
     | 
    
         | 
| 
       200 
201 
     | 
    
         
             
                          compressed_text = ::File.read archive_path, :mode => "rb"
         
     | 
| 
       201 
202 
     | 
    
         | 
| 
         @@ -220,7 +221,7 @@ module ADSP 
     | 
|
| 
       220 
221 
     | 
    
         | 
| 
       221 
222 
     | 
    
         
             
                        sources = get_sources text, portion_length
         
     | 
| 
       222 
223 
     | 
    
         | 
| 
       223 
     | 
    
         
            -
                         
     | 
| 
      
 224 
     | 
    
         
            +
                        target.open archive_path do |instance|
         
     | 
| 
       224 
225 
     | 
    
         
             
                          sources.each { |source| instance.write source }
         
     | 
| 
       225 
226 
     | 
    
         
             
                        end
         
     | 
| 
       226 
227 
     | 
    
         | 
| 
         @@ -251,19 +252,21 @@ module ADSP 
     | 
|
| 
       251 
252 
     | 
    
         
             
                    end
         
     | 
| 
       252 
253 
     | 
    
         | 
| 
       253 
254 
     | 
    
         
             
                    def parallel_compressor_options(&block)
         
     | 
| 
       254 
     | 
    
         
            -
                      Common.parallel_options  
     | 
| 
      
 255 
     | 
    
         
            +
                      Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
         
     | 
| 
       255 
256 
     | 
    
         
             
                    end
         
     | 
| 
       256 
257 
     | 
    
         | 
| 
       257 
258 
     | 
    
         
             
                    def get_compatible_decompressor_options(compressor_options, &block)
         
     | 
| 
       258 
     | 
    
         
            -
                       
     | 
| 
      
 259 
     | 
    
         
            +
                      option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
         
     | 
| 
       259 
260 
     | 
    
         
             
                    end
         
     | 
| 
       260 
261 
     | 
    
         | 
| 
       261 
262 
     | 
    
         
             
                    protected def target
         
     | 
| 
       262 
263 
     | 
    
         
             
                      self.class::Target
         
     | 
| 
       263 
264 
     | 
    
         
             
                    end
         
     | 
| 
       264 
     | 
    
         
            -
                  end
         
     | 
| 
       265 
265 
     | 
    
         | 
| 
       266 
     | 
    
         
            -
             
     | 
| 
      
 266 
     | 
    
         
            +
                    protected def option
         
     | 
| 
      
 267 
     | 
    
         
            +
                      self.class::Option
         
     | 
| 
      
 268 
     | 
    
         
            +
                    end
         
     | 
| 
      
 269 
     | 
    
         
            +
                  end
         
     | 
| 
       267 
270 
     | 
    
         
             
                end
         
     | 
| 
       268 
271 
     | 
    
         
             
              end
         
     | 
| 
       269 
272 
     | 
    
         
             
            end
         
     | 
| 
         @@ -14,8 +14,8 @@ module ADSP 
     | 
|
| 
       14 
14 
     | 
    
         
             
              module Test
         
     | 
| 
       15 
15 
     | 
    
         
             
                # ADSP::Test::String class.
         
     | 
| 
       16 
16 
     | 
    
         
             
                class String < Minitest::Test
         
     | 
| 
       17 
     | 
    
         
            -
                  Option = Test::Option
         
     | 
| 
       18 
17 
     | 
    
         
             
                  Target = Mock::String
         
     | 
| 
      
 18 
     | 
    
         
            +
                  Option = Test::Option
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                  TEXTS       = Common::TEXTS
         
     | 
| 
       21 
21 
     | 
    
         
             
                  LARGE_TEXTS = Common::LARGE_TEXTS
         
     | 
| 
         @@ -26,23 +26,23 @@ module ADSP 
     | 
|
| 
       26 
26 
     | 
    
         
             
                  def test_invalid_arguments
         
     | 
| 
       27 
27 
     | 
    
         
             
                    Validation::INVALID_STRINGS.each do |invalid_string|
         
     | 
| 
       28 
28 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       29 
     | 
    
         
            -
                         
     | 
| 
      
 29 
     | 
    
         
            +
                        target.compress invalid_string
         
     | 
| 
       30 
30 
     | 
    
         
             
                      end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       33 
     | 
    
         
            -
                         
     | 
| 
      
 33 
     | 
    
         
            +
                        target.decompress invalid_string
         
     | 
| 
       34 
34 
     | 
    
         
             
                      end
         
     | 
| 
       35 
35 
     | 
    
         
             
                    end
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
                    get_invalid_compressor_options do |invalid_options|
         
     | 
| 
       38 
38 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       39 
     | 
    
         
            -
                         
     | 
| 
      
 39 
     | 
    
         
            +
                        target.compress "", invalid_options
         
     | 
| 
       40 
40 
     | 
    
         
             
                      end
         
     | 
| 
       41 
41 
     | 
    
         
             
                    end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                    get_invalid_decompressor_options do |invalid_options|
         
     | 
| 
       44 
44 
     | 
    
         
             
                      assert_raises ValidateError do
         
     | 
| 
       45 
     | 
    
         
            -
                         
     | 
| 
      
 45 
     | 
    
         
            +
                        target.decompress "", invalid_options
         
     | 
| 
       46 
46 
     | 
    
         
             
                      end
         
     | 
| 
       47 
47 
     | 
    
         
             
                    end
         
     | 
| 
       48 
48 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -50,10 +50,10 @@ module ADSP 
     | 
|
| 
       50 
50 
     | 
    
         
             
                  def test_texts
         
     | 
| 
       51 
51 
     | 
    
         
             
                    parallel_compressor_options do |compressor_options|
         
     | 
| 
       52 
52 
     | 
    
         
             
                      TEXTS.each do |text|
         
     | 
| 
       53 
     | 
    
         
            -
                        compressed_text =  
     | 
| 
      
 53 
     | 
    
         
            +
                        compressed_text = target.compress text, compressor_options
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
                        get_compatible_decompressor_options compressor_options do |decompressor_options|
         
     | 
| 
       56 
     | 
    
         
            -
                          decompressed_text =  
     | 
| 
      
 56 
     | 
    
         
            +
                          decompressed_text = target.decompress compressed_text, decompressor_options
         
     | 
| 
       57 
57 
     | 
    
         
             
                          decompressed_text.force_encoding text.encoding
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
                          assert_equal text, decompressed_text
         
     | 
| 
         @@ -64,9 +64,9 @@ module ADSP 
     | 
|
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
                  def test_large_texts
         
     | 
| 
       66 
66 
     | 
    
         
             
                    Common.parallel LARGE_TEXTS do |text|
         
     | 
| 
       67 
     | 
    
         
            -
                      compressed_text =  
     | 
| 
      
 67 
     | 
    
         
            +
                      compressed_text = target.compress text
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                      decompressed_text =  
     | 
| 
      
 69 
     | 
    
         
            +
                      decompressed_text = target.decompress compressed_text
         
     | 
| 
       70 
70 
     | 
    
         
             
                      decompressed_text.force_encoding text.encoding
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
72 
     | 
    
         
             
                      assert_equal text, decompressed_text
         
     | 
| 
         @@ -76,22 +76,28 @@ module ADSP 
     | 
|
| 
       76 
76 
     | 
    
         
             
                  # -----
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
78 
     | 
    
         
             
                  def get_invalid_compressor_options(&block)
         
     | 
| 
       79 
     | 
    
         
            -
                     
     | 
| 
      
 79 
     | 
    
         
            +
                    option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
         
     | 
| 
       80 
80 
     | 
    
         
             
                  end
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
       82 
82 
     | 
    
         
             
                  def get_invalid_decompressor_options(&block)
         
     | 
| 
       83 
     | 
    
         
            -
                     
     | 
| 
      
 83 
     | 
    
         
            +
                    option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
         
     | 
| 
       84 
84 
     | 
    
         
             
                  end
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
86 
     | 
    
         
             
                  def parallel_compressor_options(&block)
         
     | 
| 
       87 
     | 
    
         
            -
                    Common.parallel_options  
     | 
| 
      
 87 
     | 
    
         
            +
                    Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
         
     | 
| 
       88 
88 
     | 
    
         
             
                  end
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
90 
     | 
    
         
             
                  def get_compatible_decompressor_options(compressor_options, &block)
         
     | 
| 
       91 
     | 
    
         
            -
                     
     | 
| 
      
 91 
     | 
    
         
            +
                    option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
         
     | 
| 
       92 
92 
     | 
    
         
             
                  end
         
     | 
| 
       93 
     | 
    
         
            -
                end
         
     | 
| 
       94 
93 
     | 
    
         | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
      
 94 
     | 
    
         
            +
                  protected def target
         
     | 
| 
      
 95 
     | 
    
         
            +
                    self.class::Target
         
     | 
| 
      
 96 
     | 
    
         
            +
                  end
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
                  protected def option
         
     | 
| 
      
 99 
     | 
    
         
            +
                    self.class::Option
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
       96 
102 
     | 
    
         
             
              end
         
     | 
| 
       97 
103 
     | 
    
         
             
            end
         
     | 
    
        data/lib/adsp/version.rb
    CHANGED
    
    
    
        data/test/file.test.rb
    ADDED
    
    
    
        data/test/string.test.rb
    ADDED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: adsp
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrew Aladjev
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022-07- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-07-05 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: codecov
         
     | 
| 
         @@ -220,7 +220,7 @@ files: 
     | 
|
| 
       220 
220 
     | 
    
         
             
            - lib/adsp/string.rb
         
     | 
| 
       221 
221 
     | 
    
         
             
            - lib/adsp/test/common.rb
         
     | 
| 
       222 
222 
     | 
    
         
             
            - lib/adsp/test/coverage_helper.rb
         
     | 
| 
       223 
     | 
    
         
            -
            - lib/adsp/test/file. 
     | 
| 
      
 223 
     | 
    
         
            +
            - lib/adsp/test/file.rb
         
     | 
| 
       224 
224 
     | 
    
         
             
            - lib/adsp/test/minitest.rb
         
     | 
| 
       225 
225 
     | 
    
         
             
            - lib/adsp/test/mock/common.rb
         
     | 
| 
       226 
226 
     | 
    
         
             
            - lib/adsp/test/mock/file.rb
         
     | 
| 
         @@ -233,19 +233,29 @@ files: 
     | 
|
| 
       233 
233 
     | 
    
         
             
            - lib/adsp/test/mock/string.rb
         
     | 
| 
       234 
234 
     | 
    
         
             
            - lib/adsp/test/option.rb
         
     | 
| 
       235 
235 
     | 
    
         
             
            - lib/adsp/test/stream/abstract.rb
         
     | 
| 
       236 
     | 
    
         
            -
            - lib/adsp/test/stream/minitar. 
     | 
| 
      
 236 
     | 
    
         
            +
            - lib/adsp/test/stream/minitar.rb
         
     | 
| 
       237 
237 
     | 
    
         
             
            - lib/adsp/test/stream/raw/abstract.rb
         
     | 
| 
       238 
     | 
    
         
            -
            - lib/adsp/test/stream/raw/compressor. 
     | 
| 
       239 
     | 
    
         
            -
            - lib/adsp/test/stream/raw/decompressor. 
     | 
| 
       240 
     | 
    
         
            -
            - lib/adsp/test/stream/reader. 
     | 
| 
       241 
     | 
    
         
            -
            - lib/adsp/test/stream/reader_helpers. 
     | 
| 
       242 
     | 
    
         
            -
            - lib/adsp/test/stream/writer. 
     | 
| 
       243 
     | 
    
         
            -
            - lib/adsp/test/stream/writer_helpers. 
     | 
| 
       244 
     | 
    
         
            -
            - lib/adsp/test/string. 
     | 
| 
      
 238 
     | 
    
         
            +
            - lib/adsp/test/stream/raw/compressor.rb
         
     | 
| 
      
 239 
     | 
    
         
            +
            - lib/adsp/test/stream/raw/decompressor.rb
         
     | 
| 
      
 240 
     | 
    
         
            +
            - lib/adsp/test/stream/reader.rb
         
     | 
| 
      
 241 
     | 
    
         
            +
            - lib/adsp/test/stream/reader_helpers.rb
         
     | 
| 
      
 242 
     | 
    
         
            +
            - lib/adsp/test/stream/writer.rb
         
     | 
| 
      
 243 
     | 
    
         
            +
            - lib/adsp/test/stream/writer_helpers.rb
         
     | 
| 
      
 244 
     | 
    
         
            +
            - lib/adsp/test/string.rb
         
     | 
| 
       245 
245 
     | 
    
         
             
            - lib/adsp/test/validation.rb
         
     | 
| 
       246 
     | 
    
         
            -
            - lib/adsp/test/version. 
     | 
| 
      
 246 
     | 
    
         
            +
            - lib/adsp/test/version.rb
         
     | 
| 
       247 
247 
     | 
    
         
             
            - lib/adsp/validation.rb
         
     | 
| 
       248 
248 
     | 
    
         
             
            - lib/adsp/version.rb
         
     | 
| 
      
 249 
     | 
    
         
            +
            - test/file.test.rb
         
     | 
| 
      
 250 
     | 
    
         
            +
            - test/stream/minitar.test.rb
         
     | 
| 
      
 251 
     | 
    
         
            +
            - test/stream/raw/compressor.test.rb
         
     | 
| 
      
 252 
     | 
    
         
            +
            - test/stream/raw/decompressor.test.rb
         
     | 
| 
      
 253 
     | 
    
         
            +
            - test/stream/reader.test.rb
         
     | 
| 
      
 254 
     | 
    
         
            +
            - test/stream/reader_helpers.test.rb
         
     | 
| 
      
 255 
     | 
    
         
            +
            - test/stream/writer.test.rb
         
     | 
| 
      
 256 
     | 
    
         
            +
            - test/stream/writer_helpers.test.rb
         
     | 
| 
      
 257 
     | 
    
         
            +
            - test/string.test.rb
         
     | 
| 
      
 258 
     | 
    
         
            +
            - test/version.test.rb
         
     | 
| 
       249 
259 
     | 
    
         
             
            homepage: https://github.com/andrew-aladev/adsp
         
     | 
| 
       250 
260 
     | 
    
         
             
            licenses:
         
     | 
| 
       251 
261 
     | 
    
         
             
            - MIT
         
     |