#include <cpp/radio/DeSymbolizer.hpp>

void print_bytes(uint8_t *bytes, size_t size)
{
	while(size--)
	{
		printf("%02X", *bytes);
		bytes++;
	}
	printf("\n");
}

void test(DeSymbolizer &dut, size_t numBitsPerSym, symbol_t *syms, size_t numSyms)
{
	size_t numbytes;
	uint8_t bytes[2];

	dut.setNumBitsPerSymbol(numBitsPerSym);
	for (size_t i=0; i < numSyms; i++)
	{
		printf("Symbol %zu\n", i);
		numbytes = dut.sym2bytes(syms[i], bytes);
		if (numbytes)
		{
			print_bytes(bytes, numbytes);
		}
	}
}

int main()
{
	printf("DUT is DeSymbolizer\n");

	DeSymbolizer dut;

	symbol_t syms[] = {0x00000181, 0x00000523, 0x00000781, 0x00000001, 0x00000003, 0x00000003, 0x00000003, 0x00000003};

	test(dut, 2, syms, sizeof(syms)/sizeof(syms[0]));
	test(dut, 8, syms, sizeof(syms)/sizeof(syms[0]));
	test(dut, 12, syms, sizeof(syms)/sizeof(syms[0]));

	return 0;
}
