Files
dsp/delay/tests/test_common.hpp
T
jens 6f69217ba3 [test_buffer]
use target and actual checks
2025-11-05 08:23:09 +01:00

35 lines
856 B
C++

#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, std::string name=std::string(""))
{
std::cout << "----------------------------------------------" << std::endl;
std::cout << "- " << name << std::endl;
std::cout << "----------------------------------------------" << std::endl;
for(int i=0; i < size; i++)
{
std::cout << v[i] << std::endl;
}
}
template<typename T>
void check(const dsp::Buffer<T> &target, const dsp::Buffer<T> &actual)
{
if (!(target == actual))
{
std::cout << "Check failed" << std::endl;
print(target, target.capacity(), "Target");
print(actual, actual.capacity(), "Actual");
}
assert(target == actual);
}
#endif