lokinet/test/traffic_transfer_unittest.cpp

25 lines
648 B
C++
Raw Normal View History

#include <gtest/gtest.h>
#include <messages/transfer_traffic.hpp>
using TransferTrafficMessage = llarp::routing::TransferTrafficMessage;
class TransferTrafficTest : public ::testing::Test
{
};
TEST_F(TransferTrafficTest, TestPutBufferOverflow)
{
TransferTrafficMessage msg;
byte_t tmp[llarp::routing::MaxExitMTU * 2] = {0};
auto buf = llarp::StackBuffer< decltype(tmp) >(tmp);
2018-11-29 21:19:20 +00:00
ASSERT_FALSE(msg.PutBuffer(buf, 1));
};
TEST_F(TransferTrafficTest, TestPutBuffer)
{
TransferTrafficMessage msg;
byte_t tmp[llarp::routing::MaxExitMTU] = {0};
auto buf = llarp::StackBuffer< decltype(tmp) >(tmp);
2018-11-29 21:19:20 +00:00
ASSERT_TRUE(msg.PutBuffer(buf, 1));
};