- refactored
- BufferMulti numChannels is template parameter
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
#include <cmath>
|
||||
#include <delay/buffer_multi.hpp>
|
||||
#include <delay/buffer.hpp>
|
||||
#include <cstdio>
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#ifndef TEST_COMMON_H
|
||||
#define TEST_COMMON_H
|
||||
|
||||
template<typename T>
|
||||
void print(const dsp::Buffer<T> &v, size_t size)
|
||||
{
|
||||
for(int i=0; i < size; i++)
|
||||
{
|
||||
std::cout << v[i] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void print(T *v, size_t size)
|
||||
{
|
||||
for(int i=0; i < size; i++)
|
||||
{
|
||||
std::cout << v[i] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void check(const dsp::Buffer<T> &target, const dsp::Buffer<T> &actual, size_t size=0)
|
||||
{
|
||||
bool success = false;
|
||||
do
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
if (target.capacity() != actual.capacity())
|
||||
{
|
||||
break;
|
||||
}
|
||||
size = target.capacity();
|
||||
}
|
||||
|
||||
for (int i=0; i < size; i++)
|
||||
{
|
||||
if (target[i] != actual[i])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
|
||||
} while(false);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
std::cout << "Check failed" << std::endl;
|
||||
std::cout << "Target" << std::endl;
|
||||
print(target, target.capacity());
|
||||
std::cout << "Actual" << std::endl;
|
||||
print(actual, actual.capacity());
|
||||
}
|
||||
assert(success);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user