refine TestComprehensive
This commit is contained in:
parent
af5022af62
commit
56eb8cd97c
|
@ -12,7 +12,6 @@ func TestComprehensive(t *testing.T) {
|
|||
testfile := os.TempDir() + "/tta_comprehensive_test.wav"
|
||||
if info, err := os.Stat(testfile); err == nil {
|
||||
if !info.IsDir() {
|
||||
var sum []byte
|
||||
fd, err := os.Open(testfile)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -23,9 +22,7 @@ func TestComprehensive(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
fd.Seek(0, os.SEEK_SET)
|
||||
sha := sha256.New()
|
||||
sum = sha.Sum(p)
|
||||
sha.Reset()
|
||||
sum := sha256.Sum256(p)
|
||||
outfile, err := os.Create(os.TempDir() + "/tta_comprehensive_test_compressed.tta")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -48,7 +45,8 @@ func TestComprehensive(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if bytes.Compare(sha.Sum(p), sum) != 0 {
|
||||
sum2 := sha256.Sum256(p)
|
||||
if bytes.Compare(sum2[:], sum[:]) != 0 {
|
||||
t.Errorf("Checksum fail, expected: %x\n", sum)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue