Classes | Defines | Functions | Variables

tests/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 >

Defines

#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 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.
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 []

Define Documentation

#define GETTEXT_DOMAIN   "wesnoth-test"

Definition at line 16 of file test_network_worker.cpp.


Function Documentation

BOOST_AUTO_TEST_CASE ( test_connect   ) 

Definition at line 56 of file test_network_worker.cpp.

References network::accept_connection(), network::connect(), LOCALHOST, network::server_manager::MUST_CREATE_SERVER, and network::nconnections().

Here is the call graph for this function:

BOOST_AUTO_TEST_CASE ( test_shutdown   ) 

Definition at line 293 of file test_network_worker.cpp.

References wes_manager, and wes_server.

BOOST_AUTO_TEST_CASE ( test_send_client   ) 

Definition at line 95 of file test_network_worker.cpp.

References config::add_child(), client_client1, receive(), network::send_data(), and server_client1.

Here is the call graph for this function:

static std::string create_random_sendfile ( size_t  size  )  [static]

Definition at line 185 of file test_network_worker.cpp.

References ana::buffer(), and ostream_file().

Referenced by WESNOTH_PARAMETERIZED_TEST_CASE().

Here is the call graph for this function:

Here is the caller graph for this function:

static void delete_random_sendfile ( const std::string &  file  )  [static]

Definition at line 203 of file test_network_worker.cpp.

References delete_directory().

Referenced by WESNOTH_PARAMETERIZED_TEST_CASE().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
static network::connection receive ( T &  cfg,
int  max_tries = 100 
) [static]

Definition at line 79 of file test_network_worker.cpp.

References network::null_connection, and network::receive_data().

Referenced by BOOST_AUTO_TEST_CASE(), and WESNOTH_PARAMETERIZED_TEST_CASE().

Here is the call graph for this function:

Here is the caller graph for this function:

WESNOTH_PARAMETERIZED_TEST_CASE ( test_multi_sendfile  ,
sendfile_param  ,
sendfile_sizes  ,
size   
)

Variable Documentation

Definition at line 49 of file test_network_worker.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

Definition at line 50 of file test_network_worker.cpp.

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

Definition at line 42 of file test_network_worker.cpp.

const int MIN_THREADS = 1

Definition at line 41 of file test_network_worker.cpp.

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 180 of file test_network_worker.cpp.

Definition at line 52 of file test_network_worker.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

Definition at line 53 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 40 of file test_network_worker.cpp.

Referenced by WESNOTH_PARAMETERIZED_TEST_CASE().

Definition at line 46 of file test_network_worker.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

Definition at line 47 of file test_network_worker.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:10:43 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs