2019-01-21 08:11:49 +03:00
|
|
|
package flac
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
testFile = "/home/saxon/Desktop/robot.flac"
|
2019-01-21 10:04:15 +03:00
|
|
|
outFile = "testOut.wav"
|
2019-01-21 08:11:49 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
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())
|
|
|
|
}
|
|
|
|
}
|