av/stream/flac/flac_test.go

32 lines
663 B
Go
Raw Normal View History

package flac
import (
"io/ioutil"
"os"
"testing"
)
const (
testFile = "/home/saxon/Desktop/robot.flac"
outFile = "testOut.wav"
)
func TestDecodeFlac(t *testing.T) {
b, err := ioutil.ReadFile(testFile)
if err != nil {
t.Fatalf("Could not read test file, failed with err: %v", err.Error())
}
out, err := Decode(b)
if err != nil {
t.Errorf("Could not decode, failed with err: %v", err.Error())
}
f, err := os.Create(outFile)
if err != nil {
t.Fatalf("Could not create output file, failed with err: %v", err.Error())
}
_, err = f.Write(out)
if err != nil {
t.Fatalf("Could not write to output file, failed with err: %v", err.Error())
}
}