-
Notifications
You must be signed in to change notification settings - Fork 2
/
codec_test.go
51 lines (49 loc) · 1.26 KB
/
codec_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
package matroska
import "testing"
func TestCodecID(t *testing.T) {
type args struct {
s string
}
tests := []struct {
name string
args args
wantPrefix CodecType
wantMajor string
wantSuffix string
}{
{
name: "AAC_2LC",
args: args{s: AudioCodecAAC_2LC},
wantPrefix: CodecTypeAudio, wantMajor: "AAC", wantSuffix: "MPEG2/LC",
},
{
name: "AV1",
args: args{s: VideoCodecAV1},
wantPrefix: CodecTypeVideo, wantMajor: "AV1", wantSuffix: "",
},
{
name: "TEXTASS",
args: args{s: SubtitleCodecTEXTASS},
wantPrefix: CodecTypeSubtitle, wantMajor: "TEXT", wantSuffix: "ASS",
},
{
name: "VOBBTN",
args: args{s: ButtonCodecVOBBTN},
wantPrefix: CodecTypeButton, wantMajor: "VOBBTN", wantSuffix: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotPrefix, gotMajor, gotSuffix := CodecID(tt.args.s)
if gotPrefix != tt.wantPrefix {
t.Errorf("CodecID() gotPrefix = %v, want %v", gotPrefix, tt.wantPrefix)
}
if gotMajor != tt.wantMajor {
t.Errorf("CodecID() gotMajor = %v, want %v", gotMajor, tt.wantMajor)
}
if gotSuffix != tt.wantSuffix {
t.Errorf("CodecID() gotSuffix = %v, want %v", gotSuffix, tt.wantSuffix)
}
})
}
}