diff options
author | Max Kellermann <max@musicpd.org> | 2019-06-26 16:04:46 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-06-26 16:04:46 +0200 |
commit | beed004b106a86601f2a616c26090986942696fc (patch) | |
tree | 024b38b3e6eb8270932aae0138455699937b3ff1 /test | |
parent | 730e67d7660ac6f4ca7d1b3bffdb893e39ee00bf (diff) |
pcm/Export: add GetSilence()
Diffstat (limited to 'test')
-rw-r--r-- | test/test_pcm_export.cxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/test_pcm_export.cxx b/test/test_pcm_export.cxx index aa11bdec8..081d55fa8 100644 --- a/test/test_pcm_export.cxx +++ b/test/test_pcm_export.cxx @@ -49,6 +49,12 @@ TEST(PcmTest, ExportShift8) auto dest = e.Export({src, sizeof(src)}); EXPECT_EQ(sizeof(expected), dest.size); EXPECT_TRUE(memcmp(dest.data, expected, dest.size) == 0); + + const auto silence = e.GetSilence(); + constexpr uint8_t expected_silence[8]{}; + EXPECT_EQ(silence.size, sizeof(expected_silence)); + EXPECT_EQ(memcmp(silence.data, expected_silence, + sizeof(expected_silence)), 0); } TEST(PcmTest, ExportPack24) @@ -92,6 +98,12 @@ TEST(PcmTest, ExportPack24) auto dest = e.Export({src, sizeof(src)}); EXPECT_EQ(expected_size, dest.size); EXPECT_TRUE(memcmp(dest.data, expected, dest.size) == 0); + + const auto silence = e.GetSilence(); + constexpr uint8_t expected_silence[6]{}; + EXPECT_EQ(silence.size, sizeof(expected_silence)); + EXPECT_EQ(memcmp(silence.data, expected_silence, + sizeof(expected_silence)), 0); } TEST(PcmTest, ExportReverseEndian) @@ -147,6 +159,12 @@ TEST(PcmTest, ExportReverseEndian) dest = e.Export({src, sizeof(src)}); EXPECT_EQ(sizeof(expected4), dest.size); EXPECT_TRUE(memcmp(dest.data, expected4, dest.size) == 0); + + const auto silence = e.GetSilence(); + constexpr uint8_t expected_silence[8]{}; + EXPECT_EQ(silence.size, sizeof(expected_silence)); + EXPECT_EQ(memcmp(silence.data, expected_silence, + sizeof(expected_silence)), 0); } #ifdef ENABLE_DSD @@ -205,6 +223,12 @@ TEST(PcmTest, ExportDsdU16) dest = e.Export({src4, sizeof(src4)}); EXPECT_EQ(sizeof(expected4), dest.size); EXPECT_TRUE(memcmp(dest.data, expected4, dest.size) == 0); + + const auto silence = e.GetSilence(); + constexpr uint8_t expected_silence[]{0x69, 0x69, 0x69, 0x69}; + EXPECT_EQ(silence.size, sizeof(expected_silence)); + EXPECT_EQ(memcmp(silence.data, expected_silence, + sizeof(expected_silence)), 0); } TEST(PcmTest, ExportDsdU32) @@ -261,6 +285,12 @@ TEST(PcmTest, ExportDsdU32) dest = e.Export({src4, sizeof(src4)}); EXPECT_EQ(sizeof(expected4), dest.size); EXPECT_TRUE(memcmp(dest.data, expected4, dest.size) == 0); + + const auto silence = e.GetSilence(); + constexpr uint8_t expected_silence[]{0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69}; + EXPECT_EQ(silence.size, sizeof(expected_silence)); + EXPECT_EQ(memcmp(silence.data, expected_silence, + sizeof(expected_silence)), 0); } TEST(PcmTest, ExportDop) @@ -329,6 +359,12 @@ TEST(PcmTest, ExportDop) dest = e.Export({src6, sizeof(src6)}); ASSERT_EQ(sizeof(expected6), dest.size); ASSERT_TRUE(memcmp(dest.data, expected6, dest.size) == 0); + + const auto silence = e.GetSilence(); + constexpr uint32_t expected_silence[]{0xff056969, 0xff056969, 0xfffa6969, 0xfffa6969}; + EXPECT_EQ(silence.size, sizeof(expected_silence)); + EXPECT_EQ(memcmp(silence.data, expected_silence, + sizeof(expected_silence)), 0); } #endif @@ -391,6 +427,12 @@ TestAlsaChannelOrder71() auto dest = e.Export({src, sizeof(src)}); EXPECT_EQ(sizeof(expected), dest.size); EXPECT_TRUE(memcmp(dest.data, expected, dest.size) == 0); + + const auto silence = e.GetSilence(); + constexpr value_type expected_silence[8]{}; + EXPECT_EQ(silence.size, sizeof(expected_silence)); + EXPECT_EQ(memcmp(silence.data, expected_silence, + sizeof(expected_silence)), 0); } TEST(PcmTest, ExportAlsaChannelOrder) |