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
a6e7ba27
Unverified
Commit
a6e7ba27
authored
Aug 20, 2018
by
Gennadiy Civil
Committed by
GitHub
Aug 20, 2018
Browse files
Merge branch 'master' into josh/fix_scoped_class2
parents
21e51855
735bd75f
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
135 additions
and
36 deletions
+135
-36
CONTRIBUTING.md
CONTRIBUTING.md
+5
-4
googlemock/CMakeLists.txt
googlemock/CMakeLists.txt
+14
-4
googlemock/include/gmock/gmock-cardinalities.h
googlemock/include/gmock/gmock-cardinalities.h
+5
-0
googlemock/include/gmock/gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+5
-0
googlemock/include/gmock/gmock-spec-builders.h
googlemock/include/gmock/gmock-spec-builders.h
+7
-8
googletest/CMakeLists.txt
googletest/CMakeLists.txt
+19
-4
googletest/cmake/internal_utils.cmake
googletest/cmake/internal_utils.cmake
+5
-0
googletest/docs/advanced.md
googletest/docs/advanced.md
+9
-9
googletest/include/gtest/gtest-message.h
googletest/include/gtest/gtest-message.h
+5
-0
googletest/include/gtest/gtest-printers.h
googletest/include/gtest/gtest-printers.h
+5
-4
googletest/include/gtest/gtest-spi.h
googletest/include/gtest/gtest-spi.h
+5
-0
googletest/include/gtest/gtest-test-part.h
googletest/include/gtest/gtest-test-part.h
+6
-1
googletest/include/gtest/gtest.h
googletest/include/gtest/gtest.h
+5
-0
googletest/include/gtest/internal/gtest-death-test-internal.h
...letest/include/gtest/internal/gtest-death-test-internal.h
+5
-0
googletest/include/gtest/internal/gtest-filepath.h
googletest/include/gtest/internal/gtest-filepath.h
+5
-0
googletest/include/gtest/internal/gtest-internal.h
googletest/include/gtest/internal/gtest-internal.h
+10
-0
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+2
-2
googletest/samples/sample4.cc
googletest/samples/sample4.cc
+10
-0
googletest/samples/sample4.h
googletest/samples/sample4.h
+3
-0
googletest/samples/sample4_unittest.cc
googletest/samples/sample4_unittest.cc
+5
-0
No files found.
CONTRIBUTING.md
View file @
a6e7ba27
...
...
@@ -19,6 +19,11 @@ Follow either of the two links above to access the appropriate CLA and
instructions for how to sign and return it. Once we receive it, we'll be able to
accept your pull requests.
## Are you a Googler?
If you are a Googler, please create an internal change and
have it reviewed and submitted. The maintainers will normally be in position to upstream the changes.
## Contributing A Patch
1.
Submit an issue describing your proposed change to the
...
...
@@ -39,10 +44,6 @@ accept your pull requests.
1.
Ensure that your code has an appropriate set of unit tests which all pass.
1.
Submit a pull request.
If you are a Googler, it is preferable to first create an internal change and
have it reviewed and submitted, and then create an upstreaming pull
request here.
## The Google Test and Google Mock Communities ##
The Google Test community exists primarily through the
...
...
googlemock/CMakeLists.txt
View file @
a6e7ba27
...
...
@@ -5,10 +5,6 @@
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option
(
BUILD_SHARED_LIBS
"Build shared libraries (DLLs)."
OFF
)
option
(
gmock_build_tests
"Build all of Google Mock's own tests."
OFF
)
# A directory to find Google Test sources.
...
...
@@ -55,6 +51,20 @@ endif()
# if they are the same (the default).
add_subdirectory
(
"
${
gtest_dir
}
"
"
${
gmock_BINARY_DIR
}
/gtest"
)
# These commands only run if this is the main project
if
(
CMAKE_PROJECT_NAME STREQUAL
"gmock"
OR CMAKE_PROJECT_NAME STREQUAL
"googletest-distribution"
)
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option
(
BUILD_SHARED_LIBS
"Build shared libraries (DLLs)."
OFF
)
else
()
mark_as_advanced
(
gmock_build_tests
)
endif
()
# Although Google Test's CMakeLists.txt calls this function, the
# changes there don't affect the current scope. Therefore we have to
# call it again here.
...
...
googlemock/include/gmock/gmock-cardinalities.h
View file @
a6e7ba27
...
...
@@ -44,6 +44,9 @@
#include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
namespace
testing
{
// To implement a cardinality Foo, define:
...
...
@@ -145,4 +148,6 @@ inline Cardinality MakeCardinality(const CardinalityInterface* c) {
}
// namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
googlemock/include/gmock/gmock-matchers.h
View file @
a6e7ba27
...
...
@@ -56,6 +56,9 @@
# include <initializer_list> // NOLINT -- must be after gtest.h
#endif
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
namespace
testing
{
// To implement a matcher Foo for type T, define:
...
...
@@ -5266,6 +5269,8 @@ PolymorphicMatcher<internal::variant_matcher::VariantMatcher<T> > VariantWith(
}
// namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
// Include any custom callback matchers added by the local installation.
// We must include this header at the end to make sure it can use the
// declarations from this file.
...
...
googlemock/include/gmock/gmock-spec-builders.h
View file @
a6e7ba27
...
...
@@ -77,6 +77,9 @@
# include <stdexcept> // NOLINT
#endif
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
namespace
testing
{
// An abstract handle of an expectation.
...
...
@@ -1357,11 +1360,7 @@ class ReferenceOrValueWrapper<T&> {
// we need to temporarily disable the warning. We have to do it for
// the entire class to suppress the warning, even though it's about
// the constructor only.
#ifdef _MSC_VER
# pragma warning(push) // Saves the current warning state.
# pragma warning(disable:4355) // Temporarily disables warning 4355.
#endif // _MSV_VER
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4355
)
// C++ treats the void type specially. For example, you cannot define
// a void-typed variable or pass a void value to a function.
...
...
@@ -1797,9 +1796,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
FunctionMockerBase
);
};
// class FunctionMockerBase
#ifdef _MSC_VER
# pragma warning(pop) // Restores the warning state.
#endif // _MSV_VER
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4355
// Implements methods of FunctionMockerBase.
...
...
@@ -1844,6 +1841,8 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
}
// namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
// Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is
// required to avoid compile errors when the name of the method used in call is
// a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro
...
...
googletest/CMakeLists.txt
View file @
a6e7ba27
...
...
@@ -5,10 +5,6 @@
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option
(
BUILD_SHARED_LIBS
"Build shared libraries (DLLs)."
OFF
)
# When other libraries are using a shared version of runtime libraries,
# Google Test also has to use one.
option
(
...
...
@@ -60,6 +56,25 @@ if (COMMAND set_up_hermetic_build)
set_up_hermetic_build
()
endif
()
# These commands only run if this is the main project
if
(
CMAKE_PROJECT_NAME STREQUAL
"gtest"
OR CMAKE_PROJECT_NAME STREQUAL
"googletest-distribution"
)
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option
(
BUILD_SHARED_LIBS
"Build shared libraries (DLLs)."
OFF
)
else
()
mark_as_advanced
(
gtest_force_shared_crt
gtest_build_tests
gtest_build_samples
gtest_disable_pthreads
gtest_hide_internal_symbols
)
endif
()
if
(
gtest_hide_internal_symbols
)
set
(
CMAKE_CXX_VISIBILITY_PRESET hidden
)
set
(
CMAKE_VISIBILITY_INLINES_HIDDEN 1
)
...
...
googletest/cmake/internal_utils.cmake
View file @
a6e7ba27
...
...
@@ -38,6 +38,11 @@ macro(fix_default_compiler_settings_)
# We prefer more strict warning checking for building Google Test.
# Replaces /W3 with /W4 in defaults.
string
(
REPLACE
"/W3"
"/W4"
${
flag_var
}
"
${${
flag_var
}}
"
)
# Prevent D9025 warning for targets that have exception handling
# turned off (/EHs-c- flag). Where required, exceptions are explicitly
# re-enabled using the cxx_exception_flags variable.
string
(
REPLACE
"/EHsc"
""
${
flag_var
}
"
${${
flag_var
}}
"
)
endforeach
()
endif
()
endmacro
()
...
...
googletest/docs/advanced.md
View file @
a6e7ba27
...
...
@@ -572,7 +572,7 @@ namespace foo {
class
Bar
{
// We want googletest to be able to print instances of this.
...
// Create a free inline friend function.
friend
::
std
::
ostream
&
operator
<<
(
::
std
::
ostream
&
os
,
const
Bar
&
bar
)
{
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Bar
&
bar
)
{
return
os
<<
bar
.
DebugString
();
// whatever needed to print bar to os
}
};
...
...
@@ -580,7 +580,7 @@ class Bar { // We want googletest to be able to print instances of this.
// If you can't declare the function in the class it's important that the
// << operator is defined in the SAME namespace that defines Bar. C++'s look-up
// rules rely on that.
::
std
::
ostream
&
operator
<<
(
::
std
::
ostream
&
os
,
const
Bar
&
bar
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Bar
&
bar
)
{
return
os
<<
bar
.
DebugString
();
// whatever needed to print bar to os
}
...
...
@@ -601,7 +601,7 @@ namespace foo {
class
Bar
{
...
friend
void
PrintTo
(
const
Bar
&
bar
,
::
std
::
ostream
*
os
)
{
friend
void
PrintTo
(
const
Bar
&
bar
,
std
::
ostream
*
os
)
{
*
os
<<
bar
.
DebugString
();
// whatever needed to print bar to os
}
};
...
...
@@ -609,7 +609,7 @@ class Bar {
// If you can't declare the function in the class it's important that PrintTo()
// is defined in the SAME namespace that defines Bar. C++'s look-up rules rely
// on that.
void
PrintTo
(
const
Bar
&
bar
,
::
std
::
ostream
*
os
)
{
void
PrintTo
(
const
Bar
&
bar
,
std
::
ostream
*
os
)
{
*
os
<<
bar
.
DebugString
();
// whatever needed to print bar to os
}
...
...
@@ -649,7 +649,7 @@ _death tests_. More generally, any test that checks that a program terminates
Note that if a piece of code throws an exception, we don't consider it "death"
for the purpose of death tests, as the caller of the code could catch the
exception and avoid the crash. If you want to verify exceptions thrown by your
code, see
[
Exception Assertions
](
#
E
xception
A
ssertions
)
.
code, see
[
Exception Assertions
](
#
e
xception
-a
ssertions
)
.
If you want to test
`EXPECT_*()/ASSERT_*()`
failures in your test code, see
Catching Failures
...
...
@@ -1147,7 +1147,7 @@ test has at least one failure of either kind.
In your test code, you can call
`RecordProperty("key", value)`
to log additional
information, where
`value`
can be either a string or an
`int`
. The
*last*
value
recorded for a key will be emitted to the
[
XML output
](
#
XmlR
eport
)
if you
recorded for a key will be emitted to the
[
XML output
](
#
generating-an-xml-r
eport
)
if you
specify one. For example, the test
```
c++
...
...
@@ -1424,7 +1424,7 @@ will have these names:
*
`InstantiationName/FooTest.HasBlahBlah/1`
for
`"miny"`
*
`InstantiationName/FooTest.HasBlahBlah/2`
for
`"moe"`
You can use these names in
[
`--gtest_filter`
](
#
TestFilter
)
.
You can use these names in
[
`--gtest_filter`
](
#
running-a-subset-of-the-tests
)
.
This statement will instantiate all tests from
`FooTest`
again, each with
parameter values
`"cat"`
and
`"dog"`
:
...
...
@@ -1674,7 +1674,7 @@ To test them, we use the following special techniques:
*
Both static functions and definitions/declarations in an unnamed namespace
are only visible within the same translation unit. To test them, you can
`#include`
the entire
`.cc`
file being tested in your
`*_test.cc`
file.
(
#
including
`.cc`
files is not a good way to reuse code - you should not do
(including
`.cc`
files is not a good way to reuse code - you should not do
this in production code!)
However, a better approach is to move the private code into the
...
...
@@ -2120,7 +2120,7 @@ $ foo_test --gtest_repeat=1000 --gtest_filter=FooBar.*
Repeat the tests whose name matches the filter 1000 times.
```
If your test program contains
[
global set-up/tear-down
](
#
G
lobal
SetUp
)
code, it
If your test program contains
[
global set-up/tear-down
](
#
g
lobal
-set-up-and-tear-down
)
code, it
will be repeated in each iteration as well, as the flakiness may be in it. You
can also specify the repeat count by setting the
`GTEST_REPEAT`
environment
variable.
...
...
googletest/include/gtest/gtest-message.h
View file @
a6e7ba27
...
...
@@ -51,6 +51,9 @@
#include "gtest/internal/gtest-port.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
// Ensures that there is at least one operator<< in the global namespace.
// See Message& operator<<(...) below for why.
void
operator
<<
(
const
testing
::
internal
::
Secret
&
,
int
);
...
...
@@ -247,4 +250,6 @@ std::string StreamableToString(const T& streamable) {
}
// namespace internal
}
// namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
googletest/include/gtest/gtest-printers.h
View file @
a6e7ba27
...
...
@@ -978,12 +978,13 @@ struct TuplePolicy {
static
const
size_t
tuple_size
=
::
std
::
tr1
::
tuple_size
<
Tuple
>::
value
;
template
<
size_t
I
>
struct
tuple_element
:
::
std
::
tr1
::
tuple_element
<
I
,
Tuple
>
{};
struct
tuple_element
:
::
std
::
tr1
::
tuple_element
<
static_cast
<
int
>
(
I
),
Tuple
>
{
};
template
<
size_t
I
>
static
typename
AddReference
<
const
typename
::
std
::
tr1
::
tuple_element
<
I
,
Tuple
>::
type
>::
type
get
(
const
Tuple
&
tuple
)
{
static
typename
AddReference
<
const
typename
::
std
::
tr1
::
tuple_element
<
static_cast
<
int
>
(
I
)
,
Tuple
>::
type
>::
type
get
(
const
Tuple
&
tuple
)
{
return
::
std
::
tr1
::
get
<
I
>
(
tuple
);
}
};
...
...
googletest/include/gtest/gtest-spi.h
View file @
a6e7ba27
...
...
@@ -38,6 +38,9 @@
#include "gtest/gtest.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
namespace
testing
{
// This helper class can be used to mock out Google Test failure reporting
...
...
@@ -112,6 +115,8 @@ class GTEST_API_ SingleFailureChecker {
}
// namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
// A set of macros for testing Google Test assertions or code that's expected
// to generate Google Test fatal failures. It verifies that the given
// statement will cause exactly one fatal Google Test failure with 'substr'
...
...
googletest/include/gtest/gtest-test-part.h
View file @
a6e7ba27
...
...
@@ -37,6 +37,9 @@
#include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-string.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
namespace
testing
{
// A copyable object representing the result of a test part (i.e. an
...
...
@@ -142,7 +145,7 @@ class GTEST_API_ TestPartResultArray {
};
// This interface knows how to report a test part result.
class
TestPartResultReporterInterface
{
class
GTEST_API_
TestPartResultReporterInterface
{
public:
virtual
~
TestPartResultReporterInterface
()
{}
...
...
@@ -175,4 +178,6 @@ class GTEST_API_ HasNewFatalFailureHelper
}
// namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
googletest/include/gtest/gtest.h
View file @
a6e7ba27
...
...
@@ -66,6 +66,9 @@
#include "gtest/gtest-test-part.h"
#include "gtest/gtest-typed-test.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
// Depending on the platform, different string classes are available.
// On Linux, in addition to ::std::string, Google also makes use of
// class ::string, which has the same interface as ::std::string, but
...
...
@@ -2330,4 +2333,6 @@ inline int RUN_ALL_TESTS() {
return
::
testing
::
UnitTest
::
GetInstance
()
->
Run
();
}
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
googletest/include/gtest/internal/gtest-death-test-internal.h
View file @
a6e7ba27
...
...
@@ -52,6 +52,9 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
#if GTEST_HAS_DEATH_TEST
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
// DeathTest is a class that hides much of the complexity of the
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
// returns a concrete class that depends on the prevailing death test
...
...
@@ -135,6 +138,8 @@ class GTEST_API_ DeathTest {
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
DeathTest
);
};
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
// Factory interface for death tests. May be mocked out for testing.
class
DeathTestFactory
{
public:
...
...
googletest/include/gtest/internal/gtest-filepath.h
View file @
a6e7ba27
...
...
@@ -42,6 +42,9 @@
#include "gtest/internal/gtest-string.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
namespace
testing
{
namespace
internal
{
...
...
@@ -203,4 +206,6 @@ class GTEST_API_ FilePath {
}
// namespace internal
}
// namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
googletest/include/gtest/internal/gtest-internal.h
View file @
a6e7ba27
...
...
@@ -141,6 +141,9 @@ GTEST_API_ std::string AppendUserMessage(
#if GTEST_HAS_EXCEPTIONS
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4275
\
/* an exported class was derived from a class that was not exported */
)
// This exception is thrown by (and only by) a failed Google Test
// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
// are enabled). We derive it from std::runtime_error, which is for
...
...
@@ -152,6 +155,8 @@ class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
explicit
GoogleTestFailureException
(
const
TestPartResult
&
failure
);
};
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4275
#endif // GTEST_HAS_EXCEPTIONS
namespace
edit_distance
{
...
...
@@ -528,6 +533,9 @@ GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
\
/* class A needs to have dll-interface to be used by clients of class B */
)
// State of the definition of a type-parameterized test case.
class
GTEST_API_
TypedTestCasePState
{
public:
...
...
@@ -573,6 +581,8 @@ class GTEST_API_ TypedTestCasePState {
RegisteredTestsMap
registered_tests_
;
};
GTEST_DISABLE_MSC_WARNINGS_POP_
()
// 4251
// Skips to the first non-space char after the first comma in 'str';
// returns NULL if no comma is found in 'str'.
inline
const
char
*
SkipComma
(
const
char
*
str
)
{
...
...
googletest/include/gtest/internal/gtest-port.h
View file @
a6e7ba27
...
...
@@ -2107,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.
...
...
googletest/samples/sample4.cc
View file @
a6e7ba27
...
...
@@ -38,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 @
a6e7ba27
...
...
@@ -43,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 @
a6e7ba27
...
...
@@ -37,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
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