diff options
author | Max Kellermann <max@duempel.org> | 2014-03-01 07:25:17 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-03-01 07:49:13 +0100 |
commit | 4ba7427fa0f4c8495df331829eb67b27be9c9078 (patch) | |
tree | d34390e68bcd7a26145ea308ea0ee842d637ba32 /test | |
parent | 9dc5335e3e4e07371cfae96eca2cb5b2a93c8dd2 (diff) | |
download | mpd-4ba7427fa0f4c8495df331829eb67b27be9c9078.tar.gz mpd-4ba7427fa0f4c8495df331829eb67b27be9c9078.tar.xz mpd-4ba7427fa0f4c8495df331829eb67b27be9c9078.zip |
util/{Const,Writable}Buffer: add operator[]
Diffstat (limited to 'test')
-rw-r--r-- | test/test_pcm_channels.cxx | 12 | ||||
-rw-r--r-- | test/test_pcm_format.cxx | 12 | ||||
-rw-r--r-- | test/test_pcm_volume.cxx | 6 |
3 files changed, 15 insertions, 15 deletions
diff --git a/test/test_pcm_channels.cxx b/test/test_pcm_channels.cxx index 85ad0c248..a36fb39f3 100644 --- a/test/test_pcm_channels.cxx +++ b/test/test_pcm_channels.cxx @@ -39,7 +39,7 @@ PcmChannelsTest::TestChannels16() CPPUNIT_ASSERT_EQUAL(N, dest.size); for (unsigned i = 0; i < N; ++i) CPPUNIT_ASSERT_EQUAL(int16_t((src[i * 2] + src[i * 2 + 1]) / 2), - dest.data[i]); + dest[i]); /* mono to stereo */ @@ -47,8 +47,8 @@ PcmChannelsTest::TestChannels16() CPPUNIT_ASSERT(!dest.IsNull()); CPPUNIT_ASSERT_EQUAL(N * 4, dest.size); for (unsigned i = 0; i < N; ++i) { - CPPUNIT_ASSERT_EQUAL(src[i], dest.data[i * 2]); - CPPUNIT_ASSERT_EQUAL(src[i], dest.data[i * 2 + 1]); + CPPUNIT_ASSERT_EQUAL(src[i], dest[i * 2]); + CPPUNIT_ASSERT_EQUAL(src[i], dest[i * 2 + 1]); } } @@ -67,7 +67,7 @@ PcmChannelsTest::TestChannels32() CPPUNIT_ASSERT_EQUAL(N, dest.size); for (unsigned i = 0; i < N; ++i) CPPUNIT_ASSERT_EQUAL(int32_t(((int64_t)src[i * 2] + (int64_t)src[i * 2 + 1]) / 2), - dest.data[i]); + dest[i]); /* mono to stereo */ @@ -75,7 +75,7 @@ PcmChannelsTest::TestChannels32() CPPUNIT_ASSERT(!dest.IsNull()); CPPUNIT_ASSERT_EQUAL(N * 4, dest.size); for (unsigned i = 0; i < N; ++i) { - CPPUNIT_ASSERT_EQUAL(src[i], dest.data[i * 2]); - CPPUNIT_ASSERT_EQUAL(src[i], dest.data[i * 2 + 1]); + CPPUNIT_ASSERT_EQUAL(src[i], dest[i * 2]); + CPPUNIT_ASSERT_EQUAL(src[i], dest[i * 2 + 1]); } } diff --git a/test/test_pcm_format.cxx b/test/test_pcm_format.cxx index 6393d484b..94c55ab16 100644 --- a/test/test_pcm_format.cxx +++ b/test/test_pcm_format.cxx @@ -39,7 +39,7 @@ PcmFormatTest::TestFormat8to16() CPPUNIT_ASSERT_EQUAL(N, d.size); for (size_t i = 0; i < N; ++i) - CPPUNIT_ASSERT_EQUAL(int(src[i]), d.data[i] >> 8); + CPPUNIT_ASSERT_EQUAL(int(src[i]), d[i] >> 8); } void @@ -54,7 +54,7 @@ PcmFormatTest::TestFormat16to24() CPPUNIT_ASSERT_EQUAL(N, d.size); for (size_t i = 0; i < N; ++i) - CPPUNIT_ASSERT_EQUAL(int(src[i]), d.data[i] >> 8); + CPPUNIT_ASSERT_EQUAL(int(src[i]), d[i] >> 8); } void @@ -69,7 +69,7 @@ PcmFormatTest::TestFormat16to32() CPPUNIT_ASSERT_EQUAL(N, d.size); for (size_t i = 0; i < N; ++i) - CPPUNIT_ASSERT_EQUAL(int(src[i]), d.data[i] >> 16); + CPPUNIT_ASSERT_EQUAL(int(src[i]), d[i] >> 16); } void @@ -84,8 +84,8 @@ PcmFormatTest::TestFormatFloat() CPPUNIT_ASSERT_EQUAL(N, f.size); for (size_t i = 0; i != f.size; ++i) { - CPPUNIT_ASSERT(f.data[i] >= -1.); - CPPUNIT_ASSERT(f.data[i] <= 1.); + CPPUNIT_ASSERT(f[i] >= -1.); + CPPUNIT_ASSERT(f[i] <= 1.); } PcmDither dither; @@ -96,5 +96,5 @@ PcmFormatTest::TestFormatFloat() CPPUNIT_ASSERT_EQUAL(N, d.size); for (size_t i = 0; i < N; ++i) - CPPUNIT_ASSERT_EQUAL(src[i], d.data[i]); + CPPUNIT_ASSERT_EQUAL(src[i], d[i]); } diff --git a/test/test_pcm_volume.cxx b/test/test_pcm_volume.cxx index d08c7efb0..de880563d 100644 --- a/test/test_pcm_volume.cxx +++ b/test/test_pcm_volume.cxx @@ -61,8 +61,8 @@ TestVolume(G g=G()) const auto _dest = ConstBuffer<value_type>::FromVoid(dest); for (unsigned i = 0; i < N; ++i) { const auto expected = (_src[i] + 1) / 2; - CPPUNIT_ASSERT(_dest.data[i] >= expected - 4); - CPPUNIT_ASSERT(_dest.data[i] <= expected + 4); + CPPUNIT_ASSERT(_dest[i] >= expected - 4); + CPPUNIT_ASSERT(_dest[i] <= expected + 4); } pv.Close(); @@ -119,7 +119,7 @@ PcmVolumeTest::TestVolumeFloat() const auto _dest = ConstBuffer<float>::FromVoid(dest); for (unsigned i = 0; i < N; ++i) - CPPUNIT_ASSERT_DOUBLES_EQUAL(_src[i] / 2, _dest.data[i], 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(_src[i] / 2, _dest[i], 1); pv.Close(); } |