Add the ability to print a nearly arbitrary CBOR encoded value

This commit is contained in:
TennesseeTrash 2025-09-26 01:52:23 +02:00
parent c3278e807b
commit f383ea9f66
6 changed files with 332 additions and 43 deletions

View file

@ -1,7 +1,9 @@
#include "CBOR/Decoder.hpp"
#include "CBOR/Encoder.hpp"
#include "Cbor/Printer.hpp"
#include <array>
#include <cstdint>
#include <iostream>
#include <print>
#include <ranges>
#include <stdexcept>
@ -206,6 +208,9 @@ int main()
SomeStruct result1 = Decode1(std::span<std::uint8_t>(buffer.data(), encodedSize));
SomeStruct result2 = Decode2(std::span<std::uint8_t>(buffer.data(), encodedSize));
std::println("JSON-esque serialization:");
CBOR::Print(std::cout, std::span<std::uint8_t>(buffer.data(), encodedSize));
Compare(expected, result1);
Compare(expected, result2);
std::println("The test has been completed successfully.");