merged unit test from RC_0_16

This commit is contained in:
Arvid Norberg 2013-05-31 16:33:06 +00:00
parent fb81f96626
commit c464dc2383
4 changed files with 58 additions and 0 deletions

View File

@ -293,6 +293,7 @@ if(build_tests)
test_auto_unchoke
test_http_connection
test_buffer
test_utp
test_storage
test_torrent
test_dht
@ -307,11 +308,15 @@ if(build_tests)
test_ip_filter
test_hasher
test_metadata_extension
test_trackers_extension
test_swarm
test_lsd
test_pex
test_web_seed
test_bandwidth_limiter
test_session
test_torrent_parse
test_threads
)
add_library(test_common STATIC test/main.cpp test/setup_transfer.cpp)

View File

@ -54,6 +54,7 @@ test-suite libtorrent :
[ run test_dht.cpp ]
[ run test_storage.cpp ]
[ run test_torrent_parse.cpp ]
[ run test_session.cpp ]
[ run test_upnp.cpp ]
[ run test_tracker.cpp ]

View File

@ -29,6 +29,7 @@ test_programs = \
test_transfer \
test_upnp \
test_utp \
test_session \
test_web_seed
if ENABLE_TESTS
@ -122,6 +123,7 @@ test_trackers_extension_SOURCES = test_trackers_extension.cpp
test_transfer_SOURCES = test_transfer.cpp
test_upnp_SOURCES = test_upnp.cpp
test_utp_SOURCES = test_utp.cpp
test_session_SOURCES = test_session.cpp
test_web_seed_SOURCES = test_web_seed.cpp
LDADD = $(top_builddir)/src/libtorrent-rasterbar.la libtest.la

50
test/test_session.cpp Normal file
View File

@ -0,0 +1,50 @@
/*
Copyright (c) 2013, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/session.hpp"
#include "test.hpp"
#include "setup_transfer.hpp"
using namespace libtorrent;
int test_main()
{
session ses(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48130, 48140), "0.0.0.0", 0);
ses.set_alert_mask(~0);
// make sure the destructor waits properly
// for the asynchronous call to set the alert
// mask completes, before it goes on to destruct
// the session object
}