fix: qmc test

pull/46/head
Unlock Music Dev 2 years ago
parent ea3236e14b
commit d2019b04ec
No known key found for this signature in database
GPG Key ID: 95202E10D3413A1D

@ -7,6 +7,8 @@ import (
"os"
"reflect"
"testing"
"unlock-music.dev/cli/algo/common"
)
func loadTestDataQmcDecoder(filename string) ([]byte, []byte, error) {
@ -29,13 +31,14 @@ func loadTestDataQmcDecoder(filename string) ([]byte, []byte, error) {
func TestMflac0Decoder_Read(t *testing.T) {
tests := []struct {
name string
fileExt string
wantErr bool
}{
{"mflac0_rc4", false},
{"mflac_rc4", false},
{"mflac_map", false},
{"mgg_map", false},
{"qmc0_static", false},
{"mflac0_rc4", ".mflac0", false},
{"mflac_rc4", ".mflac", false},
{"mflac_map", ".mflac", false},
{"mgg_map", ".mgg", false},
{"qmc0_static", ".qmc0", false},
}
for _, tt := range tests {
@ -45,7 +48,10 @@ func TestMflac0Decoder_Read(t *testing.T) {
t.Fatal(err)
}
d := NewDecoder(bytes.NewReader(raw))
d := NewDecoder(&common.DecoderParams{
Reader: bytes.NewReader(raw),
Extension: tt.fileExt,
})
if err := d.Validate(); err != nil {
t.Errorf("validate file error = %v", err)
}
@ -81,7 +87,10 @@ func TestMflac0Decoder_Validate(t *testing.T) {
if err != nil {
t.Fatal(err)
}
d := NewDecoder(bytes.NewReader(raw))
d := NewDecoder(&common.DecoderParams{
Reader: bytes.NewReader(raw),
Extension: tt.fileExt,
})
if err := d.Validate(); err != nil {
t.Errorf("read bytes from decoder error = %v", err)

Loading…
Cancel
Save