aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_ring_array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_ring_array.cpp')
-rw-r--r--test/test_ring_array.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/test/test_ring_array.cpp b/test/test_ring_array.cpp
index d258d50..a364684 100644
--- a/test/test_ring_array.cpp
+++ b/test/test_ring_array.cpp
@@ -1,10 +1,10 @@
#include "gtest/gtest.h"
#ifdef __APPLE__
-#include <string.h>
-#include <iostream>
-#include <CoreAudio/CoreAudioTypes.h>
#include "cubeb/cubeb.h"
#include "cubeb_ring_array.h"
+#include <CoreAudio/CoreAudioTypes.h>
+#include <iostream>
+#include <string.h>
TEST(cubeb, ring_array)
{
@@ -15,12 +15,12 @@ TEST(cubeb, ring_array)
unsigned int capacity = 8;
ring_array_init(&ra, capacity, sizeof(int), 1, 1);
- int verify_data[capacity] ;// {1,2,3,4,5,6,7,8};
+ int verify_data[capacity]; // {1,2,3,4,5,6,7,8};
AudioBuffer * p_data = NULL;
for (unsigned int i = 0; i < capacity; ++i) {
verify_data[i] = i; // in case capacity change value
- *(int*)ra.buffer_array[i].mData = i;
+ *(int *)ra.buffer_array[i].mData = i;
ASSERT_EQ(ra.buffer_array[i].mDataByteSize, sizeof(int));
ASSERT_EQ(ra.buffer_array[i].mNumberChannels, 1u);
}
@@ -29,7 +29,7 @@ TEST(cubeb, ring_array)
for (unsigned int i = 0; i < capacity; ++i) {
p_data = ring_array_get_free_buffer(&ra);
ASSERT_NE(p_data, nullptr);
- ASSERT_EQ(*(int*)p_data->mData, verify_data[i]);
+ ASSERT_EQ(*(int *)p_data->mData, verify_data[i]);
}
/*Now array is full extra store should give NULL*/
ASSERT_EQ(ring_array_get_free_buffer(&ra), nullptr);
@@ -37,14 +37,14 @@ TEST(cubeb, ring_array)
for (unsigned int i = 0; i < capacity; ++i) {
p_data = ring_array_get_data_buffer(&ra);
ASSERT_NE(p_data, nullptr);
- ASSERT_EQ(*(int*)p_data->mData, verify_data[i]);
+ ASSERT_EQ(*(int *)p_data->mData, verify_data[i]);
}
/*Now array is empty extra fetch should give NULL*/
ASSERT_EQ(ring_array_get_data_buffer(&ra), nullptr);
p_data = NULL;
/* Repeated store fetch should can go for ever*/
- for (unsigned int i = 0; i < 2*capacity; ++i) {
+ for (unsigned int i = 0; i < 2 * capacity; ++i) {
p_data = ring_array_get_free_buffer(&ra);
ASSERT_NE(p_data, nullptr);
ASSERT_EQ(ring_array_get_data_buffer(&ra), p_data);
@@ -55,19 +55,18 @@ TEST(cubeb, ring_array)
for (unsigned int i = 0; i < capacity; ++i) {
p_data = ring_array_get_free_buffer(&ra);
ASSERT_NE(p_data, nullptr);
- ASSERT_EQ(*((int*)p_data->mData), verify_data[i]);
- (*((int*)p_data->mData))++; // Modify data
+ ASSERT_EQ(*((int *)p_data->mData), verify_data[i]);
+ (*((int *)p_data->mData))++; // Modify data
}
for (unsigned int i = 0; i < capacity; ++i) {
p_data = ring_array_get_data_buffer(&ra);
ASSERT_NE(p_data, nullptr);
- ASSERT_EQ(*((int*)p_data->mData), verify_data[i]+1); // Verify modified data
+ ASSERT_EQ(*((int *)p_data->mData),
+ verify_data[i] + 1); // Verify modified data
}
ring_array_destroy(&ra);
}
#else
-TEST(cubeb, DISABLED_ring_array)
-{
-}
+TEST(cubeb, DISABLED_ring_array) {}
#endif