1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00
VILLASnode/tests/unit/format.cpp

411 lines
13 KiB
C++
Raw Permalink Normal View History

2021-05-10 00:12:30 +02:00
/** Unit tests for formatters.
2017-08-05 21:02:09 +02:00
*
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
2020-01-20 17:17:00 +01:00
* @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
2017-08-05 21:02:09 +02:00
* @license GNU General Public License (version 3)
*
* VILLASnode
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#include <stdio.h>
#include <float.h>
2018-10-20 14:24:51 +02:00
#include <complex>
2017-08-05 21:02:09 +02:00
#include <criterion/criterion.h>
#include <criterion/parameterized.h>
#include <villas/utils.hpp>
2018-03-26 12:50:15 +02:00
#include <villas/timing.h>
#include <villas/sample.h>
2018-08-20 18:32:10 +02:00
#include <villas/signal.h>
2018-03-26 12:50:15 +02:00
#include <villas/pool.h>
2021-05-10 00:12:30 +02:00
#include <villas/format.hpp>
2018-10-20 14:24:51 +02:00
#include <villas/log.hpp>
2017-08-05 21:02:09 +02:00
2020-01-26 16:17:59 +01:00
#include "helpers.hpp"
2018-10-20 14:24:51 +02:00
using namespace villas;
2021-05-10 00:12:30 +02:00
using namespace villas::node;
2018-10-20 14:24:51 +02:00
2018-08-20 18:32:10 +02:00
extern void init_memory();
2017-08-05 21:02:09 +02:00
#define NUM_VALUES 10
2020-06-16 01:00:57 +02:00
using string = std::basic_string<char, std::char_traits<char>, criterion::allocator<char>>;
2020-01-26 16:17:59 +01:00
2020-06-16 01:00:57 +02:00
struct Param {
2020-01-26 16:17:59 +01:00
public:
2020-06-16 01:00:57 +02:00
Param(const char *f, int c, int b) :
fmt(f), cnt(c), bits(b)
{}
string fmt;
2018-08-20 18:32:10 +02:00
int cnt;
int bits;
};
2019-01-07 10:28:55 +01:00
void fill_sample_data(struct vlist *signals, struct sample *smps[], unsigned cnt)
2017-08-05 21:02:09 +02:00
{
2018-03-26 12:50:30 +02:00
struct timespec delta, now;
2017-08-23 15:45:28 +02:00
2018-03-26 12:50:30 +02:00
now = time_now();
delta = time_from_double(50e-6);
2018-08-23 13:32:44 +02:00
for (unsigned i = 0; i < cnt; i++) {
struct sample *smp = smps[i];
2019-06-23 16:13:23 +02:00
smps[i]->flags = (int) SampleFlags::HAS_SEQUENCE | (int) SampleFlags::HAS_DATA | (int) SampleFlags::HAS_TS_ORIGIN;
2019-01-07 10:28:55 +01:00
smps[i]->length = vlist_length(signals);
2017-08-23 15:45:28 +02:00
smps[i]->sequence = 235 + i;
2018-03-26 12:50:30 +02:00
smps[i]->ts.origin = now;
2018-08-20 18:32:10 +02:00
smps[i]->signals = signals;
2017-08-23 15:45:28 +02:00
2019-01-07 10:28:55 +01:00
for (size_t j = 0; j < vlist_length(signals); j++) {
struct signal *sig = (struct signal *) vlist_at(signals, j);
2018-08-23 13:32:44 +02:00
union signal_data *data = &smp->data[j];
2018-08-20 18:32:10 +02:00
switch (sig->type) {
2019-06-23 16:13:23 +02:00
case SignalType::BOOLEAN:
2018-08-23 13:32:44 +02:00
data->b = j * 0.1 + i * 100;
2018-08-20 18:32:10 +02:00
break;
2019-06-23 16:13:23 +02:00
case SignalType::COMPLEX: {
2018-08-23 13:32:44 +02:00
/** @todo: Port to proper C++ */
std::complex<float> z = { j * 0.1f, i * 100.0f };
memcpy(&data->z, &z, sizeof(data->z));
2018-08-20 18:32:10 +02:00
break;
2018-08-23 13:32:44 +02:00
}
2018-08-20 18:32:10 +02:00
2019-06-23 16:13:23 +02:00
case SignalType::FLOAT:
2018-08-23 13:32:44 +02:00
data->f = j * 0.1 + i * 100;
2018-08-20 18:32:10 +02:00
break;
2019-06-23 16:13:23 +02:00
case SignalType::INTEGER:
2018-08-23 13:32:44 +02:00
data->i = j + i * 1000;
2018-08-20 18:32:10 +02:00
break;
default: { }
}
2018-03-26 12:50:30 +02:00
}
now = time_add(&now, &delta);
}
}
2018-08-20 18:32:10 +02:00
void cr_assert_eq_sample(struct sample *a, struct sample *b, int flags)
2018-03-26 12:50:30 +02:00
{
2021-05-10 00:12:30 +02:00
cr_assert_eq(a->length, b->length, "a->length=%d, b->length=%d", a->length, b->length);
2018-03-26 12:50:30 +02:00
2019-06-23 16:13:23 +02:00
if (flags & (int) SampleFlags::HAS_SEQUENCE)
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->sequence, b->sequence);
2018-03-26 12:50:30 +02:00
2019-06-23 16:13:23 +02:00
if (flags & (int) SampleFlags::HAS_TS_ORIGIN) {
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->ts.origin.tv_sec, b->ts.origin.tv_sec);
cr_assert_eq(a->ts.origin.tv_nsec, b->ts.origin.tv_nsec);
}
2019-06-23 16:13:23 +02:00
if (flags & (int) SampleFlags::HAS_DATA) {
for (unsigned j = 0; j < MIN(a->length, b->length); j++) {
2018-08-20 18:32:10 +02:00
cr_assert_eq(sample_format(a, j), sample_format(b, j));
switch (sample_format(b, j)) {
2019-06-23 16:13:23 +02:00
case SignalType::FLOAT:
2018-08-20 18:32:10 +02:00
cr_assert_float_eq(a->data[j].f, b->data[j].f, 1e-3, "Sample data mismatch at index %d: %f != %f", j, a->data[j].f, b->data[j].f);
break;
2019-06-23 16:13:23 +02:00
case SignalType::INTEGER:
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->data[j].i, b->data[j].i, "Sample data mismatch at index %d: %lld != %lld", j, a->data[j].i, b->data[j].i);
break;
2018-03-26 12:50:30 +02:00
2019-06-23 16:13:23 +02:00
case SignalType::BOOLEAN:
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->data[j].b, b->data[j].b, "Sample data mismatch at index %d: %s != %s", j, a->data[j].b ? "true" : "false", b->data[j].b ? "true" : "false");
break;
2019-06-23 16:13:23 +02:00
case SignalType::COMPLEX: {
2018-10-20 14:24:51 +02:00
auto ca = * (std::complex<float> *) &a->data[j].z;
auto cb = * (std::complex<float> *) &b->data[j].z;
cr_assert_float_eq(std::abs(ca - cb), 0, 1e-6, "Sample data mismatch at index %d: %f+%fi != %f+%fi", j, ca.real(), ca.imag(), cb.real(), cb.imag());
2018-08-20 18:32:10 +02:00
break;
2018-10-20 14:24:51 +02:00
}
2018-08-20 18:32:10 +02:00
default: { }
}
2018-03-26 12:50:30 +02:00
}
2017-08-23 15:45:28 +02:00
}
}
2018-08-20 18:32:10 +02:00
void cr_assert_eq_sample_raw(struct sample *a, struct sample *b, int flags, int bits)
2017-08-23 15:45:28 +02:00
{
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->length, b->length);
2017-08-23 15:45:28 +02:00
2019-06-23 16:13:23 +02:00
if (flags & (int) SampleFlags::HAS_SEQUENCE)
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->sequence, b->sequence);
2017-08-23 15:45:28 +02:00
2019-06-23 16:13:23 +02:00
if (flags & (int) SampleFlags::HAS_TS_ORIGIN) {
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->ts.origin.tv_sec, b->ts.origin.tv_sec);
cr_assert_eq(a->ts.origin.tv_nsec, b->ts.origin.tv_nsec);
}
2019-06-23 16:13:23 +02:00
if (flags & (int) SampleFlags::HAS_DATA) {
for (unsigned j = 0; j < MIN(a->length, b->length); j++) {
2018-08-20 18:32:10 +02:00
cr_assert_eq(sample_format(a, j), sample_format(b, j));
switch (sample_format(b, j)) {
2019-06-23 16:13:23 +02:00
case SignalType::FLOAT:
2018-08-20 18:32:10 +02:00
if (bits != 8 && bits != 16)
cr_assert_float_eq(a->data[j].f, b->data[j].f, 1e-3, "Sample data mismatch at index %d: %f != %f", j, a->data[j].f, b->data[j].f);
break;
2019-06-23 16:13:23 +02:00
case SignalType::INTEGER:
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->data[j].i, b->data[j].i, "Sample data mismatch at index %d: %lld != %lld", j, a->data[j].i, b->data[j].i);
break;
2019-06-23 16:13:23 +02:00
case SignalType::BOOLEAN:
2018-08-20 18:32:10 +02:00
cr_assert_eq(a->data[j].b, b->data[j].b, "Sample data mismatch at index %d: %s != %s", j, a->data[j].b ? "true" : "false", b->data[j].b ? "true" : "false");
break;
2019-06-23 16:13:23 +02:00
case SignalType::COMPLEX:
2018-10-20 14:24:51 +02:00
if (bits != 8 && bits != 16) {
auto ca = * (std::complex<float> *) &a->data[j].z;
auto cb = * (std::complex<float> *) &b->data[j].z;
cr_assert_float_eq(std::abs(ca - cb), 0, 1e-6, "Sample data mismatch at index %d: %f+%fi != %f+%fi", j, ca.real(), ca.imag(), cb.real(), cb.imag());
}
2018-08-20 18:32:10 +02:00
break;
default: { }
2017-08-23 15:45:28 +02:00
}
}
}
2017-08-05 21:02:09 +02:00
}
2021-05-10 00:12:30 +02:00
ParameterizedTestParameters(format, lowlevel)
2017-08-05 21:02:09 +02:00
{
2020-06-16 01:00:57 +02:00
static criterion::parameters<Param> params;
2021-05-10 00:12:30 +02:00
params.emplace_back("{ \"type\": \"gtnet\" }", 1, 32);
params.emplace_back("{ \"type\": \"gtnet\", \"fake\": true }", 1, 32);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 8 }", 1, 8);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 16, \"endianess\": \"big\" }", 1, 16);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 16, \"endianess\": \"little\" }", 1, 16);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 32, \"endianess\": \"big\" }", 1, 32);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 32, \"endianess\": \"little\" }", 1, 32);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 64, \"endianess\": \"big\" }", 1, 64);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 64, \"endianess\": \"little\" }", 1, 64);
params.emplace_back("{ \"type\": \"villas.human\" }", 10, 0);
params.emplace_back("{ \"type\": \"villas.binary\" }", 10, 0);
params.emplace_back("{ \"type\": \"csv\" }", 10, 0);
params.emplace_back("{ \"type\": \"tsv\" }", 10, 0);
params.emplace_back("{ \"type\": \"json\" }", 10, 0);
// params.emplace_back("{ \"type\": \"json.kafka\" }", 10, 0); # broken due to signal names
// params.emplace_back("{ \"type\": \"json.reserve\" }", 10, 0);
2020-06-16 01:00:57 +02:00
#ifdef PROTOBUF_FOUND
2021-05-10 00:12:30 +02:00
params.emplace_back("{ \"type\": \"protobuf\" }", 10, 0 );
2020-06-16 01:00:57 +02:00
#endif
2020-01-26 16:17:59 +01:00
return params;
2017-08-23 15:45:28 +02:00
}
2017-08-05 21:02:09 +02:00
// cppcheck-suppress unknownMacro
2021-05-10 00:12:30 +02:00
ParameterizedTest(Param *p, format, lowlevel, .init = init_memory)
2017-08-23 15:45:28 +02:00
{
2018-08-23 13:32:44 +02:00
int ret;
unsigned cnt;
2017-08-23 15:45:28 +02:00
char buf[8192];
size_t wbytes, rbytes;
2017-09-04 14:30:07 +02:00
2021-05-10 00:12:30 +02:00
Logger logger = logging.get("test:format:lowlevel");
2018-10-20 14:24:51 +02:00
2021-03-19 06:35:14 -04:00
logger->info("Running test for format={}, cnt={}", p->fmt, p->cnt);
2018-10-20 14:24:51 +02:00
2020-06-16 02:35:34 +02:00
struct pool pool;
2021-05-10 00:12:30 +02:00
Format *fmt;
2020-06-16 02:35:34 +02:00
struct vlist signals;
2018-08-20 18:32:10 +02:00
struct sample *smps[p->cnt];
struct sample *smpt[p->cnt];
2017-08-23 15:45:28 +02:00
ret = pool_init(&pool, 2 * p->cnt, SAMPLE_LENGTH(NUM_VALUES));
2017-08-23 15:45:28 +02:00
cr_assert_eq(ret, 0);
ret = vlist_init(&signals);
cr_assert_eq(ret, 0);
2019-06-23 16:13:23 +02:00
signal_list_generate(&signals, NUM_VALUES, SignalType::FLOAT);
2018-08-20 18:32:10 +02:00
ret = sample_alloc_many(&pool, smps, p->cnt);
cr_assert_eq(ret, p->cnt);
2018-03-26 12:50:30 +02:00
2018-08-20 18:32:10 +02:00
ret = sample_alloc_many(&pool, smpt, p->cnt);
cr_assert_eq(ret, p->cnt);
2017-09-04 14:30:07 +02:00
2018-08-20 18:32:10 +02:00
fill_sample_data(&signals, smps, p->cnt);
2017-09-04 14:30:07 +02:00
2021-05-10 00:12:30 +02:00
json_t *json_format = json_loads(p->fmt.c_str(), 0, nullptr);
cr_assert_not_null(json_format);
2018-08-20 18:32:10 +02:00
2021-05-10 00:12:30 +02:00
fmt = FormatFactory::make(json_format);
cr_assert_not_null(fmt, "Failed to create formatter of type '%s'", p->fmt.c_str());
2018-05-12 15:25:47 +02:00
2021-05-10 00:12:30 +02:00
fmt->start(&signals, (int) SampleFlags::HAS_ALL);
2017-09-04 14:30:07 +02:00
2021-05-10 00:12:30 +02:00
cnt = fmt->sprint(buf, sizeof(buf), &wbytes, smps, p->cnt);
cr_assert_eq(cnt, p->cnt, "Written only %d of %d samples", cnt, p->cnt);
cnt = fmt->sscan(buf, wbytes, &rbytes, smpt, p->cnt);
cr_assert_eq(cnt, p->cnt, "Read only %d of %d samples back", cnt, p->cnt);
2017-09-04 14:30:07 +02:00
2018-08-20 18:32:10 +02:00
cr_assert_eq(rbytes, wbytes, "rbytes != wbytes: %#zx != %#zx", rbytes, wbytes);
2017-08-23 15:45:28 +02:00
2018-08-23 13:32:44 +02:00
for (unsigned i = 0; i < cnt; i++) {
2018-08-20 18:32:10 +02:00
if (p->bits)
2021-05-10 00:12:30 +02:00
cr_assert_eq_sample_raw(smps[i], smpt[i], fmt->getFlags(), p->bits);
2018-08-20 18:32:10 +02:00
else
2021-05-10 00:12:30 +02:00
cr_assert_eq_sample(smps[i], smpt[i], fmt->getFlags());
2018-08-20 18:32:10 +02:00
}
sample_free_many(smps, p->cnt);
sample_free_many(smpt, p->cnt);
ret = pool_destroy(&pool);
2017-08-23 15:45:28 +02:00
cr_assert_eq(ret, 0);
}
2021-05-10 00:12:30 +02:00
ParameterizedTestParameters(format, highlevel)
2017-08-23 15:45:28 +02:00
{
2020-06-16 01:00:57 +02:00
static criterion::parameters<Param> params;
2021-05-10 00:12:30 +02:00
params.emplace_back("{ \"type\": \"gtnet\" }", 1, 32);
params.emplace_back("{ \"type\": \"gtnet\", \"fake\": true }", 1, 32);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 8 }", 1, 8);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 16, \"endianess\": \"big\" }", 1, 16);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 16, \"endianess\": \"little\" }", 1, 16);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 32, \"endianess\": \"big\" }", 1, 32);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 32, \"endianess\": \"little\" }", 1, 32);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 64, \"endianess\": \"big\" }", 1, 64);
params.emplace_back("{ \"type\": \"raw\", \"bits\": 64, \"endianess\": \"little\" }", 1, 64);
params.emplace_back("{ \"type\": \"villas.human\" }", 10, 0);
params.emplace_back("{ \"type\": \"villas.binary\" }", 10, 0);
params.emplace_back("{ \"type\": \"csv\" }", 10, 0);
params.emplace_back("{ \"type\": \"tsv\" }", 10, 0);
params.emplace_back("{ \"type\": \"json\" }", 10, 0);
// params.emplace_back("{ \"type\": \"json.kafka\" }", 10, 0); # broken due to signal names
// params.emplace_back("{ \"type\": \"json.reserve\" }", 10, 0);
2020-06-16 01:00:57 +02:00
#ifdef PROTOBUF_FOUND
2021-05-10 00:12:30 +02:00
params.emplace_back("{ \"type\": \"protobuf\" }", 10, 0 );
2020-06-16 01:00:57 +02:00
#endif
2020-01-26 16:17:59 +01:00
return params;
2017-08-05 21:02:09 +02:00
}
2021-05-10 00:12:30 +02:00
ParameterizedTest(Param *p, format, highlevel, .init = init_memory)
2017-08-05 21:02:09 +02:00
{
int ret, cnt;
char *retp;
2017-08-05 21:02:09 +02:00
2021-05-10 00:12:30 +02:00
Logger logger = logging.get("test:format:highlevel");
2018-10-20 14:24:51 +02:00
2021-03-19 06:35:14 -04:00
logger->info("Running test for format={}, cnt={}", p->fmt, p->cnt);
2018-10-20 14:24:51 +02:00
2018-08-20 18:32:10 +02:00
struct sample *smps[p->cnt];
struct sample *smpt[p->cnt];
2018-05-12 13:56:12 +02:00
2020-06-16 02:35:34 +02:00
struct pool pool;
struct vlist signals;
2021-05-10 00:12:30 +02:00
Format *fmt;
2020-06-16 02:35:34 +02:00
ret = pool_init(&pool, 2 * p->cnt, SAMPLE_LENGTH(NUM_VALUES));
2017-08-05 21:02:09 +02:00
cr_assert_eq(ret, 0);
2018-08-20 18:32:10 +02:00
ret = sample_alloc_many(&pool, smps, p->cnt);
cr_assert_eq(ret, p->cnt);
ret = sample_alloc_many(&pool, smpt, p->cnt);
cr_assert_eq(ret, p->cnt);
ret = vlist_init(&signals);
cr_assert_eq(ret, 0);
2019-06-23 16:13:23 +02:00
signal_list_generate(&signals, NUM_VALUES, SignalType::FLOAT);
2018-08-20 18:32:10 +02:00
fill_sample_data(&signals, smps, p->cnt);
2017-08-05 21:02:09 +02:00
2021-05-10 00:12:30 +02:00
/* Open a file for testing the formatter */
char *fn, dir[64];
strncpy(dir, "/tmp/villas.XXXXXX", sizeof(dir));
2017-09-04 14:30:07 +02:00
retp = mkdtemp(dir);
cr_assert_not_null(retp);
ret = asprintf(&fn, "%s/file", dir);
cr_assert_gt(ret, 0);
2017-08-05 21:02:09 +02:00
2021-05-10 00:12:30 +02:00
json_t *json_format = json_loads(p->fmt.c_str(), 0, nullptr);
cr_assert_not_null(json_format);
2018-08-20 18:32:10 +02:00
2021-05-10 00:12:30 +02:00
fmt = FormatFactory::make(json_format);
cr_assert_not_null(fmt, "Failed to create formatter of type '%s'", p->fmt.c_str());
2017-08-05 21:02:09 +02:00
2021-05-10 00:12:30 +02:00
fmt->start(&signals, (int) SampleFlags::HAS_ALL);
2017-08-05 21:02:09 +02:00
2021-05-10 00:12:30 +02:00
auto *stream = fopen(fn, "w+");
cr_assert_not_null(stream);
2017-09-04 14:30:07 +02:00
2021-05-10 00:12:30 +02:00
cnt = fmt->print(stream, smps, p->cnt);
cr_assert_eq(cnt, p->cnt, "Written only %d of %d samples", cnt, p->cnt);
ret = fflush(stream);
2017-09-04 14:30:07 +02:00
cr_assert_eq(ret, 0);
2017-08-05 21:02:09 +02:00
#if 0 /* Show the file contents */
2017-08-05 21:02:09 +02:00
char cmd[128];
2020-06-16 01:00:57 +02:00
if (p->fmt == "csv" || p->fmt == "json" || p->fmt == "villas.human")
snprintf(cmd, sizeof(cmd), "cat %s", fn);
else
snprintf(cmd, sizeof(cmd), "hexdump -C %s", fn);
2017-08-05 21:02:09 +02:00
system(cmd);
#endif
2017-09-04 14:30:07 +02:00
2021-05-10 00:12:30 +02:00
rewind(stream);
2021-05-10 00:12:30 +02:00
cnt = fmt->scan(stream, smpt, p->cnt);
2018-08-20 18:32:10 +02:00
cr_assert_eq(cnt, p->cnt, "Read only %d of %d samples back", cnt, p->cnt);
for (int i = 0; i < cnt; i++) {
if (p->bits)
2021-05-10 00:12:30 +02:00
cr_assert_eq_sample_raw(smps[i], smpt[i], fmt->getFlags(), p->bits);
2018-08-20 18:32:10 +02:00
else
2021-05-10 00:12:30 +02:00
cr_assert_eq_sample(smps[i], smpt[i], fmt->getFlags());
2018-08-20 18:32:10 +02:00
}
2017-08-05 21:02:09 +02:00
2021-05-10 00:12:30 +02:00
ret = fclose(stream);
2017-08-05 21:02:09 +02:00
cr_assert_eq(ret, 0);
2021-05-10 00:12:30 +02:00
delete fmt;
2017-08-05 21:02:09 +02:00
ret = unlink(fn);
cr_assert_eq(ret, 0);
2017-09-04 14:30:07 +02:00
ret = rmdir(dir);
2017-08-05 21:02:09 +02:00
cr_assert_eq(ret, 0);
2017-09-04 14:30:07 +02:00
free(fn);
2017-08-05 21:02:09 +02:00
2018-08-20 18:32:10 +02:00
sample_free_many(smps, p->cnt);
sample_free_many(smpt, p->cnt);
2017-08-05 21:02:09 +02:00
2018-08-20 18:32:10 +02:00
ret = pool_destroy(&pool);
2017-08-05 21:02:09 +02:00
cr_assert_eq(ret, 0);
}