#include <string>
#include <print>
#include "encode.h"
#include "decode.h"
int main()
{
#if 1
auto field = librscpp::GF2n<>(0b1'0001'1101, 0); #else#endif
std::println("Using field: GF({}) and fcr: {}", field.size(), field.fcr());
const std::string data = "Hello, World!";
constexpr int paritySize = 4;
auto codeword = librscpp::encode(field, data, paritySize);
std::println("Encoded codeword: '{}'", codeword);
codeword[3] = codeword[8] = '*';
std::println("Corrupt codeword: '{}'", codeword);
auto res = librscpp::decode(field, codeword, paritySize);
if (res)
std::println("Decoded codeword: '{}'\nUsed parity symbols: {}", codeword, *res);
else
std::println("Failed to decode codeword.");
return 0;
}