You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
836 B
38 lines
836 B
3 years ago
|
package v2
|
||
3 years ago
|
|
||
|
import (
|
||
|
"os"
|
||
3 years ago
|
"path/filepath"
|
||
3 years ago
|
"testing"
|
||
|
)
|
||
|
|
||
3 years ago
|
var TESTDATAPATH string = filepath.Join("..", "testData")
|
||
|
|
||
3 years ago
|
func TestGetHeader(t *testing.T) {
|
||
3 years ago
|
f, err := os.Open(filepath.Join(TESTDATAPATH, "testreadv2.mp3"))
|
||
3 years ago
|
if err != nil {
|
||
|
t.Errorf("%s", err)
|
||
|
}
|
||
|
|
||
|
header, err := GetHeader(f)
|
||
|
if err != nil {
|
||
|
t.Errorf("GetHeader failed: %s", err)
|
||
|
}
|
||
|
|
||
|
if header.Identifier != "ID3" {
|
||
|
t.Errorf("GetHeader failed: expected identifier %s; got %s", "ID3", header.Identifier)
|
||
|
}
|
||
|
|
||
|
if header.Compressed != false {
|
||
|
t.Errorf("GetHeader failed: expected flag %v; got %v", false, header.Compressed)
|
||
|
}
|
||
|
|
||
|
if header.Unsynchronisated != false {
|
||
|
t.Errorf("GetHeader failed: expected flag %v; got %v", false, header.Unsynchronisated)
|
||
|
}
|
||
|
|
||
|
if header.Size != 1138 {
|
||
|
t.Errorf("GetHeader failed: expected size %v; got %v", 1138, header.Size)
|
||
|
}
|
||
|
}
|