ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
net_gtest.cpp File Reference

网络层的单元测试。 More...

#include <gtest/gtest.h>
#include <array>
#include <algorithm>
#include <atomic>
#include <chrono>
#include <functional>
#include <string>
#include <future>
#include <memory>
#include <thread>
#include <utility>
#include <vector>
#include "actor/actor_base/core/nguid.h"
#include "actor/protocol/nprotocol.h"
#include "net/server_session.h"
#include "net/tcp/asio_tcp.h"
#include "net/tcp/ntcp.h"
#include "net/udp/kcp/asio_kcp.h"
#include "net/udp/kcp/kcp_session.h"
#include "net/udp/kcp/ukcp.h"
#include "test_support.h"

Typedefs

using basio_errorcode = ngl::basio_errorcode

Functions

std::shared_ptr< ngl::packnet_test_support::make_test_packet (const std::string &payload)
bool net_test_support::wait_for_condition (const std::function< bool()> &predicate, std::chrono::milliseconds timeout)
 TEST (NetTest, ServerSessionReplacesExistingMappingsBidirectionally)
 TEST (NetTest, SendClientReportsFailureWhenGatewayIsUnavailable)
 TEST (NetTest, BatchSendReportsFailureWhenAnySessionIsUnavailable)
 TEST (NetTest, AsioTcpConnectReportsFinalFailure)
 TEST (NetTest, AsioTcpCloseNetRemovesIpPortEntry)
 TEST (NetTest, AsioTcpCloseDisconnectsPeerAndNotifiesOnce)
 TEST (NetTest, AsioTcpServerAndClientExchangePayloads)
 TEST (NetTest, AsioTcpServerExchangesPayloadsWithPlainAsioClient)
 TEST (NetTest, AsioTcpClientExchangesPayloadsWithPlainAsioServer)
 TEST (NetTest, KcpSessionMaintainsActorIndexesAndAreaIteration)
 TEST (NetTest, AsioKcpCloseConsumesCloseRetAndRemovesBothSessions)
 TEST (NetTest, AsioKcpRejectsInvalidBuffersAndUnknownSessions)
std::shared_ptr< ngl::packmake_test_packet (const std::string &payload)
bool wait_for_condition (const std::function< bool()> &predicate, std::chrono::milliseconds timeout)
template<typename tval>
void try_set (const std::shared_ptr< std::promise< tval > > &apromise, tval avalue)

Detailed Description

网络层的单元测试。