2018-11-12 16:43:40 +00:00
|
|
|
#include <gtest/gtest.h>
|
2018-12-12 02:52:51 +00:00
|
|
|
#include <messages/transfer_traffic.hpp>
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
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));
|
2018-11-12 16:43:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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));
|
2018-11-12 16:43:40 +00:00
|
|
|
};
|