adsp 1.0.4 → 1.0.7

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: '0857763064f25aac54a464ab7d50627214315565824b5c507713bf6f43aa40d2'
4
- data.tar.gz: 4c4e2c600b0b887b2855629e3ab712ba6c99ff4b2a0f1f88693a52a400324a1e
3
+ metadata.gz: e422087dd802af37956a5f68224104aa5bc6956bdecfc8c2546afe1aba2ad189
4
+ data.tar.gz: 47a1458df2da0dc26e4418f3ebe4da7d5e1bc8c38eeef2e774fdd1ed25f8cefd
5
5
  SHA512:
6
- metadata.gz: dad7a1bed65e2b4302e7925e3ef4f6905a8edc5f716095af8b7df69c1f024d9a5545d0c3a2390142630b49d7d0ec898e17c959ddc5695b519ab9a0a37beb3b49
7
- data.tar.gz: b1b79e2f89480b872338780a658c76facedb355e7c1d3e8bca2a8d6b77b19e1da7f189b9d022842d3dd398c90752855e0cb517642e2451cd9f0fcf879d800537
6
+ metadata.gz: 04b24a5bb4869c0c41fc984716fb998949e20fb7d9d2df527f8e731b41c6cbe054b040efd674a526dcf70ad3aa47d72d1509a6493b5ad4feb05d10f13589eb03
7
+ data.tar.gz: acb3eb79200e4eab7fc9afdb6f973c99bca529a69ed6d10f109537c077be9f96b3310f3f5ddbe1de3c07b8358da15493a5e015f19efd02d869a62b6fd9893f20
@@ -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
- 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,22 +101,28 @@ 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
117
  end
118
- end
119
118
 
120
- Minitest << File
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
@@ -45,8 +45,6 @@ module ADSP
45
45
  end
46
46
  end
47
47
  end
48
-
49
- Minitest << MinitarTest
50
48
  end
51
49
  end
52
50
  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
- Target.new invalid_options
33
+ target.new invalid_options
34
34
  end
35
35
  end
36
36
  end
37
37
 
38
38
  def test_invalid_write
39
- compressor = Target.new
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 = Target.new compressor_options
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 = Target.new
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
- Option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
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 Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
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
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
160
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
161
161
  end
162
- end
163
162
 
164
- Minitest << Compressor
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
- Target.new invalid_options
33
+ target.new invalid_options
34
34
  end
35
35
  end
36
36
  end
37
37
 
38
38
  def test_invalid_read
39
- decompressor = Target.new
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 = Target.new decompressor_options
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 = Target.new
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
- Option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
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 Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
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
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
160
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
161
161
  end
162
- end
163
162
 
164
- Minitest << Decompressor
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
- Option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
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 Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
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
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
638
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
639
639
  end
640
- end
641
640
 
642
- Minitest << Reader
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
- 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,19 +406,21 @@ 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
418
- end
419
419
 
420
- Minitest << ReaderHelpers
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
- Option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
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 Option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
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
- Option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
605
+ option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
606
606
  end
607
- end
608
607
 
609
- Minitest << Writer
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
- 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,19 +252,21 @@ 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
264
- end
265
265
 
266
- Minitest << WriterHelpers
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
- 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,22 +76,28 @@ 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
92
  end
93
- end
94
93
 
95
- Minitest << String
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
@@ -14,7 +14,5 @@ module ADSP
14
14
  refute_nil ADSP::VERSION
15
15
  end
16
16
  end
17
-
18
- Minitest << Version
19
17
  end
20
18
  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.4".freeze
6
+ VERSION = "1.0.7".freeze
7
7
  end
data/test/file.test.rb ADDED
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/file"
6
+
7
+ Minitest << ADSP::Test::File
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/stream/minitar"
6
+
7
+ Minitest << ADSP::Test::Stream::MinitarTest
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/stream/raw/compressor"
6
+
7
+ Minitest << ADSP::Test::Stream::Raw::Compressor
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/stream/raw/decompressor"
6
+
7
+ Minitest << ADSP::Test::Stream::Raw::Decompressor
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/stream/reader"
6
+
7
+ Minitest << ADSP::Test::Stream::Reader
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/stream/reader_helpers"
6
+
7
+ Minitest << ADSP::Test::Stream::ReaderHelpers
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/stream/writer"
6
+
7
+ Minitest << ADSP::Test::Stream::Writer
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/stream/writer_helpers"
6
+
7
+ Minitest << ADSP::Test::Stream::WriterHelpers
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/string"
6
+
7
+ Minitest << ADSP::Test::String
@@ -0,0 +1,7 @@
1
+ # Abstract data stream processor.
2
+ # Copyright (c) 2021 AUTHORS, MIT License.
3
+
4
+ require "adsp/test/minitest"
5
+ require "adsp/test/version"
6
+
7
+ Minitest << ADSP::Test::Version
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
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-04 00:00:00.000000000 Z
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.test.rb
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.test.rb
236
+ - lib/adsp/test/stream/minitar.rb
237
237
  - lib/adsp/test/stream/raw/abstract.rb
238
- - lib/adsp/test/stream/raw/compressor.test.rb
239
- - lib/adsp/test/stream/raw/decompressor.test.rb
240
- - lib/adsp/test/stream/reader.test.rb
241
- - lib/adsp/test/stream/reader_helpers.test.rb
242
- - lib/adsp/test/stream/writer.test.rb
243
- - lib/adsp/test/stream/writer_helpers.test.rb
244
- - lib/adsp/test/string.test.rb
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.test.rb
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