From d2019b04ec89ce8c836e7b0feb3c558cc19d5fc5 Mon Sep 17 00:00:00 2001 From: Unlock Music Dev Date: Sun, 4 Dec 2022 23:14:06 +0800 Subject: [PATCH] fix: qmc test --- algo/qmc/qmc_test.go | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/algo/qmc/qmc_test.go b/algo/qmc/qmc_test.go index 7078ed2..0f1a557 100644 --- a/algo/qmc/qmc_test.go +++ b/algo/qmc/qmc_test.go @@ -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)