The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Macros | Functions | Variables
test_network_worker.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "utils/auto_parameterized.hpp"
#include "utils/predicate.hpp"
#include "network_worker.hpp"
#include "thread.hpp"
#include "filesystem.hpp"
#include "config.hpp"
#include "game_config.hpp"
Include dependency graph for test_network_worker.cpp:

Go to the source code of this file.

Classes

class  connect_aborter
 
struct  sendfile_param
 
class  auto_resetter< T >
 

Macros

#define GETTEXT_DOMAIN   "wesnoth-test"
 

Functions

 BOOST_AUTO_TEST_CASE (test_connect)
 
template<class T >
static network::connection receive (T &cfg, int max_tries=100)
 
 BOOST_AUTO_TEST_CASE (test_send_client)
 
static void try_send_random_seed (const std::string seed_str, const unsigned int random_calls)
 
 BOOST_AUTO_TEST_CASE (test_send_random_seed)
 
static std::string create_random_sendfile (size_t size)
 
static void delete_random_sendfile (const std::string &file)
 
 WESNOTH_PARAMETERIZED_TEST_CASE (test_multi_sendfile, sendfile_param, sendfile_sizes, size)
 
 BOOST_AUTO_TEST_CASE (test_shutdown)
 

Variables

const int TEST_PORT = 15010
 Test networking to prevent bugs there. More...
 
const int MIN_THREADS = 1
 
const int MAX_THREADS = 5
 
const std::string LOCALHOST = "localhost"
 
network::managerwes_manager
 
network::server_managerwes_server
 
network::connection client_client1
 
network::connection client_client2
 
network::connection server_client1
 
network::connection server_client2
 
sendfile_param sendfile_sizes []
 

Macro Definition Documentation

#define GETTEXT_DOMAIN   "wesnoth-test"

Definition at line 15 of file test_network_worker.cpp.

Function Documentation

BOOST_AUTO_TEST_CASE ( test_connect  )
BOOST_AUTO_TEST_CASE ( test_send_client  )
BOOST_AUTO_TEST_CASE ( test_send_random_seed  )

Definition at line 142 of file test_network_worker.cpp.

References try_send_random_seed().

BOOST_AUTO_TEST_CASE ( test_shutdown  )

Definition at line 332 of file test_network_worker.cpp.

References wes_manager, and wes_server.

static std::string create_random_sendfile ( size_t  size)
static

Definition at line 224 of file test_network_worker.cpp.

References filesystem::ostream_file().

Referenced by WESNOTH_PARAMETERIZED_TEST_CASE().

static void delete_random_sendfile ( const std::string file)
static

Definition at line 242 of file test_network_worker.cpp.

References filesystem::delete_file().

Referenced by WESNOTH_PARAMETERIZED_TEST_CASE().

template<class T >
static network::connection receive ( T &  cfg,
int  max_tries = 100 
)
static
static void try_send_random_seed ( const std::string  seed_str,
const unsigned int  random_calls 
)
static
WESNOTH_PARAMETERIZED_TEST_CASE ( test_multi_sendfile  ,
sendfile_param  ,
sendfile_sizes  ,
size   
)

Variable Documentation

network::connection client_client1

Definition at line 48 of file test_network_worker.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and try_send_random_seed().

network::connection client_client2

Definition at line 49 of file test_network_worker.cpp.

const std::string LOCALHOST = "localhost"
const int MAX_THREADS = 5

Definition at line 41 of file test_network_worker.cpp.

const int MIN_THREADS = 1

Definition at line 40 of file test_network_worker.cpp.

sendfile_param sendfile_sizes[]
Initial value:
= {sendfile_param(1*1024,true),
sendfile_param(5*1024*1024,true),
sendfile_param(1*1024,false),
sendfile_param(5*1024*1024,false)}

Definition at line 219 of file test_network_worker.cpp.

network::connection server_client1

Definition at line 51 of file test_network_worker.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and try_send_random_seed().

network::connection server_client2

Definition at line 52 of file test_network_worker.cpp.

const int TEST_PORT = 15010

Test networking to prevent bugs there.

Try to create all kind of unlikely error conditions Some test should lock management_mutex from worker to settup stress test It is like that this will need some threading also :(

Definition at line 39 of file test_network_worker.cpp.

Referenced by WESNOTH_PARAMETERIZED_TEST_CASE().

network::manager* wes_manager

Definition at line 45 of file test_network_worker.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

Definition at line 46 of file test_network_worker.cpp.

Referenced by BOOST_AUTO_TEST_CASE().