#include <ableton/link_audio/ChannelId.hpp>
#include <ableton/platforms/stl/Random.hpp>
#include <ableton/test/CatchWrapper.hpp>
#include <vector>
namespace ableton
{
namespace link_audio
{
TEST_CASE("ChannelId | RoundtripByteStreamEncoding", "[ChannelId]")
{
using Random = ableton::platforms::stl::Random;
const auto cid = ChannelId{Id::random<Random>()};
auto byteStream = std::vector<uint8_t>(sizeInByteStream(cid));
const auto serializedEnd = toNetworkByteStream(cid, byteStream.begin());
CHECK(byteStream.end() == serializedEnd);
const auto [deserialized, deserializedEnd] =
ChannelId::fromNetworkByteStream(byteStream.begin(), byteStream.end());
CHECK(cid == deserialized);
CHECK(byteStream.end() == deserializedEnd);
}
} }