improved buffer tests
This commit is contained in:
@@ -15,7 +15,7 @@ int test_buffer_1()
|
||||
printf("Buffer capacity = %zu\n", buffer.capacity());
|
||||
for (int i=0; i < 10; i++)
|
||||
{
|
||||
buffer[i] = i+1;
|
||||
buffer[i] = i+100;
|
||||
}
|
||||
buffer += 5;
|
||||
|
||||
@@ -44,7 +44,7 @@ int test_buffer_2()
|
||||
printf("Buffer capacity = %zu\n", buffer.capacity());
|
||||
for (int i=0; i < 10; i++)
|
||||
{
|
||||
buffer[i] = i+1;
|
||||
buffer[i] = i+100;
|
||||
}
|
||||
buffer += 5;
|
||||
|
||||
@@ -84,7 +84,7 @@ int test_buffer_3()
|
||||
printf("Buffer capacity = %zu\n", buffer.capacity());
|
||||
for (int i=0; i < buffer.capacity(); i++)
|
||||
{
|
||||
buffer[i] = i;
|
||||
buffer[i] = i+100;
|
||||
}
|
||||
|
||||
buffer.reset();
|
||||
@@ -96,7 +96,7 @@ int test_buffer_3()
|
||||
std::cout << "offset = " << offset << std::endl;
|
||||
std::cout << "----------------------------------------------" << std::endl;
|
||||
auto v1 = dsp::Buffer<int>(buffer, offset, incr);
|
||||
for(int i=0; i < v1.capacity()/incr; i++)
|
||||
for(int i=0; i < v1.capacity(); i++)
|
||||
{
|
||||
std::cout << v1[i] << std::endl;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ int test_buffer_multi_1()
|
||||
{
|
||||
for (int c=0; c < 5; c++)
|
||||
{
|
||||
buffer[c][0] = i+1;
|
||||
buffer[c][0] = i+100;
|
||||
}
|
||||
buffer += 1;
|
||||
|
||||
@@ -56,7 +56,7 @@ int test_buffer_multi_2()
|
||||
{
|
||||
for (int c=0; c < 5; c++)
|
||||
{
|
||||
buffer[c][0] = i+1;
|
||||
buffer[c][0] = i+100;
|
||||
int v = buffer[c][-2];
|
||||
printf("c=%d: i=%d: v=%d\n", c, i, v);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ int test_buffer_multi_3()
|
||||
{
|
||||
for (int c=0; c < 5; c++)
|
||||
{
|
||||
buffer[c][0] = i+1;
|
||||
buffer[c][0] = i+100;
|
||||
int v = buffer[c][-c];
|
||||
printf("c=%d: i=%d: v=%d\n", c, i, v);
|
||||
}
|
||||
@@ -108,8 +108,8 @@ int test_buffer_multi_4()
|
||||
dsp::BufferMulti<int>buffer(5, 10);
|
||||
printf("Buffer capacity = %zu\n", buffer.capacity());
|
||||
|
||||
dsp::Buffer<int> *mbv[5];
|
||||
for (int c=0; c < 5; c++)
|
||||
dsp::Buffer<int> *mbv[6];
|
||||
for (int c=0; c <= 5; c++)
|
||||
{
|
||||
mbv[c] = new dsp::Buffer<int>(buffer[c], -c);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ int test_buffer_multi_4()
|
||||
{
|
||||
for (int c=0; c < 5; c++)
|
||||
{
|
||||
buffer[c][0] = i+1;
|
||||
buffer[c][0] = i+100;
|
||||
}
|
||||
buffer += 1;
|
||||
}
|
||||
@@ -126,10 +126,7 @@ int test_buffer_multi_4()
|
||||
buffer.reset();
|
||||
for (int c=0; c < 5; c++)
|
||||
{
|
||||
for (int i=0; i < 10; i++)
|
||||
{
|
||||
print(*mbv[c], 10);
|
||||
}
|
||||
print(*mbv[c], 10, "mbv[c]");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -145,21 +142,14 @@ int test_buffer_multi_5()
|
||||
|
||||
for (int i=0; i < 10; i++)
|
||||
{
|
||||
buffer = i+1;
|
||||
buffer = i+100;
|
||||
buffer += 1;
|
||||
}
|
||||
|
||||
buffer.reset();
|
||||
print(buffer.buffer(), buffer.buffer().capacity());
|
||||
|
||||
|
||||
for (int i=0; i < 10; i++)
|
||||
{
|
||||
print(buffer.quer(i), buffer.quer().capacity());
|
||||
// if (buffer.quer(0) == dsp::Buffer<int>(std::vector<int>{1,1,1,1,1}))
|
||||
// {
|
||||
// std::cout << "Okay" << std::endl;
|
||||
// }
|
||||
print(buffer.quer(i), buffer.quer().capacity(), "Title here 5");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -167,11 +157,9 @@ int test_buffer_multi_5()
|
||||
|
||||
int test_buffer_multi()
|
||||
{
|
||||
std::vector<int> v { 34,23 };
|
||||
const std::vector<int> v2 { 34,23 };
|
||||
// test_buffer_multi_1();
|
||||
// test_buffer_multi_2();
|
||||
// test_buffer_multi_3();
|
||||
test_buffer_multi_1();
|
||||
test_buffer_multi_2();
|
||||
test_buffer_multi_3();
|
||||
test_buffer_multi_4();
|
||||
test_buffer_multi_5();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ extern void test_buffer_multi();
|
||||
int main()
|
||||
{
|
||||
test_buffer();
|
||||
// test_buffer_multi();
|
||||
test_buffer_multi();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user