adsp 1.0.5 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb3f0b4f65e18eb1bd36d51816279233b9fce6059f84a2fd878f39016f3506e0
4
- data.tar.gz: e610e82a9400d3dd4b529070ee4e0d4e3dda28a9e79eb3940e8bf59b9092d1c6
3
+ metadata.gz: 32d86726cd1a75724664c013faf1078ec2095b8bf6c130f02988a0eb2931ed3e
4
+ data.tar.gz: ff1d4f5b88f67f27f9aba63eadf422dd6956df66a9859ff7f65c1f0378638e07
5
5
  SHA512:
6
- metadata.gz: a7de963b39f123d68b402d2932ae5b0fa4651191d6528a8584deb7130aa58ee54a721842cd7383de91869ac1b0d3f4f465fa24b672deee528127fb1e82dcb8d6
7
- data.tar.gz: ebafa75561874a797ecf8494bb2a796aecca4324161b67c855148cecb64c9634f78614e34b6aa0bd984fbb768e770a6af8715440a589c9118c740b25c5c7e8f9
6
+ metadata.gz: 0ac4de81703f2744b4b543845c2671af74d9901cf9918239fc5605a3a0a518deddb5f2f2f8d65196c9aef5b0cb2bf75534348e435b37915bd1790f50d5b31eb0
7
+ data.tar.gz: ce186ca32735db134d4dc17508b4737586dc54fcec46993b76dbfb5879454de6a8fec2c9627be304fda6071c5128b30c4590e441397ac94bb26d434f664be9d4
@@ -5,14 +5,14 @@ require "parallel"
5
5
  require "securerandom"
6
6
  require "tempfile"
7
7
 
8
- require_relative "coverage_helper"
9
-
10
8
  module ADSP
11
9
  module Test
12
10
  # ADSP::Test::Common module.
13
11
  module Common
14
12
  BASE_PATH = ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "..", "..")).freeze
13
+
15
14
  TEMP_PATH = ::File.join(BASE_PATH, "tmp").freeze
15
+ FileUtils.mkdir_p TEMP_PATH
16
16
 
17
17
  SOURCE_PATH = ::File.join(TEMP_PATH, "source").freeze
18
18
  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
- Target.compress invalid_path, ARCHIVE_PATH
35
+ target.compress invalid_path, ARCHIVE_PATH
36
36
  end
37
37
 
38
38
  assert_raises ValidateError do
39
- Target.compress SOURCE_PATH, invalid_path
39
+ target.compress SOURCE_PATH, invalid_path
40
40
  end
41
41
 
42
42
  assert_raises ValidateError do
43
- Target.decompress invalid_path, SOURCE_PATH
43
+ target.decompress invalid_path, SOURCE_PATH
44
44
  end
45
45
 
46
46
  assert_raises ValidateError do
47
- Target.decompress ARCHIVE_PATH, invalid_path
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
- Target.compress SOURCE_PATH, ARCHIVE_PATH, invalid_options
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
- Target.decompress ARCHIVE_PATH, SOURCE_PATH, invalid_options
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
- Target.compress source_path, archive_path, compressor_options
71
+ target.compress source_path, archive_path, compressor_options
72
72
 
73
73
  get_compatible_decompressor_options compressor_options do |decompressor_options|
74
- Target.decompress archive_path, source_path, decompressor_options
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
- Target.compress source_path, archive_path
92
- Target.decompress archive_path, source_path
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,19 +101,27 @@ module ADSP
101
101
  # -----
102
102
 
103
103
  def get_invalid_compressor_options(&block)
104
- self.class::Option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
104
+ option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
105
105
  end
106
106
 
107
107
  def get_invalid_decompressor_options(&block)
108
- self.class::Option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
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 self.class::Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
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
- self.class::Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
116
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
117
+ end
118
+
119
+ protected def target
120
+ self.class::Target
121
+ end
122
+
123
+ protected def option
124
+ self.class::Option
117
125
  end
118
126
  end
119
127
  end
@@ -1,6 +1,8 @@
1
1
  # Abstract data stream processor.
2
2
  # Copyright (c) 2021 AUTHORS, MIT License.
3
3
 
4
+ require "stringio"
5
+
4
6
  require_relative "abstract"
5
7
  require_relative "../../common"
6
8
  require_relative "../../mock/stream/raw/compressor"
@@ -16,6 +18,7 @@ module ADSP
16
18
  # ADSP::Test::Stream::Raw::Compressor class.
17
19
  class Compressor < Abstract
18
20
  Target = Mock::Stream::Raw::Compressor
21
+ Option = Test::Option
19
22
  String = Mock::String
20
23
 
21
24
  TEXTS = Common::TEXTS
@@ -29,13 +32,13 @@ module ADSP
29
32
  def test_invalid_initialize
30
33
  get_invalid_compressor_options do |invalid_options|
31
34
  assert_raises ValidateError do
32
- Target.new invalid_options
35
+ target.new invalid_options
33
36
  end
34
37
  end
35
38
  end
36
39
 
37
40
  def test_invalid_write
38
- compressor = Target.new
41
+ compressor = target.new
39
42
 
