#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"
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::manager * | wes_manager |
network::server_manager * | wes_server |
network::connection | client_client1 |
network::connection | client_client2 |
network::connection | server_client1 |
network::connection | server_client2 |
sendfile_param | sendfile_sizes [] |
#define GETTEXT_DOMAIN "wesnoth-test" |
Definition at line 15 of file test_network_worker.cpp.
BOOST_AUTO_TEST_CASE | ( | test_connect | ) |
Definition at line 55 of file test_network_worker.cpp.
References network::accept_connection(), network::connect(), LOCALHOST, network::server_manager::MUST_CREATE_SERVER, and network::nconnections().
BOOST_AUTO_TEST_CASE | ( | test_send_client | ) |
Definition at line 94 of file test_network_worker.cpp.
References config::add_child(), client_client1, receive(), network::send_data(), and server_client1.
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 |
Definition at line 224 of file test_network_worker.cpp.
References filesystem::ostream_file().
Referenced by WESNOTH_PARAMETERIZED_TEST_CASE().
|
static |
Definition at line 242 of file test_network_worker.cpp.
References filesystem::delete_file().
Referenced by WESNOTH_PARAMETERIZED_TEST_CASE().
|
static |
Definition at line 78 of file test_network_worker.cpp.
References network::null_connection, and network::receive_data().
Referenced by BOOST_AUTO_TEST_CASE(), try_send_random_seed(), and WESNOTH_PARAMETERIZED_TEST_CASE().
|
static |
Definition at line 114 of file test_network_worker.cpp.
References config::add_child(), config::child(), client_client1, receive(), network::send_data(), and server_client1.
Referenced by BOOST_AUTO_TEST_CASE().
WESNOTH_PARAMETERIZED_TEST_CASE | ( | test_multi_sendfile | , |
sendfile_param | , | ||
sendfile_sizes | , | ||
size | |||
) |
Definition at line 262 of file test_network_worker.cpp.
References network::accept_connection(), network::connect(), create_random_sendfile(), delete_random_sendfile(), network::disconnect(), filesystem::file_size(), LOCALHOST, game_config::path, receive(), network::send_file(), network::set_raw_data_only(), network_worker_pool::set_use_system_sendfile(), and TEST_PORT.
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" |
Definition at line 42 of file test_network_worker.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and WESNOTH_PARAMETERIZED_TEST_CASE().
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[] |
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().
network::server_manager* wes_server |
Definition at line 46 of file test_network_worker.cpp.
Referenced by BOOST_AUTO_TEST_CASE().