#include <gtest/gtest.h>
#include <stdexcept>
#include <vector>
#include "backends/dongl/serial/Protocol.h"
using namespace SimpleBLE;
TEST(BufferOverflowTest, DonglProtocolWriteOverflow) {
try {
SimpleBLE::Dongl::Serial::Protocol p("dummy");
std::vector<uint8_t> data(1000, 'C');
p.simpleble_write(0, 0, static_cast<simpleble_WriteOperation>(0), data);
FAIL() << "Expected std::length_error";
} catch (const std::length_error& e) {
EXPECT_STREQ(e.what(), "Payload exceeds maximum size of 512 bytes");
} catch (const std::runtime_error& e) {
SUCCEED();
}
}