40
43
  Validation::INVALID_STRINGS.each do |invalid_string|
41
44
  assert_raises ValidateError do
@@ -62,7 +65,7 @@ module ADSP
62
65
  compressed_buffer.set_encoding ::Encoding::BINARY
63
66
 
64
67
  writer = proc { |portion| compressed_buffer << portion }
65
- compressor = Target.new compressor_options
68
+ compressor = target.new compressor_options
66
69
 
67
70
  begin
68
71
  source = "".b
@@ -116,7 +119,7 @@ module ADSP
116
119
  compressed_buffer.set_encoding ::Encoding::BINARY
117
120
 
118
121
  writer = proc { |portion| compressed_buffer << portion }
119
- compressor = Target.new
122
+ compressor = target.new
120
123
 
121
124
  begin
122
125
  source = "".b
@@ -148,15 +151,19 @@ module ADSP
148
151
  # -----
149
152
 
150
153
  def get_invalid_compressor_options(&block)
151
- Option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
154
+ option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
152
155
  end
153
156
 
154
157
  def parallel_compressor_options(&block)
155
- Common.parallel_options Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
158
+ Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
156
159
  end
157
160
 
158
161
  def get_compatible_decompressor_options(compressor_options, &block)
159
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
162
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
163
+ end
164
+
165
+ def option
166
+ self.class::Option
160
167
  end
161
168
  end
162
169
  end
@@ -1,6 +1,8 @@
1
1
  # Abstract data stream processor.
2
2
  # Copyright (c) 2021 AUTHORS, MIT License.
3
3
 
4
+ require "stringio"
5
+
4
6
  require_relative "abstract"
5
7
  require_relative "../../common"
6
8
  require_relative "../../mock/stream/raw/decompressor"
@@ -16,6 +18,7 @@ module ADSP
16
18
  # ADSP::Test::Stream::Raw::Decompressor class.
17
19
  class Decompressor < Abstract
18
20
  Target = Mock::Stream::Raw::Decompressor
21
+ Option = Test::Option
19
22
  String = Mock::String
20
23
 
21
24
  TEXTS = Common::TEXTS
@@ -29,13 +32,13 @@ module ADSP
29
32
  def test_invalid_initialize
30
33
  get_invalid_decompressor_options do |invalid_options|
31
34
  assert_raises ValidateError do
32
- Target.new invalid_options
35
+ target.new invalid_options
33
36
  end
34
37
  end
35
38
  end
36
39
 
37
40
  def test_invalid_read
38
- decompressor = Target.new
41
+ decompressor = target.new
39
42
 
40
43
  Validation::INVALID_STRINGS.each do |invalid_string|
41
44
  assert_raises ValidateError do
@@ -65,7 +68,7 @@ module ADSP
65
68
  decompressed_buffer.set_encoding ::Encoding::BINARY
66
69
 
67
70
  writer = proc { |portion| decompressed_buffer << portion }
68
- decompressor = Target.new decompressor_options
71
+ decompressor = target.new decompressor_options
69
72
 
70
73
  begin
71
74
  source = "".b
@@ -118,7 +121,7 @@ module ADSP
118
121
  decompressed_buffer.set_encoding ::Encoding::BINARY
119
122
 
120
123
  writer = proc { |portion| decompressed_buffer << portion }
121
- decompressor = Target.new
124
+ decompressor = target.new
122
125
 
123
126
  begin
124
127
  source = "".b
@@ -148,15 +151,19 @@ module ADSP
148
151
  # -----
149
152
 
150
153
  def get_invalid_decompressor_options(&block)
151
- Option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
154
+ option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
152
155
  end
153
156
 
154
157
  def parallel_compressor_options(&block)
155
- Common.parallel_options Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
158
+ Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
156
159
  end
157
160
 
158
161
  def get_compatible_decompressor_options(compressor_options, &block)
159
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
162
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
163
+ end
164
+
165
+ def option
166
+ self.class::Option
160
167
  end
161
168
  end
162
169
  end
@@ -19,6 +19,7 @@ module ADSP
19
19
  # ADSP::Test::Stream::Reader class.
20
20
  class Reader < Abstract
21
21
  Target = Mock::Stream::Reader
22
+ Option = Test::Option
22
23
  String = Mock::String
23
24
 
24
25
  ARCHIVE_PATH = Common::ARCHIVE_PATH
@@ -626,15 +627,19 @@ module ADSP
626
627
  end
627
628
 
628
629
  def get_invalid_decompressor_options(&block)
629
- Option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
630
+ option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
630
631
  end
631
632
 
632
633
  def parallel_compressor_options(&block)
633
- Common.parallel_options Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
634
+ Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
634
635
  end
635
636
 
636
637
  def get_compatible_decompressor_options(compressor_options, &block)
637
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
638
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
639
+ end
640
+
641
+ def option
642
+ self.class::Option
638
643
  end
639
644
  end
640
645
  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
