forked fromglynos/cpp-netlib
- Notifications
You must be signed in to change notification settings - Fork425
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
4 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
NextNext commit
new test to cover the
ready()
wrapperit does not compile now
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commitd5df753e415b954c92092145bd89c97a09d6a58d
There are no files selected for viewing
1 change: 1 addition & 0 deletionslibs/network/test/http/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletionslibs/network/test/http/client_get_ready_test.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff 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); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.