-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmp3_test.go
More file actions
113 lines (86 loc) · 1.89 KB
/
Copy pathmp3_test.go
File metadata and controls
113 lines (86 loc) · 1.89 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright 2014 Xavier Henner. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package mp3
import (
"testing"
)
const (
testFileC = "testcbr.mp3"
testFileV = "testvbr.mp3"
)
func TestCBR(t *testing.T) {
mp3File, err := Examine(testFileC, false)
if err != nil {
t.Errorf("Can't read file")
}
if mp3File.Version != "1" {
t.Errorf("Can't detect Version")
}
if mp3File.Layer != "III" {
t.Errorf("Can't detect Layer")
}
if mp3File.Mode != "Join Stereo" {
t.Errorf("Can't detect Mode")
}
if mp3File.Bitrate != 128 {
t.Errorf("Can't detect Bitrate")
}
if mp3File.Type != "CBR" {
t.Errorf("Can't detect CBR")
}
if mp3File.Sampling != 48000 {
t.Errorf("Can't detect Sampling")
}
if mp3File.Size != 1126528 {
t.Errorf("Invalid size")
}
if int(mp3File.Length) != 70 {
t.Errorf("Can't detect Length")
}
}
func TestVBR(t *testing.T) {
mp3File, err := Examine(testFileV, true)
if err != nil {
t.Errorf("Can't read file")
}
if mp3File.Version != "1" {
t.Errorf("Can't detect Version")
}
if mp3File.Layer != "III" {
t.Errorf("Can't detect Layer")
}
if mp3File.Mode != "Stereo" {
t.Errorf("Can't detect Mode")
}
if mp3File.Bitrate != 192 {
t.Errorf("Can't detect Bitrate")
}
if mp3File.Type != "VBR" {
t.Errorf("Can't detect VBR")
}
if mp3File.Sampling != 48000 {
t.Errorf("Can't detect Sampling")
}
if mp3File.Size != 1630336 {
t.Errorf("Invalid size")
}
if int(mp3File.Length) != 70 {
t.Errorf("Can't detect Length")
}
}
func TestVBRfast(t *testing.T) {
mp3File, err := Examine(testFileV, false)
if err != nil {
t.Errorf("Can't read file")
}
if mp3File.Length < 67 || mp3File.Length > 73 {
t.Errorf("Can't detect Length")
}
if mp3File.Bitrate != 192 {
t.Errorf("Can't detect Bitrate")
}
if mp3File.Type != "VBR" {
t.Errorf("Can't detect VBR")
}
}