id3tag 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -5
- data/lib/id3tag.rb +11 -4
- data/lib/id3tag/audio_file.rb +7 -1
- data/lib/id3tag/configuration.rb +2 -0
- data/lib/id3tag/id3_v2_frame_parser.rb +12 -8
- data/lib/id3tag/version.rb +1 -1
- metadata +7 -96
- data/.document +0 -5
- data/.gitignore +0 -8
- data/.rspec +0 -1
- data/.travis.yml +0 -15
- data/Gemfile +0 -4
- data/Rakefile +0 -24
- data/id3tag.gemspec +0 -28
- data/spec/features/can_read_non_audio_files_spec.rb +0 -17
- data/spec/features/can_read_tag_v1_spec.rb +0 -15
- data/spec/fixtures/id3v1_and_v2.mp3 +0 -0
- data/spec/fixtures/id3v1_with_track_nr.mp3 +0 -0
- data/spec/fixtures/id3v1_without_track_nr.mp3 +0 -0
- data/spec/fixtures/id3v2.mp3 +0 -0
- data/spec/fixtures/pov_20131018-2100a.mp3.v1_tag_body +0 -0
- data/spec/fixtures/pov_20131018-2100a.mp3.v2_3_tag_body +0 -0
- data/spec/fixtures/signals_1.mp3.v2_3_tag_body +0 -0
- data/spec/id3tag_extract_tags +0 -18
- data/spec/lib/id3tag/audio_file_spec.rb +0 -131
- data/spec/lib/id3tag/frames/util/genre_name_by_id_finder_spec.rb +0 -18
- data/spec/lib/id3tag/frames/v1/comments_frame_spec.rb +0 -39
- data/spec/lib/id3tag/frames/v1/genre_frame_spec.rb +0 -20
- data/spec/lib/id3tag/frames/v1/text_frame_spec.rb +0 -14
- data/spec/lib/id3tag/frames/v1/track_nr_frame_spec.rb +0 -19
- data/spec/lib/id3tag/frames/v2/basic_frame_spec.rb +0 -140
- data/spec/lib/id3tag/frames/v2/comments_frame_spec.rb +0 -45
- data/spec/lib/id3tag/frames/v2/frame_fabricator_spec.rb +0 -70
- data/spec/lib/id3tag/frames/v2/frame_flags_spec.rb +0 -588
- data/spec/lib/id3tag/frames/v2/genre_frame/genre_parser_24_spec.rb +0 -26
- data/spec/lib/id3tag/frames/v2/genre_frame/genre_parser_pre_24_spec.rb +0 -48
- data/spec/lib/id3tag/frames/v2/genre_frame/genre_parser_spec.rb +0 -13
- data/spec/lib/id3tag/frames/v2/genre_frame_spec.rb +0 -61
- data/spec/lib/id3tag/frames/v2/picture_frame_spec.rb +0 -127
- data/spec/lib/id3tag/frames/v2/text_frame_spec.rb +0 -89
- data/spec/lib/id3tag/frames/v2/unique_file_id_frame_spec.rb +0 -31
- data/spec/lib/id3tag/frames/v2/user_text_frame_spec.rb +0 -34
- data/spec/lib/id3tag/id3_v1_frame_parser_spec.rb +0 -71
- data/spec/lib/id3tag/id3_v2_frame_parser_spec.rb +0 -32
- data/spec/lib/id3tag/id3_v2_tag_header_spec.rb +0 -149
- data/spec/lib/id3tag/id3tag_spec.rb +0 -17
- data/spec/lib/id3tag/io_util_spec.rb +0 -30
- data/spec/lib/id3tag/number_util_spec.rb +0 -32
- data/spec/lib/id3tag/string_util_spec.rb +0 -81
- data/spec/lib/id3tag/synchsafe_integer_spec.rb +0 -14
- data/spec/lib/id3tag/tag_spec.rb +0 -352
- data/spec/spec_helper.rb +0 -23
- data/spec/support/mp3_fixtures.rb +0 -4
- data/standard_documents/id3v2-00.txt +0 -1657
- data/standard_documents/id3v2.3.0.txt +0 -2022
- data/standard_documents/id3v2.4.0-frames.txt +0 -1732
- data/standard_documents/id3v2.4.0-structure.txt +0 -732
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ID3Tag::Frames::V2::FrameFabricator do
|
4
|
-
let(:id) { nil }
|
5
|
-
let(:content) { 'some content' }
|
6
|
-
let(:flags) { nil }
|
7
|
-
let(:major_version_number) { 4 }
|
8
|
-
|
9
|
-
describe "self#fabricate" do
|
10
|
-
subject { described_class.fabricate(id, content, flags, major_version_number) }
|
11
|
-
context "when frame is a genre frame TCON" do
|
12
|
-
let(:id) { "TCON" }
|
13
|
-
it "fabricates genre frame" do
|
14
|
-
expect(ID3Tag::Frames::V2::GenreFrame).to receive(:new).with(id, content, flags, major_version_number)
|
15
|
-
subject
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "when frame is a genre frame TCO" do
|
20
|
-
let(:id) { "TCO" }
|
21
|
-
it "fabricates genre frame" do
|
22
|
-
expect(ID3Tag::Frames::V2::GenreFrame).to receive(:new).with(id, content, flags, major_version_number)
|
23
|
-
subject
|
24
|
-
end
|
25
|
-
end
|
26
|
-
context "when frame is a text frame TIT2" do
|
27
|
-
let(:id) { "TIT2" }
|
28
|
-
it "fabricates text frame" do
|
29
|
-
expect(ID3Tag::Frames::V2::TextFrame).to receive(:new).with(id, content, flags, major_version_number)
|
30
|
-
subject
|
31
|
-
end
|
32
|
-
end
|
33
|
-
context "when frame is a user text frame" do
|
34
|
-
let(:id) { "TXX" }
|
35
|
-
it "fabricates user text frame" do
|
36
|
-
expect(ID3Tag::Frames::V2::UserTextFrame).to receive(:new).with(id, content, flags, major_version_number)
|
37
|
-
subject
|
38
|
-
end
|
39
|
-
end
|
40
|
-
context "when frame is a comment frame COM" do
|
41
|
-
let(:id) { "COMM" }
|
42
|
-
it "fabricates comment frame" do
|
43
|
-
expect(ID3Tag::Frames::V2::CommentsFrame).to receive(:new).with(id, content, flags, major_version_number)
|
44
|
-
subject
|
45
|
-
end
|
46
|
-
end
|
47
|
-
context "when frame is a unique id" do
|
48
|
-
let(:id) { "UFID" }
|
49
|
-
it "fabricates unique id frame" do
|
50
|
-
expect(ID3Tag::Frames::V2::UniqueFileIdFrame).to receive(:new).with(id, content, flags, major_version_number)
|
51
|
-
subject
|
52
|
-
end
|
53
|
-
end
|
54
|
-
context "when frame is a unique id" do
|
55
|
-
let(:id) { "IPLS" }
|
56
|
-
it "fabricates involved people list frame" do
|
57
|
-
expect(ID3Tag::Frames::V2::InvolvedPeopleListFrame).to receive(:new).with(id, content, flags, major_version_number)
|
58
|
-
subject
|
59
|
-
end
|
60
|
-
end
|
61
|
-
context "when frame is a unknown" do
|
62
|
-
let(:id) { "unknown" }
|
63
|
-
it "fabricates basic frame" do
|
64
|
-
expect(ID3Tag::Frames::V2::BasicFrame).to receive(:new).with(id, content, flags, major_version_number)
|
65
|
-
subject
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
@@ -1,588 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ID3Tag::Frames::V2::FrameFlags do
|
4
|
-
subject { described_class.new(flag_bytes, version) }
|
5
|
-
|
6
|
-
context "When major version is 2" do
|
7
|
-
let(:flag_bytes) { nil }
|
8
|
-
let(:version) { 2 }
|
9
|
-
|
10
|
-
describe '#preserve_on_tag_alteration?' do
|
11
|
-
subject { super().preserve_on_tag_alteration? }
|
12
|
-
it { is_expected.to eq(true) }
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#preserve_on_file_alteration?' do
|
16
|
-
subject { super().preserve_on_file_alteration? }
|
17
|
-
it { is_expected.to eq(true) }
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#read_only?' do
|
21
|
-
subject { super().read_only? }
|
22
|
-
it { is_expected.to eq(false) }
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#compressed?' do
|
26
|
-
subject { super().compressed? }
|
27
|
-
it { is_expected.to eq(false) }
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#encrypted?' do
|
31
|
-
subject { super().encrypted? }
|
32
|
-
it { is_expected.to eq(false) }
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#grouped?' do
|
36
|
-
subject { super().grouped? }
|
37
|
-
it { is_expected.to eq(false) }
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#unsynchronised?' do
|
41
|
-
subject { super().unsynchronised? }
|
42
|
-
it { is_expected.to eq(false) }
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#data_length_indicator?' do
|
46
|
-
subject { super().data_length_indicator? }
|
47
|
-
it { is_expected.to eq(false) }
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '#additional_info_byte_count' do
|
51
|
-
subject { super().additional_info_byte_count }
|
52
|
-
it { is_expected.to eq 0 }
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '#position_and_count_of_data_length_bytes' do
|
56
|
-
subject { super().position_and_count_of_data_length_bytes }
|
57
|
-
it { is_expected.to eq nil }
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#position_and_count_of_group_id_bytes' do
|
61
|
-
subject { super().position_and_count_of_group_id_bytes }
|
62
|
-
it { is_expected.to eq nil }
|
63
|
-
end
|
64
|
-
|
65
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
66
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
67
|
-
it { is_expected.to eq nil }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context "when major version is 3" do
|
72
|
-
let(:version) { 3 }
|
73
|
-
context "when all flags are nulled" do
|
74
|
-
let(:flag_bytes) { [0b00000000, 0b00000000].pack("C2") }
|
75
|
-
|
76
|
-
describe '#preserve_on_tag_alteration?' do
|
77
|
-
subject { super().preserve_on_tag_alteration? }
|
78
|
-
it { is_expected.to eq(true) }
|
79
|
-
end
|
80
|
-
|
81
|
-
describe '#preserve_on_file_alteration?' do
|
82
|
-
subject { super().preserve_on_file_alteration? }
|
83
|
-
it { is_expected.to eq(true) }
|
84
|
-
end
|
85
|
-
|
86
|
-
describe '#read_only?' do
|
87
|
-
subject { super().read_only? }
|
88
|
-
it { is_expected.to eq(false) }
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '#compressed?' do
|
92
|
-
subject { super().compressed? }
|
93
|
-
it { is_expected.to eq(false) }
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '#encrypted?' do
|
97
|
-
subject { super().encrypted? }
|
98
|
-
it { is_expected.to eq(false) }
|
99
|
-
end
|
100
|
-
|
101
|
-
describe '#grouped?' do
|
102
|
-
subject { super().grouped? }
|
103
|
-
it { is_expected.to eq(false) }
|
104
|
-
end
|
105
|
-
|
106
|
-
describe '#unsynchronised?' do
|
107
|
-
subject { super().unsynchronised? }
|
108
|
-
it { is_expected.to eq(false) }
|
109
|
-
end
|
110
|
-
|
111
|
-
describe '#data_length_indicator?' do
|
112
|
-
subject { super().data_length_indicator? }
|
113
|
-
it { is_expected.to eq(false) }
|
114
|
-
end
|
115
|
-
|
116
|
-
describe '#additional_info_byte_count' do
|
117
|
-
subject { super().additional_info_byte_count }
|
118
|
-
it { is_expected.to eq 0 }
|
119
|
-
end
|
120
|
-
|
121
|
-
describe '#position_and_count_of_data_length_bytes' do
|
122
|
-
subject { super().position_and_count_of_data_length_bytes }
|
123
|
-
it { is_expected.to eq nil }
|
124
|
-
end
|
125
|
-
|
126
|
-
describe '#position_and_count_of_group_id_bytes' do
|
127
|
-
subject { super().position_and_count_of_group_id_bytes }
|
128
|
-
it { is_expected.to eq nil }
|
129
|
-
end
|
130
|
-
|
131
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
132
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
133
|
-
it { is_expected.to eq nil }
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context "when compression is on" do
|
138
|
-
let(:flag_bytes) { [0b00000000, 0b10000000].pack("C2") }
|
139
|
-
|
140
|
-
describe '#preserve_on_tag_alteration?' do
|
141
|
-
subject { super().preserve_on_tag_alteration? }
|
142
|
-
it { is_expected.to eq(true) }
|
143
|
-
end
|
144
|
-
|
145
|
-
describe '#preserve_on_file_alteration?' do
|
146
|
-
subject { super().preserve_on_file_alteration? }
|
147
|
-
it { is_expected.to eq(true) }
|
148
|
-
end
|
149
|
-
|
150
|
-
describe '#read_only?' do
|
151
|
-
subject { super().read_only? }
|
152
|
-
it { is_expected.to eq(false) }
|
153
|
-
end
|
154
|
-
|
155
|
-
describe '#compressed?' do
|
156
|
-
subject { super().compressed? }
|
157
|
-
it { is_expected.to eq(true) }
|
158
|
-
end
|
159
|
-
|
160
|
-
describe '#encrypted?' do
|
161
|
-
subject { super().encrypted? }
|
162
|
-
it { is_expected.to eq(false) }
|
163
|
-
end
|
164
|
-
|
165
|
-
describe '#grouped?' do
|
166
|
-
subject { super().grouped? }
|
167
|
-
it { is_expected.to eq(false) }
|
168
|
-
end
|
169
|
-
|
170
|
-
describe '#unsynchronised?' do
|
171
|
-
subject { super().unsynchronised? }
|
172
|
-
it { is_expected.to eq(false) }
|
173
|
-
end
|
174
|
-
|
175
|
-
describe '#data_length_indicator?' do
|
176
|
-
subject { super().data_length_indicator? }
|
177
|
-
it { is_expected.to eq(false) }
|
178
|
-
end
|
179
|
-
|
180
|
-
describe '#additional_info_byte_count' do
|
181
|
-
subject { super().additional_info_byte_count }
|
182
|
-
it { is_expected.to eq 4 }
|
183
|
-
end
|
184
|
-
|
185
|
-
describe '#position_and_count_of_data_length_bytes' do
|
186
|
-
subject { super().position_and_count_of_data_length_bytes }
|
187
|
-
it { is_expected.to eq [0, 4] }
|
188
|
-
end
|
189
|
-
|
190
|
-
describe '#position_and_count_of_group_id_bytes' do
|
191
|
-
subject { super().position_and_count_of_group_id_bytes }
|
192
|
-
it { is_expected.to eq nil }
|
193
|
-
end
|
194
|
-
|
195
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
196
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
197
|
-
it { is_expected.to eq nil }
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
context "when compression and group id is on" do
|
202
|
-
let(:flag_bytes) { [0b00000000, 0b10100000].pack("C2") }
|
203
|
-
|
204
|
-
describe '#preserve_on_tag_alteration?' do
|
205
|
-
subject { super().preserve_on_tag_alteration? }
|
206
|
-
it { is_expected.to eq(true) }
|
207
|
-
end
|
208
|
-
|
209
|
-
describe '#preserve_on_file_alteration?' do
|
210
|
-
subject { super().preserve_on_file_alteration? }
|
211
|
-
it { is_expected.to eq(true) }
|
212
|
-
end
|
213
|
-
|
214
|
-
describe '#read_only?' do
|
215
|
-
subject { super().read_only? }
|
216
|
-
it { is_expected.to eq(false) }
|
217
|
-
end
|
218
|
-
|
219
|
-
describe '#compressed?' do
|
220
|
-
subject { super().compressed? }
|
221
|
-
it { is_expected.to eq(true) }
|
222
|
-
end
|
223
|
-
|
224
|
-
describe '#encrypted?' do
|
225
|
-
subject { super().encrypted? }
|
226
|
-
it { is_expected.to eq(false) }
|
227
|
-
end
|
228
|
-
|
229
|
-
describe '#grouped?' do
|
230
|
-
subject { super().grouped? }
|
231
|
-
it { is_expected.to eq(true) }
|
232
|
-
end
|
233
|
-
|
234
|
-
describe '#unsynchronised?' do
|
235
|
-
subject { super().unsynchronised? }
|
236
|
-
it { is_expected.to eq(false) }
|
237
|
-
end
|
238
|
-
|
239
|
-
describe '#data_length_indicator?' do
|
240
|
-
subject { super().data_length_indicator? }
|
241
|
-
it { is_expected.to eq(false) }
|
242
|
-
end
|
243
|
-
|
244
|
-
describe '#additional_info_byte_count' do
|
245
|
-
subject { super().additional_info_byte_count }
|
246
|
-
it { is_expected.to eq 5 }
|
247
|
-
end
|
248
|
-
|
249
|
-
describe '#position_and_count_of_data_length_bytes' do
|
250
|
-
subject { super().position_and_count_of_data_length_bytes }
|
251
|
-
it { is_expected.to eq [0, 4] }
|
252
|
-
end
|
253
|
-
|
254
|
-
describe '#position_and_count_of_group_id_bytes' do
|
255
|
-
subject { super().position_and_count_of_group_id_bytes }
|
256
|
-
it { is_expected.to eq [4, 1] }
|
257
|
-
end
|
258
|
-
|
259
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
260
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
261
|
-
it { is_expected.to eq nil }
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
context "when all flags are 1" do
|
266
|
-
let(:flag_bytes) { [0b11100000, 0b11100000].pack("C2") }
|
267
|
-
|
268
|
-
describe '#preserve_on_tag_alteration?' do
|
269
|
-
subject { super().preserve_on_tag_alteration? }
|
270
|
-
it { is_expected.to eq(false) }
|
271
|
-
end
|
272
|
-
|
273
|
-
describe '#preserve_on_file_alteration?' do
|
274
|
-
subject { super().preserve_on_file_alteration? }
|
275
|
-
it { is_expected.to eq(false) }
|
276
|
-
end
|
277
|
-
|
278
|
-
describe '#read_only?' do
|
279
|
-
subject { super().read_only? }
|
280
|
-
it { is_expected.to eq(true) }
|
281
|
-
end
|
282
|
-
|
283
|
-
describe '#compressed?' do
|
284
|
-
subject { super().compressed? }
|
285
|
-
it { is_expected.to eq(true) }
|
286
|
-
end
|
287
|
-
|
288
|
-
describe '#encrypted?' do
|
289
|
-
subject { super().encrypted? }
|
290
|
-
it { is_expected.to eq(true) }
|
291
|
-
end
|
292
|
-
|
293
|
-
describe '#grouped?' do
|
294
|
-
subject { super().grouped? }
|
295
|
-
it { is_expected.to eq(true) }
|
296
|
-
end
|
297
|
-
|
298
|
-
describe '#unsynchronised?' do
|
299
|
-
subject { super().unsynchronised? }
|
300
|
-
it { is_expected.to eq(false) }
|
301
|
-
end
|
302
|
-
|
303
|
-
describe '#data_length_indicator?' do
|
304
|
-
subject { super().data_length_indicator? }
|
305
|
-
it { is_expected.to eq(false) }
|
306
|
-
end
|
307
|
-
|
308
|
-
describe '#additional_info_byte_count' do
|
309
|
-
subject { super().additional_info_byte_count }
|
310
|
-
it { is_expected.to eq 6 }
|
311
|
-
end
|
312
|
-
|
313
|
-
describe '#position_and_count_of_data_length_bytes' do
|
314
|
-
subject { super().position_and_count_of_data_length_bytes }
|
315
|
-
it { is_expected.to eq [0, 4] }
|
316
|
-
end
|
317
|
-
|
318
|
-
describe '#position_and_count_of_group_id_bytes' do
|
319
|
-
subject { super().position_and_count_of_group_id_bytes }
|
320
|
-
it { is_expected.to eq [5, 1] }
|
321
|
-
end
|
322
|
-
|
323
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
324
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
325
|
-
it { is_expected.to eq [4, 1] }
|
326
|
-
end
|
327
|
-
end
|
328
|
-
end
|
329
|
-
|
330
|
-
context "when major version is 4" do
|
331
|
-
let(:version) { 4 }
|
332
|
-
context "when all flags are nulled" do
|
333
|
-
let(:flag_bytes) { [0b00000000, 0b00000000].pack("C2") }
|
334
|
-
|
335
|
-
describe '#preserve_on_tag_alteration?' do
|
336
|
-
subject { super().preserve_on_tag_alteration? }
|
337
|
-
it { is_expected.to eq(true) }
|
338
|
-
end
|
339
|
-
|
340
|
-
describe '#preserve_on_file_alteration?' do
|
341
|
-
subject { super().preserve_on_file_alteration? }
|
342
|
-
it { is_expected.to eq(true) }
|
343
|
-
end
|
344
|
-
|
345
|
-
describe '#read_only?' do
|
346
|
-
subject { super().read_only? }
|
347
|
-
it { is_expected.to eq(false) }
|
348
|
-
end
|
349
|
-
|
350
|
-
describe '#compressed?' do
|
351
|
-
subject { super().compressed? }
|
352
|
-
it { is_expected.to eq(false) }
|
353
|
-
end
|
354
|
-
|
355
|
-
describe '#encrypted?' do
|
356
|
-
subject { super().encrypted? }
|
357
|
-
it { is_expected.to eq(false) }
|
358
|
-
end
|
359
|
-
|
360
|
-
describe '#grouped?' do
|
361
|
-
subject { super().grouped? }
|
362
|
-
it { is_expected.to eq(false) }
|
363
|
-
end
|
364
|
-
|
365
|
-
describe '#unsynchronised?' do
|
366
|
-
subject { super().unsynchronised? }
|
367
|
-
it { is_expected.to eq(false) }
|
368
|
-
end
|
369
|
-
|
370
|
-
describe '#data_length_indicator?' do
|
371
|
-
subject { super().data_length_indicator? }
|
372
|
-
it { is_expected.to eq(false) }
|
373
|
-
end
|
374
|
-
|
375
|
-
describe '#additional_info_byte_count' do
|
376
|
-
subject { super().additional_info_byte_count }
|
377
|
-
it { is_expected.to eq 0 }
|
378
|
-
end
|
379
|
-
|
380
|
-
describe '#position_and_count_of_data_length_bytes' do
|
381
|
-
subject { super().position_and_count_of_data_length_bytes }
|
382
|
-
it { is_expected.to eq nil }
|
383
|
-
end
|
384
|
-
|
385
|
-
describe '#position_and_count_of_group_id_bytes' do
|
386
|
-
subject { super().position_and_count_of_group_id_bytes }
|
387
|
-
it { is_expected.to eq nil }
|
388
|
-
end
|
389
|
-
|
390
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
391
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
392
|
-
it { is_expected.to eq nil }
|
393
|
-
end
|
394
|
-
end
|
395
|
-
|
396
|
-
context "when compression is on" do
|
397
|
-
let(:flag_bytes) { [0b00000000, 0b00001001].pack("C2") }
|
398
|
-
|
399
|
-
describe '#preserve_on_tag_alteration?' do
|
400
|
-
subject { super().preserve_on_tag_alteration? }
|
401
|
-
it { is_expected.to eq(true) }
|
402
|
-
end
|
403
|
-
|
404
|
-
describe '#preserve_on_file_alteration?' do
|
405
|
-
subject { super().preserve_on_file_alteration? }
|
406
|
-
it { is_expected.to eq(true) }
|
407
|
-
end
|
408
|
-
|
409
|
-
describe '#read_only?' do
|
410
|
-
subject { super().read_only? }
|
411
|
-
it { is_expected.to eq(false) }
|
412
|
-
end
|
413
|
-
|
414
|
-
describe '#compressed?' do
|
415
|
-
subject { super().compressed? }
|
416
|
-
it { is_expected.to eq(true) }
|
417
|
-
end
|
418
|
-
|
419
|
-
describe '#encrypted?' do
|
420
|
-
subject { super().encrypted? }
|
421
|
-
it { is_expected.to eq(false) }
|
422
|
-
end
|
423
|
-
|
424
|
-
describe '#grouped?' do
|
425
|
-
subject { super().grouped? }
|
426
|
-
it { is_expected.to eq(false) }
|
427
|
-
end
|
428
|
-
|
429
|
-
describe '#unsynchronised?' do
|
430
|
-
subject { super().unsynchronised? }
|
431
|
-
it { is_expected.to eq(false) }
|
432
|
-
end
|
433
|
-
|
434
|
-
describe '#data_length_indicator?' do
|
435
|
-
subject { super().data_length_indicator? }
|
436
|
-
it { is_expected.to eq(true) }
|
437
|
-
end
|
438
|
-
|
439
|
-
describe '#additional_info_byte_count' do
|
440
|
-
subject { super().additional_info_byte_count }
|
441
|
-
it { is_expected.to eq 4 }
|
442
|
-
end
|
443
|
-
|
444
|
-
describe '#position_and_count_of_data_length_bytes' do
|
445
|
-
subject { super().position_and_count_of_data_length_bytes }
|
446
|
-
it { is_expected.to eq [0, 4] }
|
447
|
-
end
|
448
|
-
|
449
|
-
describe '#position_and_count_of_group_id_bytes' do
|
450
|
-
subject { super().position_and_count_of_group_id_bytes }
|
451
|
-
it { is_expected.to eq nil }
|
452
|
-
end
|
453
|
-
|
454
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
455
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
456
|
-
it { is_expected.to eq nil }
|
457
|
-
end
|
458
|
-
end
|
459
|
-
|
460
|
-
context "when compression and group id is on" do
|
461
|
-
let(:flag_bytes) { [0b00000000, 0b01001001].pack("C2") }
|
462
|
-
|
463
|
-
describe '#preserve_on_tag_alteration?' do
|
464
|
-
subject { super().preserve_on_tag_alteration? }
|
465
|
-
it { is_expected.to eq(true) }
|
466
|
-
end
|
467
|
-
|
468
|
-
describe '#preserve_on_file_alteration?' do
|
469
|
-
subject { super().preserve_on_file_alteration? }
|
470
|
-
it { is_expected.to eq(true) }
|
471
|
-
end
|
472
|
-
|
473
|
-
describe '#read_only?' do
|
474
|
-
subject { super().read_only? }
|
475
|
-
it { is_expected.to eq(false) }
|
476
|
-
end
|
477
|
-
|
478
|
-
describe '#compressed?' do
|
479
|
-
subject { super().compressed? }
|
480
|
-
it { is_expected.to eq(true) }
|
481
|
-
end
|
482
|
-
|
483
|
-
describe '#encrypted?' do
|
484
|
-
subject { super().encrypted? }
|
485
|
-
it { is_expected.to eq(false) }
|
486
|
-
end
|
487
|
-
|
488
|
-
describe '#grouped?' do
|
489
|
-
subject { super().grouped? }
|
490
|
-
it { is_expected.to eq(true) }
|
491
|
-
end
|
492
|
-
|
493
|
-
describe '#unsynchronised?' do
|
494
|
-
subject { super().unsynchronised? }
|
495
|
-
it { is_expected.to eq(false) }
|
496
|
-
end
|
497
|
-
|
498
|
-
describe '#data_length_indicator?' do
|
499
|
-
subject { super().data_length_indicator? }
|
500
|
-
it { is_expected.to eq(true) }
|
501
|
-
end
|
502
|
-
|
503
|
-
describe '#additional_info_byte_count' do
|
504
|
-
subject { super().additional_info_byte_count }
|
505
|
-
it { is_expected.to eq 5 }
|
506
|
-
end
|
507
|
-
|
508
|
-
describe '#position_and_count_of_data_length_bytes' do
|
509
|
-
subject { super().position_and_count_of_data_length_bytes }
|
510
|
-
it { is_expected.to eq [1, 4] }
|
511
|
-
end
|
512
|
-
|
513
|
-
describe '#position_and_count_of_group_id_bytes' do
|
514
|
-
subject { super().position_and_count_of_group_id_bytes }
|
515
|
-
it { is_expected.to eq [0, 1] }
|
516
|
-
end
|
517
|
-
|
518
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
519
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
520
|
-
it { is_expected.to eq nil }
|
521
|
-
end
|
522
|
-
end
|
523
|
-
|
524
|
-
context "when all flags are 1" do
|
525
|
-
let(:flag_bytes) { [0b01110000, 0b01001111].pack("C2") }
|
526
|
-
|
527
|
-
describe '#preserve_on_tag_alteration?' do
|
528
|
-
subject { super().preserve_on_tag_alteration? }
|
529
|
-
it { is_expected.to eq(false) }
|
530
|
-
end
|
531
|
-
|
532
|
-
describe '#preserve_on_file_alteration?' do
|
533
|
-
subject { super().preserve_on_file_alteration? }
|
534
|
-
it { is_expected.to eq(false) }
|
535
|
-
end
|
536
|
-
|
537
|
-
describe '#read_only?' do
|
538
|
-
subject { super().read_only? }
|
539
|
-
it { is_expected.to eq(true) }
|
540
|
-
end
|
541
|
-
|
542
|
-
describe '#compressed?' do
|
543
|
-
subject { super().compressed? }
|
544
|
-
it { is_expected.to eq(true) }
|
545
|
-
end
|
546
|
-
|
547
|
-
describe '#encrypted?' do
|
548
|
-
subject { super().encrypted? }
|
549
|
-
it { is_expected.to eq(true) }
|
550
|
-
end
|
551
|
-
|
552
|
-
describe '#grouped?' do
|
553
|
-
subject { super().grouped? }
|
554
|
-
it { is_expected.to eq(true) }
|
555
|
-
end
|
556
|
-
|
557
|
-
describe '#unsynchronised?' do
|
558
|
-
subject { super().unsynchronised? }
|
559
|
-
it { is_expected.to eq(true) }
|
560
|
-
end
|
561
|
-
|
562
|
-
describe '#data_length_indicator?' do
|
563
|
-
subject { super().data_length_indicator? }
|
564
|
-
it { is_expected.to eq(true) }
|
565
|
-
end
|
566
|
-
|
567
|
-
describe '#additional_info_byte_count' do
|
568
|
-
subject { super().additional_info_byte_count }
|
569
|
-
it { is_expected.to eq 6 }
|
570
|
-
end
|
571
|
-
|
572
|
-
describe '#position_and_count_of_data_length_bytes' do
|
573
|
-
subject { super().position_and_count_of_data_length_bytes }
|
574
|
-
it { is_expected.to eq [2, 4] }
|
575
|
-
end
|
576
|
-
|
577
|
-
describe '#position_and_count_of_group_id_bytes' do
|
578
|
-
subject { super().position_and_count_of_group_id_bytes }
|
579
|
-
it { is_expected.to eq [0, 1] }
|
580
|
-
end
|
581
|
-
|
582
|
-
describe '#position_and_count_of_encryption_id_bytes' do
|
583
|
-
subject { super().position_and_count_of_encryption_id_bytes }
|
584
|
-
it { is_expected.to eq [1, 1] }
|
585
|
-
end
|
586
|
-
end
|
587
|
-
end
|
588
|
-
end
|