forked fromglynos/cpp-netlib
- Notifications
You must be signed in to change notification settings - Fork425
Initial migration from Boost.Test to googletest#576
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 1 commit intocpp-netlib:0.12-develfromdeanberris:0.12-devel-gtest-migrationDec 20, 2015
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
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
Initial migration from Boost.Test to googletest
Squashed from a few (local) commits: * Migrate message_transform_test and utils_thread_pool tests to googletest * Simplify message testing, breaking it down to basics (construction, equality) * Add googletest to YCM config * Add the googletest dependency to CMakeLists.txt * Add googlemock and googletest submodules properly. * Add submodules for gtest and gmock
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commitdf3c16cccac022f007e59d3accfd34995c81e7ff
There are no files selected for viewing
6 changes: 6 additions & 0 deletions.gitmodules
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,6 @@ | ||
| [submodule "deps/googletest"] | ||
| path = deps/googletest | ||
| url = https://github.com/google/googletest.git | ||
| [submodule "deps/googlemock"] | ||
| path = deps/googlemock | ||
| url = https://github.com/google/googlemock.git |
4 changes: 4 additions & 0 deletions.ycm_extra_conf.py
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
1 change: 1 addition & 0 deletionsCMakeLists.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
12 changes: 12 additions & 0 deletionsboost/network/message.hpp
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
1 change: 1 addition & 0 deletionsdeps/googlemock
Submodulegooglemock added at f7d03d
1 change: 1 addition & 0 deletionsdeps/googletest
Submodulegoogletest added at ddb801
51 changes: 27 additions & 24 deletionslibs/network/test/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
204 changes: 46 additions & 158 deletionslibs/network/test/message_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 |
|---|---|---|
| @@ -1,177 +1,65 @@ | ||
| // Copyright Dean Michael Berris 2007. | ||
| // Copyright 2015 Google, Inc. | ||
| // 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) | ||
| // Migrated from using Boost.Test to using googletest instead. | ||
| #include <gtest/gtest.h> | ||
| #include <algorithm> | ||
| #include <boost/network/include/message.hpp> | ||
| #include <boost/network/message/directives.hpp> | ||
| namespace{ | ||
| namespace http = boost::network::http; | ||
| namespace network = boost::network; | ||
| template <class T> | ||
| class MessageTest : public ::testing::Test { | ||
| }; | ||
| using TagTypes = ::testing::Types<http::tags::http_default_8bit_tcp_resolve, | ||
| http::tags::http_default_8bit_udp_resolve, | ||
| http::tags::http_keepalive_8bit_tcp_resolve, | ||
| http::tags::http_keepalive_8bit_udp_resolve, | ||
| network::tags::default_string>; | ||
| TYPED_TEST_CASE(MessageTest, TagTypes); | ||
| TYPED_TEST(MessageTest, Constructors){ | ||
| network::basic_message<TypeParam> message; // default construction | ||
| auto copy = message; // copy construction | ||
| ASSERT_TRUE(copy == message); | ||
| } | ||
| TYPED_TEST(MessageTest, Equality) { | ||
| // Create an original message. | ||
| network::basic_message<TypeParam> message; | ||
| message << network::source("source") << network::destination("destination") | ||
| << network::header("key", "value") << network::body("body"); | ||
| // Create the identical message. | ||
| network::basic_message<TypeParam> other; | ||
| other << network::source("source") << network::destination("destination") | ||
| << network::header("key", "value") << network::body("body"); | ||
| ASSERT_TRUE(message == other); | ||
| } | ||
| TYPED_TEST(MessageTest, Inequality) { | ||
| // Create an original message. | ||
| network::basic_message<TypeParam> message; | ||
| message << network::source("source") << network::destination("destination") | ||
| << network::header("key", "value") << network::body("body"); | ||
| // Create a different message. | ||
| network::basic_message<TypeParam> other; | ||
| other << network::source("source") << network::destination("destination") | ||
| << network::header("key", "value") << network::body("different body!"); | ||
| ASSERT_FALSE(message == other); | ||
| } | ||
| } // namespace | ||
33 changes: 16 additions & 17 deletionslibs/network/test/message_transform_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 |
|---|---|---|
| @@ -1,39 +1,38 @@ | ||
| // Copyright Dean Michael Berris 2007. | ||
| // Copyright 2015, Google, Inc. | ||
| // 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 <algorithm> | ||
| #include <boost/network/include/message.hpp> | ||
| TEST(MessageTransformTest, TransformToUpper) { | ||
| using namespace boost::network; | ||
| message msg; | ||
| msg << source("me"); | ||
| ASSERT_EQ("me",source(msg)); | ||
| msg << transform(to_upper_, source_); | ||
| ASSERT_EQ("ME",source(msg)); | ||
| msg << destination("you"); | ||
| ASSERT_EQ("you",destination(msg)); | ||
| msg << transform(to_upper_, destination_); | ||
| ASSERT_EQ("YOU",destination(msg)); | ||
| } | ||
| TEST(MessageTransformTest, TransformToLower) { | ||
| using namespace boost::network; | ||
| message msg; | ||
| msg << source("ME"); | ||
| ASSERT_EQ("ME",source(msg)); | ||
| msg << transform(to_lower_, source_); | ||
| ASSERT_EQ("me",source(msg)); | ||
| msg << destination("YOU"); | ||
| ASSERT_EQ("YOU",destination(msg)); | ||
| msg << transform(to_lower_, destination_); | ||
| ASSERT_EQ("you",destination(msg)); | ||
| } |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.