From 95ab036638421852bfd25fb1e2ceb34c24dbb461 Mon Sep 17 00:00:00 2001 From: Mark Kremer Date: Sat, 4 Nov 2023 19:16:46 +0100 Subject: [PATCH] Add explanatory comment to mp3 decoder test --- ...mples.mp3 => valid_44100hz_x_padded_samples.mp3} | Bin mp3/decode_test.go | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) rename internal/testdata/{valid_44100hz_22050_samples.mp3 => valid_44100hz_x_padded_samples.mp3} (100%) diff --git a/internal/testdata/valid_44100hz_22050_samples.mp3 b/internal/testdata/valid_44100hz_x_padded_samples.mp3 similarity index 100% rename from internal/testdata/valid_44100hz_22050_samples.mp3 rename to internal/testdata/valid_44100hz_x_padded_samples.mp3 diff --git a/mp3/decode_test.go b/mp3/decode_test.go index 10e7c02..3384f7e 100644 --- a/mp3/decode_test.go +++ b/mp3/decode_test.go @@ -11,13 +11,15 @@ import ( ) func TestDecoder_ReturnBehaviour(t *testing.T) { - f, err := os.Open(testtools.TestFilePath("valid_44100hz_22050_samples.mp3")) + f, err := os.Open(testtools.TestFilePath("valid_44100hz_x_padded_samples.mp3")) assert.NoError(t, err) defer f.Close() s, _, err := mp3.Decode(f) assert.NoError(t, err) - //assert.Equal(t, 22050, s.Len()) // todo: mp3 seems to return more samples than there are in the file. Uncomment this when fixed. + // The length of the streamer isn't tested because mp3 files have + // a different padding depending on the decoder used. + // https://superuser.com/a/1393775 testtools.AssertStreamerHasCorrectReturnBehaviour(t, s, s.Len()) }