hamnet70/impl/test/test_interleaver.c

33 lines
679 B
C
Raw Permalink Normal View History

/*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Copyright (C) 2024 Thomas Kolb
*/
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <layer1/interleaver.h>
int main(void)
{
const size_t N = 100;
float complex orig[N];
float complex interleaved[N];
float complex deinterleaved[N];
for(size_t i = 0; i < N; i++) {
orig[i] = (float complex)i;
}
2024-08-14 19:13:41 +02:00
interleaver_interleave_cf(orig, interleaved, N);
interleaver_deinterleave_cf(interleaved, deinterleaved, N);
for(size_t i = 0; i < N; i++) {
printf("%5zu %5.1f %5.1f %5.1f\n", i, crealf(orig[i]), crealf(interleaved[i]), crealf(deinterleaved[i]));
assert(orig[i] == deinterleaved[i]);
}
}