adsp 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/adsp/test/file.rb +23 -15
- data/lib/adsp/test/stream/raw/compressor.rb +12 -7
- data/lib/adsp/test/stream/raw/decompressor.rb +12 -7
- data/lib/adsp/test/stream/reader.rb +8 -3
- data/lib/adsp/test/stream/reader_helpers.rb +16 -11
- data/lib/adsp/test/stream/writer.rb +8 -3
- data/lib/adsp/test/stream/writer_helpers.rb +16 -11
- data/lib/adsp/test/string.rb +21 -13
- data/lib/adsp/version.rb +1 -1
- metadata +2 -2
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/file.rb
CHANGED
@@ -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,19 +101,27 @@ 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
|
+
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
|
@@ -16,6 +16,7 @@ module ADSP
|
|
16
16
|
# ADSP::Test::Stream::Raw::Compressor class.
|
17
17
|
class Compressor < Abstract
|
18
18
|
Target = Mock::Stream::Raw::Compressor
|
19
|
+
Option = Test::Option
|
19
20
|
String = Mock::String
|
20
21
|
|
21
22
|
TEXTS = Common::TEXTS
|
@@ -29,13 +30,13 @@ module ADSP
|
|
29
30
|
def test_invalid_initialize
|
30
31
|
get_invalid_compressor_options do |invalid_options|
|
31
32
|
assert_raises ValidateError do
|
32
|
-
|
33
|
+
target.new invalid_options
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
38
|
def test_invalid_write
|
38
|
-
compressor =
|
39
|
+
compressor = target.new
|
39
40
|
|
40
41
|
Validation::INVALID_STRINGS.each do |invalid_string|
|
41
42
|
assert_raises ValidateError do
|
@@ -62,7 +63,7 @@ module ADSP
|
|
62
63
|
compressed_buffer.set_encoding ::Encoding::BINARY
|
63
64
|
|
64
65
|
writer = proc { |portion| compressed_buffer << portion }
|
65
|
-
compressor =
|
66
|
+
compressor = target.new compressor_options
|
66
67
|
|
67
68
|
begin
|
68
69
|
source = "".b
|
@@ -116,7 +117,7 @@ module ADSP
|
|
116
117
|
compressed_buffer.set_encoding ::Encoding::BINARY
|
117
118
|
|
118
119
|
writer = proc { |portion| compressed_buffer << portion }
|
119
|
-
compressor =
|
120
|
+
compressor = target.new
|
120
121
|
|
121
122
|
begin
|
122
123
|
source = "".b
|
@@ -148,15 +149,19 @@ module ADSP
|
|
148
149
|
# -----
|
149
150
|
|
150
151
|
def get_invalid_compressor_options(&block)
|
151
|
-
|
152
|
+
option.get_invalid_compressor_options BUFFER_LENGTH_NAMES, &block
|
152
153
|
end
|
153
154
|
|
154
155
|
def parallel_compressor_options(&block)
|
155
|
-
Common.parallel_options
|
156
|
+
Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
|
156
157
|
end
|
157
158
|
|
158
159
|
def get_compatible_decompressor_options(compressor_options, &block)
|
159
|
-
|
160
|
+
option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
|
161
|
+
end
|
162
|
+
|
163
|
+
def option
|
164
|
+
self.class::Option
|
160
165
|
end
|
161
166
|
end
|
162
167
|
end
|
@@ -16,6 +16,7 @@ module ADSP
|
|
16
16
|
# ADSP::Test::Stream::Raw::Decompressor class.
|
17
17
|
class Decompressor < Abstract
|
18
18
|
Target = Mock::Stream::Raw::Decompressor
|
19
|
+
Option = Test::Option
|
19
20
|
String = Mock::String
|
20
21
|
|
21
22
|
TEXTS = Common::TEXTS
|
@@ -29,13 +30,13 @@ module ADSP
|
|
29
30
|
def test_invalid_initialize
|
30
31
|
get_invalid_decompressor_options do |invalid_options|
|
31
32
|
assert_raises ValidateError do
|
32
|
-
|
33
|
+
target.new invalid_options
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
38
|
def test_invalid_read
|
38
|
-
decompressor =
|
39
|
+
decompressor = target.new
|
39
40
|
|
40
41
|
Validation::INVALID_STRINGS.each do |invalid_string|
|
41
42
|
assert_raises ValidateError do
|
@@ -65,7 +66,7 @@ module ADSP
|
|
65
66
|
decompressed_buffer.set_encoding ::Encoding::BINARY
|
66
67
|
|
67
68
|
writer = proc { |portion| decompressed_buffer << portion }
|
68
|
-
decompressor =
|
69
|
+
decompressor = target.new decompressor_options
|
69
70
|
|
70
71
|
begin
|
71
72
|
source = "".b
|
@@ -118,7 +119,7 @@ module ADSP
|
|
118
119
|
decompressed_buffer.set_encoding ::Encoding::BINARY
|
119
120
|
|
120
121
|
writer = proc { |portion| decompressed_buffer << portion }
|
121
|
-
decompressor =
|
122
|
+
decompressor = target.new
|
122
123
|
|
123
124
|
begin
|
124
125
|
source = "".b
|
@@ -148,15 +149,19 @@ module ADSP
|
|
148
149
|
# -----
|
149
150
|
|
150
151
|
def get_invalid_decompressor_options(&block)
|
151
|
-
|
152
|
+
option.get_invalid_decompressor_options BUFFER_LENGTH_NAMES, &block
|
152
153
|
end
|
153
154
|
|
154
155
|
def parallel_compressor_options(&block)
|
155
|
-
Common.parallel_options
|
156
|
+
Common.parallel_options option.get_compressor_options_generator(BUFFER_LENGTH_NAMES), &block
|
156
157
|
end
|
157
158
|
|
158
159
|
def get_compatible_decompressor_options(compressor_options, &block)
|
159
|
-
|
160
|
+
option.get_compatible_decompressor_options compressor_options, BUFFER_LENGTH_MAPPING, &block
|
161
|
+
end
|
162
|
+
|
163
|
+
def option
|
164
|
+
self.class::Option
|
160
165
|
end
|
161
166
|
end
|
162
167
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
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,16 +406,20 @@ 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
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
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,16 +252,20 @@ 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
|
265
|
+
|
266
|
+
protected def option
|
267
|
+
self.class::Option
|
268
|
+
end
|
264
269
|
end
|
265
270
|
end
|
266
271
|
end
|
data/lib/adsp/test/string.rb
CHANGED
@@ -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,19 +76,27 @@ 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
|
+
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
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
|