forked from n10v/id3v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sequence_test.go
79 lines (69 loc) · 2.12 KB
/
sequence_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright 2016 Albert Nigmatzianov. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package id3v2
import "testing"
func TestSequenceCacheUpdate(t *testing.T) {
t.Parallel()
s := getSequence()
defer putSequence(s)
s.AddFrame(PictureFrame{Description: "A"})
if len(s.Frames()) != 1 {
t.Errorf("Expected %v frames, got %v", 1, len(s.Frames()))
}
s.AddFrame(PictureFrame{Description: "B"})
if len(s.Frames()) != 2 {
t.Errorf("Expected %v frames, got %v", 2, len(s.Frames()))
}
}
func TestSequenceCommentFramesUniqueness(t *testing.T) {
t.Parallel()
s := getSequence()
defer putSequence(s)
s.AddFrame(CommentFrame{Language: "A", Description: "A"})
if s.Count() != 1 {
t.Errorf("Expected %v frames, got %v", 1, s.Count())
}
s.AddFrame(CommentFrame{Language: "B", Description: "B"})
if s.Count() != 2 {
t.Errorf("Expected %v frames, got %v", 2, s.Count())
}
s.AddFrame(CommentFrame{Language: "B", Description: "B"})
if s.Count() != 2 {
t.Errorf("Expected %v frames, got %v", 2, s.Count())
}
}
func TestSequencePictureFramesUniqueness(t *testing.T) {
t.Parallel()
s := getSequence()
defer putSequence(s)
s.AddFrame(PictureFrame{Description: "A"})
if s.Count() != 1 {
t.Errorf("Expected %v frames, got %v", 1, s.Count())
}
s.AddFrame(PictureFrame{Description: "B"})
if s.Count() != 2 {
t.Errorf("Expected %v frames, got %v", 2, s.Count())
}
s.AddFrame(PictureFrame{Description: "B"})
if s.Count() != 2 {
t.Errorf("Expected %v frames, got %v", 2, s.Count())
}
}
func TestSequenceUSLFsUniqueness(t *testing.T) {
t.Parallel()
s := getSequence()
defer putSequence(s)
s.AddFrame(UnsynchronisedLyricsFrame{Language: "A", ContentDescriptor: "A"})
if s.Count() != 1 {
t.Errorf("Expected %v frames, got %v", 1, s.Count())
}
s.AddFrame(UnsynchronisedLyricsFrame{Language: "B", ContentDescriptor: "B"})
if s.Count() != 2 {
t.Errorf("Expected %v frames, got %v", 2, s.Count())
}
s.AddFrame(UnsynchronisedLyricsFrame{Language: "B", ContentDescriptor: "B"})
if s.Count() != 2 {
t.Errorf("Expected %v frames, got %v", 2, s.Count())
}
}