- Target.open archive_path, decompressor_options do |instance|
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
- Target.open archive_path, decompressor_options do |instance|
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
- Target.open archive_path, decompressor_options do |instance|
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
- Target.open archive_path, decompressor_options do |instance|
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
- Target.open archive_path, decompressor_options do |instance|
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
- Target.open(invalid_string) {} # no-op
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
- Target.open ARCHIVE_PATH
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 = Target.open archive_path, decompressor_options, &:read
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 = Target.open archive_path, &:read
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,16 +406,20 @@ module ADSP
405
406
  end
406
407
 
407
408
  def parallel_compressor_options(&block)
408
- Common.parallel_options Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
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
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
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
419
+
420
+ protected def option
421
+ self.class::Option
422
+ end
418
423
  end
419
424
  end
420
425
  end
@@ -18,6 +18,7 @@ module ADSP
18
18
  # ADSP::Test::Stream::Writer class.
19
19
  class Writer < Abstract
20
20
  Target = Mock::Stream::Writer
21
+ Option = Test::Option
21
22
  String = Mock::String
22
23
 
23
24
  ARCHIVE_PATH = Common::ARCHIVE_PATH
@@ -593,15 +594,19 @@ module ADSP
593
594
  end
594
595
 
595
596
  def get_invalid_compressor_options(&block)
596
- Option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
597
+ option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
597
598
  end
598
599
 
599
600
  def parallel_compressor_options(&block)
600
- Common.parallel_options Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
601
+ Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
601
602
  end
602
603
 
603
604
  def get_compatible_decompressor_options(compressor_options, &block)
604
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
605
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
606
+ end
607
+
608
+ protected def option
609
+ self.class::Option
605
610
  end
606
611
  end
607
612
  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
- Target.open archive_path, compressor_options do |instance|
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
- Target.open archive_path, compressor_options do |instance|
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
- Target.open archive_path, compressor_options do |instance|
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
- Target.open archive_path, compressor_options do |instance|
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
- Target.open archive_path, compressor_options do |instance|
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
- Target.open(invalid_string) {} # no-op
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
- Target.open ARCHIVE_PATH
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
- Target.open(archive_path, compressor_options) { |instance| instance.write text }
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
- Target.open archive_path do |instance|
224
+ target.open archive_path do |instance|
224
225
  sources.each { |source| instance.write source }
225
226
  end
226
227
 
@@ -251,16 +252,20 @@ module ADSP
251
252
  end
252
253
 
253
254
  def parallel_compressor_options(&block)
254
- Common.parallel_options Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
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
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
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
265
+
266
+ protected def option
267
+ self.class::Option
268
+ end
264
269
  end
265
270
  end
266
271
  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
- Target.compress invalid_string
29
+ target.compress invalid_string
30
30
  end
31
31
 
32
32
  assert_raises ValidateError do
33
- Target.decompress invalid_string
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
- Target.compress "", invalid_options
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
- Target.decompress "", invalid_options
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 = Target.compress text, compressor_options
53
+ compressed_text = target.compress text, compressor_options
54
54
 
55
55
  get_compatible_decompressor_options compressor_options do |decompressor_options|
56
- decompressed_text = Target.decompress compressed_text, decompressor_options
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 = Target.compress text
67
+ compressed_text = target.compress text
68
68
 
69
- decompressed_text = Target.decompress compressed_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,19 +76,27 @@ module ADSP
76
76
  # -----
77
77
 
78
78
  def get_invalid_compressor_options(&block)
79
- self.class::Option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
79
+ option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
80
80
  end
81
81
 
82
82
  def get_invalid_decompressor_options(&block)
83
- self.class::Option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
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 self.class::Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
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
- self.class::Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
91
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
92
+ end
93
+
94
+ protected def target
95
+ self.class::Target
96
+ end
97
+
98
+ protected def option
99
+ self.class::Option
92
100
  end
93
101
  end
94
102
  end
data/lib/adsp/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  module ADSP
5
5
  # Abstract data stream processor version.
6
- VERSION = "1.0.5".freeze
6
+ VERSION = "1.0.8".freeze
7
7
  end
@@ -13,6 +13,8 @@ if ENV["CI"]
13
13
  )
14
14
 
15
15
  SimpleCov.start do
16
- add_filter %r{^/test/}
16
+ track_files "lib/*.rb"
17
+ track_files "lib/adsp/*.rb"
18
+ track_files "lib/adsp/stream/**/*.rb"
17
19
  end
18
20
  end
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.5
4
+ version: 1.0.8
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-04 00:00:00.000000000 Z
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -219,7 +219,6 @@ files:
219
219
  - lib/adsp/stream/writer_helpers.rb
220
220
  - lib/adsp/string.rb
221
221
  - lib/adsp/test/common.rb
222
- - lib/adsp/test/coverage_helper.rb
223
222
  - lib/adsp/test/file.rb
224
223
  - lib/adsp/test/minitest.rb
225
224
  - lib/adsp/test/mock/common.rb
@@ -246,6 +245,7 @@ files:
246
245
  - lib/adsp/test/version.rb
247
246
  - lib/adsp/validation.rb
248
247
  - lib/adsp/version.rb
248
+ - test/coverage_helper.rb
249
249
  - test/file.test.rb
250
250
  - test/stream/minitar.test.rb
251
251
  - test/stream/raw/compressor.test.rb