lokinet/test/routing/llarp_routing_transfer_traffic.cpp

25 lines
628 B
C++
Raw Normal View History

#include <gtest/gtest.h>
2019-06-19 22:30:07 +00:00
#include <routing/transfer_traffic_message.hpp>
using TransferTrafficMessage = llarp::routing::TransferTrafficMessage;
class TransferTrafficTest : public ::testing::Test
{
};
TEST_F(TransferTrafficTest, TestPutBufferOverflow)
{
TransferTrafficMessage msg;
2019-02-05 23:48:00 +00:00
std::array< byte_t, llarp::routing::MaxExitMTU* 2 > tmp = {{0}};
2019-02-02 23:12:42 +00:00
llarp_buffer_t buf(tmp);
2018-11-29 21:19:20 +00:00
ASSERT_FALSE(msg.PutBuffer(buf, 1));
2019-04-25 23:21:19 +00:00
}
TEST_F(TransferTrafficTest, TestPutBuffer)
{
TransferTrafficMessage msg;
2019-02-05 23:48:00 +00:00
std::array< byte_t, llarp::routing::MaxExitMTU > tmp = {{0}};
2019-02-02 23:12:42 +00:00
llarp_buffer_t buf(tmp);
2018-11-29 21:19:20 +00:00
ASSERT_TRUE(msg.PutBuffer(buf, 1));
2019-04-25 23:21:19 +00:00
}