aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-12 21:40:06 +0200
committerMax Kellermann <max@duempel.org>2014-08-12 22:19:53 +0200
commit0e756e43774ef95ea9685e57f0c51331a9a7d1dc (patch)
tree8f935d93255755193ce3ae2473cbdf693a8c385a /test
parentee7282ce0ddb85e4e0d8174a8db6d3853b2b41a5 (diff)
downloadmpd-0e756e43774ef95ea9685e57f0c51331a9a7d1dc.tar.gz
mpd-0e756e43774ef95ea9685e57f0c51331a9a7d1dc.tar.xz
mpd-0e756e43774ef95ea9685e57f0c51331a9a7d1dc.zip
PcmExport: use class ConstBuffer
Diffstat (limited to 'test')
-rw-r--r--test/test_pcm_export.cxx41
1 files changed, 19 insertions, 22 deletions
diff --git a/test/test_pcm_export.cxx b/test/test_pcm_export.cxx
index ae9bce3f8..88c1974e3 100644
--- a/test/test_pcm_export.cxx
+++ b/test/test_pcm_export.cxx
@@ -21,6 +21,7 @@
#include "test_pcm_all.hxx"
#include "pcm/PcmExport.hxx"
#include "system/ByteOrder.hxx"
+#include "util/ConstBuffer.hxx"
#include <string.h>
@@ -33,10 +34,9 @@ PcmExportTest::TestShift8()
PcmExport e;
e.Open(SampleFormat::S24_P32, 2, false, true, false, false);
- size_t dest_size;
- auto dest = e.Export(src, sizeof(src), dest_size);
- CPPUNIT_ASSERT_EQUAL(sizeof(expected), dest_size);
- CPPUNIT_ASSERT(memcmp(dest, expected, dest_size) == 0);
+ auto dest = e.Export({src, sizeof(src)});
+ CPPUNIT_ASSERT_EQUAL(sizeof(expected), dest.size);
+ CPPUNIT_ASSERT(memcmp(dest.data, expected, dest.size) == 0);
}
void
@@ -67,10 +67,9 @@ PcmExportTest::TestPack24()
PcmExport e;
e.Open(SampleFormat::S24_P32, 2, false, false, true, false);
- size_t dest_size;
- auto dest = e.Export(src, sizeof(src), dest_size);
- CPPUNIT_ASSERT_EQUAL(expected_size, dest_size);
- CPPUNIT_ASSERT(memcmp(dest, expected, dest_size) == 0);
+ auto dest = e.Export({src, sizeof(src)});
+ CPPUNIT_ASSERT_EQUAL(expected_size, dest.size);
+ CPPUNIT_ASSERT(memcmp(dest.data, expected, dest.size) == 0);
}
void
@@ -91,20 +90,19 @@ PcmExportTest::TestReverseEndian()
PcmExport e;
e.Open(SampleFormat::S8, 2, false, false, false, true);
- size_t dest_size;
- auto dest = e.Export(src, sizeof(src), dest_size);
- CPPUNIT_ASSERT_EQUAL(sizeof(src), dest_size);
- CPPUNIT_ASSERT(memcmp(dest, src, dest_size) == 0);
+ auto dest = e.Export({src, sizeof(src)});
+ CPPUNIT_ASSERT_EQUAL(sizeof(src), dest.size);
+ CPPUNIT_ASSERT(memcmp(dest.data, src, dest.size) == 0);
e.Open(SampleFormat::S16, 2, false, false, false, true);
- dest = e.Export(src, sizeof(src), dest_size);
- CPPUNIT_ASSERT_EQUAL(sizeof(expected2), dest_size);
- CPPUNIT_ASSERT(memcmp(dest, expected2, dest_size) == 0);
+ dest = e.Export({src, sizeof(src)});
+ CPPUNIT_ASSERT_EQUAL(sizeof(expected2), dest.size);
+ CPPUNIT_ASSERT(memcmp(dest.data, expected2, dest.size) == 0);
e.Open(SampleFormat::S32, 2, false, false, false, true);
- dest = e.Export(src, sizeof(src), dest_size);
- CPPUNIT_ASSERT_EQUAL(sizeof(expected4), dest_size);
- CPPUNIT_ASSERT(memcmp(dest, expected4, dest_size) == 0);
+ dest = e.Export({src, sizeof(src)});
+ CPPUNIT_ASSERT_EQUAL(sizeof(expected4), dest.size);
+ CPPUNIT_ASSERT(memcmp(dest.data, expected4, dest.size) == 0);
}
void
@@ -125,8 +123,7 @@ PcmExportTest::TestDsdUsb()
PcmExport e;
e.Open(SampleFormat::DSD, 2, true, false, false, false);
- size_t dest_size;
- auto dest = e.Export(src, sizeof(src), dest_size);
- CPPUNIT_ASSERT_EQUAL(sizeof(expected), dest_size);
- CPPUNIT_ASSERT(memcmp(dest, expected, dest_size) == 0);
+ auto dest = e.Export({src, sizeof(src)});
+ CPPUNIT_ASSERT_EQUAL(sizeof(expected), dest.size);
+ CPPUNIT_ASSERT(memcmp(dest.data, expected, dest.size) == 0);
}