Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
6de39826
Unverified
Commit
6de39826
authored
Aug 22, 2018
by
Jacob Schloss
Committed by
GitHub
Aug 22, 2018
Browse files
Merge branch 'master' into issue_1735
parents
6e798016
1d9a1912
Changes
182
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
54 additions
and
55 deletions
+54
-55
googletest/include/gtest/internal/gtest-param-util.h
googletest/include/gtest/internal/gtest-param-util.h
+1
-2
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+25
-11
googletest/include/gtest/internal/gtest-string.h
googletest/include/gtest/internal/gtest-string.h
+0
-1
googletest/include/gtest/internal/gtest-tuple.h
googletest/include/gtest/internal/gtest-tuple.h
+2
-3
googletest/include/gtest/internal/gtest-tuple.h.pump
googletest/include/gtest/internal/gtest-tuple.h.pump
+2
-3
googletest/include/gtest/internal/gtest-type-util.h
googletest/include/gtest/internal/gtest-type-util.h
+1
-2
googletest/include/gtest/internal/gtest-type-util.h.pump
googletest/include/gtest/internal/gtest-type-util.h.pump
+1
-2
googletest/samples/prime_tables.h
googletest/samples/prime_tables.h
+2
-3
googletest/samples/sample1.cc
googletest/samples/sample1.cc
+0
-2
googletest/samples/sample1.h
googletest/samples/sample1.h
+0
-2
googletest/samples/sample10_unittest.cc
googletest/samples/sample10_unittest.cc
+1
-2
googletest/samples/sample1_unittest.cc
googletest/samples/sample1_unittest.cc
+0
-3
googletest/samples/sample2.cc
googletest/samples/sample2.cc
+0
-2
googletest/samples/sample2.h
googletest/samples/sample2.h
+0
-2
googletest/samples/sample2_unittest.cc
googletest/samples/sample2_unittest.cc
+0
-3
googletest/samples/sample3-inl.h
googletest/samples/sample3-inl.h
+0
-2
googletest/samples/sample3_unittest.cc
googletest/samples/sample3_unittest.cc
+0
-3
googletest/samples/sample4.cc
googletest/samples/sample4.cc
+10
-2
googletest/samples/sample4.h
googletest/samples/sample4.h
+3
-3
googletest/samples/sample4_unittest.cc
googletest/samples/sample4_unittest.cc
+6
-2
No files found.
googletest/include/gtest/internal/gtest-param-util.h
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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.
//
// Author: vladl@google.com (Vlad Losev)
// Type and function utilities for implementing parameterized tests.
...
...
googletest/include/gtest/internal/gtest-port.h
View file @
6de39826
...
...
@@ -27,8 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Authors: wan@google.com (Zhanyong Wan)
//
// Low-level types and utilities for porting Google Test to various
// platforms. All macros ending with _ and symbols defined in an
// internal namespace are subject to change without notice. Code
...
...
@@ -329,6 +327,22 @@
# define GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif
// Clang on Windows does not understand MSVC's pragma warning.
// We need clang-specific way to disable function deprecation warning.
#ifdef __clang__
# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"")
#define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
_Pragma("clang diagnostic pop")
#else
# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
# define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif
#ifndef GTEST_LANG_CXX11
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
...
...
@@ -533,7 +547,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#ifndef GTEST_HAS_STD_WSTRING
// The user didn't tell us whether ::std::wstring is available, so we need
// to figure it out.
//
TODO(wan@google.com)
: uses autoconf to detect whether ::std::wstring
//
FIXME
: uses autoconf to detect whether ::std::wstring
// is available.
// Cygwin 1.7 and below doesn't support ::std::wstring.
...
...
@@ -745,7 +759,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
// which is #included by <tr1/tuple>, to not compile when RTTI is
// disabled. _TR1_FUNCTIONAL is the header guard for
// <tr1/functional>. Hence the following #define is
a hack
to prevent
// <tr1/functional>. Hence the following #define is
used
to prevent
// <tr1/functional> from being included.
# define _TR1_FUNCTIONAL 1
# include <tr1/tuple>
...
...
@@ -1250,7 +1264,7 @@ class GTEST_API_ RE {
// PartialMatch(str, re) returns true iff regular expression re
// matches a substring of str (including str itself).
//
//
TODO(wan@google.com)
: make FullMatch() and PartialMatch() work
//
FIXME
: make FullMatch() and PartialMatch() work
// when str contains NUL characters.
static
bool
FullMatch
(
const
::
std
::
string
&
str
,
const
RE
&
re
)
{
return
FullMatch
(
str
.
c_str
(),
re
);
...
...
@@ -1277,7 +1291,7 @@ class GTEST_API_ RE {
void
Init
(
const
char
*
regex
);
// We use a const char* instead of an std::string, as Google Test used to be
// used where std::string is not available.
TODO(wan@google.com)
: change to
// used where std::string is not available.
FIXME
: change to
// std::string.
const
char
*
pattern_
;
bool
is_valid_
;
...
...
@@ -2093,8 +2107,8 @@ class MutexBase {
// particular, the owner_ field (a pthread_t) is not explicitly initialized.
// This allows initialization to work whether pthread_t is a scalar or struct.
// The flag -Wmissing-field-initializers must not be specified for this to work.
#
define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
::testing::internal::MutexBase mutex = {
PTHREAD_MUTEX_INITIALIZER, false
}
#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false
, 0
}
// The Mutex class can only be used for mutexes created at runtime. It
// shares its API with MutexBase otherwise.
...
...
@@ -2484,7 +2498,7 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
// Functions deprecated by MSVC 8.0.
GTEST_DISABLE_MSC_
WARNINGS_PUSH_
(
4996
/* deprecated function */
)
GTEST_DISABLE_MSC_
DEPRECATED_PUSH_
(
)
inline
const
char
*
StrNCpy
(
char
*
dest
,
const
char
*
src
,
size_t
n
)
{
return
strncpy
(
dest
,
src
,
n
);
...
...
@@ -2532,7 +2546,7 @@ inline const char* GetEnv(const char* name) {
#endif
}
GTEST_DISABLE_MSC_
WARNINGS
_POP_
()
GTEST_DISABLE_MSC_
DEPRECATED
_POP_
()
#if GTEST_OS_WINDOWS_MOBILE
// Windows CE has no C library. The abort() function is used in
...
...
@@ -2670,7 +2684,7 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
// to *value and returns true; otherwise leaves *value unchanged and returns
// false.
//
TODO(chandlerc)
: Find a better way to refactor flag and environment parsing
//
FIXME
: Find a better way to refactor flag and environment parsing
// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
// function.
bool
ParseInt32
(
const
Message
&
src_text
,
const
char
*
str
,
Int32
*
value
);
...
...
googletest/include/gtest/internal/gtest-string.h
View file @
6de39826
...
...
@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
// The Google C++ Testing and Mocking Framework (Google Test)
//
// This header file declares the String class and functions used internally by
...
...
googletest/include/gtest/internal/gtest-tuple.h
View file @
6de39826
...
...
@@ -30,8 +30,7 @@
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
...
...
@@ -44,7 +43,7 @@
// The compiler used in Symbian has a bug that prevents us from declaring the
// tuple template as a friend (it complains that tuple is redefined). This
//
hack
bypasses the bug by declaring the members that should otherwise be
// bypasses the bug by declaring the members that should otherwise be
// private as public.
// Sun Studio versions < 12 also have the above bug.
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
...
...
googletest/include/gtest/internal/gtest-tuple.h.pump
View file @
6de39826
...
...
@@ -29,8 +29,7 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
...
...
@@ -43,7 +42,7 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
// The compiler used in Symbian has a bug that prevents us from declaring the
// tuple template as a friend (it complains that tuple is redefined). This
//
hack
bypasses the bug by declaring the members that should otherwise be
// bypasses the bug by declaring the members that should otherwise be
// private as public.
// Sun Studio versions < 12 also have the above bug.
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
...
...
googletest/include/gtest/internal/gtest-type-util.h
View file @
6de39826
...
...
@@ -30,8 +30,7 @@
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
// Type utilities needed for implementing typed and type-parameterized
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
...
...
googletest/include/gtest/internal/gtest-type-util.h.pump
View file @
6de39826
...
...
@@ -28,8 +28,7 @@ $var n = 50 $$ Maximum length of type lists we want to support.
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
// Type utilities needed for implementing typed and type-parameterized
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
...
...
googletest/samples/prime_tables.h
View file @
6de39826
...
...
@@ -26,9 +26,8 @@
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
// Author: vladl@google.com (Vlad Losev)
// This provides interface PrimeTable that determines whether a number is a
// prime and determines a next prime number. This interface is used
...
...
googletest/samples/sample1.cc
View file @
6de39826
...
...
@@ -28,8 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
#include "sample1.h"
...
...
googletest/samples/sample1.h
View file @
6de39826
...
...
@@ -28,8 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
#ifndef GTEST_SAMPLES_SAMPLE1_H_
#define GTEST_SAMPLES_SAMPLE1_H_
...
...
googletest/samples/sample10_unittest.cc
View file @
6de39826
...
...
@@ -25,8 +25,7 @@
// 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.
//
// Author: vladl@google.com (Vlad Losev)
// This sample shows how to use Google Test listener API to implement
// a primitive leak checker.
...
...
googletest/samples/sample1_unittest.cc
View file @
6de39826
...
...
@@ -28,9 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
// This sample shows how to write a simple unit test for a function,
// using Google C++ testing framework.
...
...
googletest/samples/sample2.cc
View file @
6de39826
...
...
@@ -28,8 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
#include "sample2.h"
...
...
googletest/samples/sample2.h
View file @
6de39826
...
...
@@ -28,8 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
#ifndef GTEST_SAMPLES_SAMPLE2_H_
#define GTEST_SAMPLES_SAMPLE2_H_
...
...
googletest/samples/sample2_unittest.cc
View file @
6de39826
...
...
@@ -28,9 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
// This sample shows how to write a more complex unit test for a class
// that has multiple member functions.
...
...
googletest/samples/sample3-inl.h
View file @
6de39826
...
...
@@ -28,8 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
#ifndef GTEST_SAMPLES_SAMPLE3_INL_H_
#define GTEST_SAMPLES_SAMPLE3_INL_H_
...
...
googletest/samples/sample3_unittest.cc
View file @
6de39826
...
...
@@ -28,9 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
// In this example, we use a more advanced feature of Google Test called
// test fixture.
...
...
googletest/samples/sample4.cc
View file @
6de39826
...
...
@@ -28,8 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
#include <stdio.h>
...
...
@@ -40,6 +38,16 @@ int Counter::Increment() {
return
counter_
++
;
}
// Returns the current counter value, and decrements it.
// counter can not be less than 0, return 0 in this case
int
Counter
::
Decrement
()
{
if
(
counter_
==
0
)
{
return
counter_
;
}
else
{
return
counter_
--
;
}
}
// Prints the current counter value to STDOUT.
void
Counter
::
Print
()
const
{
printf
(
"%d"
,
counter_
);
...
...
googletest/samples/sample4.h
View file @
6de39826
...
...
@@ -28,9 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
//
// Author: wan@google.com (Zhanyong Wan)
#ifndef GTEST_SAMPLES_SAMPLE4_H_
#define GTEST_SAMPLES_SAMPLE4_H_
...
...
@@ -46,6 +43,9 @@ class Counter {
// Returns the current counter value, and increments it.
int
Increment
();
// Returns the current counter value, and decrements it.
int
Decrement
();
// Prints the current counter value to STDOUT.
void
Print
()
const
;
};
...
...
googletest/samples/sample4_unittest.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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.
//
// Author: wan@google.com (Zhanyong Wan)
#include "sample4.h"
#include "gtest/gtest.h"
...
...
@@ -38,12 +37,17 @@ namespace {
TEST
(
Counter
,
Increment
)
{
Counter
c
;
// Test that counter 0 returns 0
EXPECT_EQ
(
0
,
c
.
Decrement
());
// EXPECT_EQ() evaluates its arguments exactly once, so they
// can have side effects.
EXPECT_EQ
(
0
,
c
.
Increment
());
EXPECT_EQ
(
1
,
c
.
Increment
());
EXPECT_EQ
(
2
,
c
.
Increment
());
EXPECT_EQ
(
3
,
c
.
Decrement
());
}
}
// namespace
Prev
1
2
3
4
5
6
7
8
9
10
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment