Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

replace std::shared_future with boost::shared_future#684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
glynos merged 4 commits intocpp-netlib:0.13-releasefromdvd0101:boost_future
Sep 24, 2016
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
new test to cover theready() wrapper
it does not compile now
  • Loading branch information
@dvd0101
dvd0101 committedSep 18, 2016
commitd5df753e415b954c92092145bd89c97a09d6a58d
1 change: 1 addition & 0 deletionslibs/network/test/http/CMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ if (Boost_FOUND)
client_get_test
client_get_different_port_test
# client_get_timeout_test
client_get_ready_test
client_get_streaming_test)
foreach ( test ${TESTS} )
add_executable(cpp-netlib-http-${test} ${test}.cpp)
Expand Down
34 changes: 34 additions & 0 deletionslibs/network/test/http/client_get_ready_test.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
// Copyright 2010 Dean Michael Berris.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <gtest/gtest.h>
#include <boost/network/include/http/client.hpp>
#include "client_types.hpp"

namespace net = boost::network;
namespace http = boost::network::http;
using tclock = std::chrono::high_resolution_clock;

TYPED_TEST_CASE(HTTPClientTest, ClientTypes);

TYPED_TEST(HTTPClientTest, GetTest) {
using client = TypeParam;
typename client::request request("http://cpp-netlib.org/");
client client_;
auto response = client_.get(request);
while (!http::ready(response)) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
auto t0 = tclock::now();
auto data = body(response);
auto t1 = tclock::now();
EXPECT_TRUE(response.status() == 200u ||
(response.status() >= 300 && response.status() < 400));
EXPECT_TRUE(data.size() > 0);

// XXX we should find a better way to check if `ready()` has done his job
namespace c = std::chrono;
EXPECT_TRUE(c::duration_cast<c::milliseconds>(t1-t0).count() < 1);
}

[8]ページ先頭

©2009-2025 Movatter.jp