aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_ring_buffer.cpp
diff options
context:
space:
mode:
authorMatthew Gregan <[email protected]>2017-03-17 15:18:41 +1300
committerPaul Adenot <[email protected]>2017-03-21 08:59:03 -0700
commit89e214d625894eb1559f4621fdf7217e21b7c447 (patch)
tree940dc3a68354c06dbdd49a39ab755a26850d6d3f /test/test_ring_buffer.cpp
parent4ab4577699fb42931f0fbd39826fa085dace4589 (diff)
downloadcubeb-89e214d625894eb1559f4621fdf7217e21b7c447.tar.gz
cubeb-89e214d625894eb1559f4621fdf7217e21b7c447.zip
Remove templated non-thread-safety from ring_buffer_base.
Diffstat (limited to 'test/test_ring_buffer.cpp')
-rw-r--r--test/test_ring_buffer.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/test/test_ring_buffer.cpp b/test/test_ring_buffer.cpp
index 3dd73a6..1532d24 100644
--- a/test/test_ring_buffer.cpp
+++ b/test/test_ring_buffer.cpp
@@ -52,7 +52,7 @@ class sequence_verifier
for (size_t i = 0; i < frames; i++) {
for (size_t c = 0; c < channels; c++) {
if (elements[i * channels + c] != static_cast<T>(index_)) {
- std::cerr << "Element " << i << " is different. Expected "
+ std::cerr << "Element " << i << " is different. Expected "
<< static_cast<T>(index_) << ", got " << elements[i]
<< ". (channel count: " << channels << ")." << std::endl;
ASSERT_TRUE(false);
@@ -67,7 +67,7 @@ class sequence_verifier
};
template<typename T>
-void test_ring(audio_ring_buffer<T>& buf, int channels, int capacity_frames)
+void test_ring(lock_free_audio_ring_buffer<T>& buf, int channels, int capacity_frames)
{
std::unique_ptr<T[]> seq(new T[capacity_frames * channels]);
sequence_generator<T> gen(channels);
@@ -164,24 +164,16 @@ TEST(cubeb, ring_buffer)
const int max_capacity = 1277;
const int capacity_increment = 27;
- queue<float> q1(128);
+ lock_free_queue<float> q1(128);
basic_api_test(q1);
- queue<short> q2(128);
+ lock_free_queue<short> q2(128);
basic_api_test(q2);
- lock_free_queue<float> q3(128);
- basic_api_test(q3);
- lock_free_queue<short> q4(128);
- basic_api_test(q4);
for (size_t channels = min_channels; channels < max_channels; channels++) {
- audio_ring_buffer<float> q5(channels, 128);
- basic_api_test(q5);
- audio_ring_buffer<short> q6(channels, 128);
- basic_api_test(q6);
- lock_free_audio_ring_buffer<float> q7(channels, 128);
- basic_api_test(q7);
- lock_free_audio_ring_buffer<short> q8(channels, 128);
- basic_api_test(q8);
+ lock_free_audio_ring_buffer<float> q3(channels, 128);
+ basic_api_test(q3);
+ lock_free_audio_ring_buffer<short> q4(channels, 128);
+ basic_api_test(q4);
}
/* Single thread testing. */
@@ -190,7 +182,7 @@ TEST(cubeb, ring_buffer)
/* Use non power-of-two numbers to catch edge-cases. */
for (size_t capacity_frames = min_capacity;
capacity_frames < max_capacity; capacity_frames+=capacity_increment) {
- audio_ring_buffer<float> ring(channels, capacity_frames);
+ lock_free_audio_ring_buffer<float> ring(channels, capacity_frames);
test_ring(ring, channels, capacity_frames);
}
}