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
e857f9cd
Commit
e857f9cd
authored
Oct 30, 2018
by
misterg
Committed by
Gennadiy Civil
Oct 30, 2018
Browse files
Googletest export
Remove scoped_ptr replace with std::unique_ptr PiperOrigin-RevId: 219291284
parent
e0d3c370
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
30 additions
and
80 deletions
+30
-80
googlemock/include/gmock/gmock-spec-builders.h
googlemock/include/gmock/gmock-spec-builders.h
+1
-1
googlemock/test/gmock-matchers_test.cc
googlemock/test/gmock-matchers_test.cc
+0
-2
googletest/include/gtest/gtest-message.h
googletest/include/gtest/gtest-message.h
+2
-1
googletest/include/gtest/gtest.h
googletest/include/gtest/gtest.h
+6
-5
googletest/include/gtest/internal/gtest-death-test-internal.h
...letest/include/gtest/internal/gtest-death-test-internal.h
+2
-1
googletest/include/gtest/internal/gtest-param-util.h
googletest/include/gtest/internal/gtest-param-util.h
+4
-4
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+5
-47
googletest/src/gtest-internal-inl.h
googletest/src/gtest-internal-inl.h
+4
-3
googletest/src/gtest-port.cc
googletest/src/gtest-port.cc
+2
-2
googletest/test/googletest-output-test_.cc
googletest/test/googletest-output-test_.cc
+1
-2
googletest/test/googletest-port-test.cc
googletest/test/googletest-port-test.cc
+2
-9
googletest/test/googletest-shuffle-test_.cc
googletest/test/googletest-shuffle-test_.cc
+0
-1
googletest/test/gtest_stress_test.cc
googletest/test/gtest_stress_test.cc
+1
-2
No files found.
googlemock/include/gmock/gmock-spec-builders.h
View file @
e857f9cd
...
@@ -1598,7 +1598,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
...
@@ -1598,7 +1598,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// const_cast is required since in C++98 we still pass ArgumentTuple around
// const_cast is required since in C++98 we still pass ArgumentTuple around
// by const& instead of rvalue reference.
// by const& instead of rvalue reference.
void
*
untyped_args
=
const_cast
<
void
*>
(
static_cast
<
const
void
*>
(
&
args
));
void
*
untyped_args
=
const_cast
<
void
*>
(
static_cast
<
const
void
*>
(
&
args
));
s
coped
_ptr
<
ResultHolder
>
holder
(
s
td
::
unique
_ptr
<
ResultHolder
>
holder
(
DownCast_
<
ResultHolder
*>
(
this
->
UntypedInvokeWith
(
untyped_args
)));
DownCast_
<
ResultHolder
*>
(
this
->
UntypedInvokeWith
(
untyped_args
)));
return
holder
->
Unwrap
();
return
holder
->
Unwrap
();
}
}
...
...
googlemock/test/gmock-matchers_test.cc
View file @
e857f9cd
...
@@ -145,10 +145,8 @@ using testing::internal::FormatMatcherDescription;
...
@@ -145,10 +145,8 @@ using testing::internal::FormatMatcherDescription;
using
testing
::
internal
::
IsReadableTypeName
;
using
testing
::
internal
::
IsReadableTypeName
;
using
testing
::
internal
::
MatchMatrix
;
using
testing
::
internal
::
MatchMatrix
;
using
testing
::
internal
::
RE
;
using
testing
::
internal
::
RE
;
using
testing
::
internal
::
scoped_ptr
;
using
testing
::
internal
::
StreamMatchResultListener
;
using
testing
::
internal
::
StreamMatchResultListener
;
using
testing
::
internal
::
Strings
;
using
testing
::
internal
::
Strings
;
using
testing
::
internal
::
scoped_ptr
;
using
testing
::
internal
::
string
;
using
testing
::
internal
::
string
;
// For testing ExplainMatchResultTo().
// For testing ExplainMatchResultTo().
...
...
googletest/include/gtest/gtest-message.h
View file @
e857f9cd
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
#include <limits>
#include <limits>
#include <memory>
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-port.h"
...
@@ -224,7 +225,7 @@ class GTEST_API_ Message {
...
@@ -224,7 +225,7 @@ class GTEST_API_ Message {
#endif // GTEST_OS_SYMBIAN
#endif // GTEST_OS_SYMBIAN
// We'll hold the text streamed to this object here.
// We'll hold the text streamed to this object here.
const
internal
::
scoped
_ptr
<
::
std
::
stringstream
>
ss_
;
const
std
::
unique
_ptr
<
::
std
::
stringstream
>
ss_
;
// We declare (but don't implement) this to prevent the compiler
// We declare (but don't implement) this to prevent the compiler
// from implementing the assignment operator.
// from implementing the assignment operator.
...
...
googletest/include/gtest/gtest.h
View file @
e857f9cd
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
#define GTEST_INCLUDE_GTEST_GTEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_H_
#include <limits>
#include <limits>
#include <memory>
#include <ostream>
#include <ostream>
#include <vector>
#include <vector>
...
@@ -361,7 +362,7 @@ class GTEST_API_ AssertionResult {
...
@@ -361,7 +362,7 @@ class GTEST_API_ AssertionResult {
// construct is not satisfied with the predicate's outcome.
// construct is not satisfied with the predicate's outcome.
// Referenced via a pointer to avoid taking too much stack frame space
// Referenced via a pointer to avoid taking too much stack frame space
// with test assertions.
// with test assertions.
internal
::
scoped
_ptr
<
::
std
::
string
>
message_
;
std
::
unique
_ptr
<
::
std
::
string
>
message_
;
};
};
// Makes a successful assertion result.
// Makes a successful assertion result.
...
@@ -493,7 +494,7 @@ class GTEST_API_ Test {
...
@@ -493,7 +494,7 @@ class GTEST_API_ Test {
// internal method to avoid clashing with names used in user TESTs.
// internal method to avoid clashing with names used in user TESTs.
void
DeleteSelf_
()
{
delete
this
;
}
void
DeleteSelf_
()
{
delete
this
;
}
const
internal
::
scoped
_ptr
<
GTEST_FLAG_SAVER_
>
gtest_flag_saver_
;
const
std
::
unique
_ptr
<
GTEST_FLAG_SAVER_
>
gtest_flag_saver_
;
// Often a user misspells SetUp() as Setup() and spends a long time
// Often a user misspells SetUp() as Setup() and spends a long time
// wondering why it is never called by Google Test. The declaration of
// wondering why it is never called by Google Test. The declaration of
...
@@ -796,10 +797,10 @@ class GTEST_API_ TestInfo {
...
@@ -796,10 +797,10 @@ class GTEST_API_ TestInfo {
const
std
::
string
name_
;
// Test name
const
std
::
string
name_
;
// Test name
// Name of the parameter type, or NULL if this is not a typed or a
// Name of the parameter type, or NULL if this is not a typed or a
// type-parameterized test.
// type-parameterized test.
const
internal
::
scoped
_ptr
<
const
::
std
::
string
>
type_param_
;
const
std
::
unique
_ptr
<
const
::
std
::
string
>
type_param_
;
// Text representation of the value parameter, or NULL if this is not a
// Text representation of the value parameter, or NULL if this is not a
// value-parameterized test.
// value-parameterized test.
const
internal
::
scoped
_ptr
<
const
::
std
::
string
>
value_param_
;
const
std
::
unique
_ptr
<
const
::
std
::
string
>
value_param_
;
internal
::
CodeLocation
location_
;
internal
::
CodeLocation
location_
;
const
internal
::
TypeId
fixture_class_id_
;
// ID of the test fixture class
const
internal
::
TypeId
fixture_class_id_
;
// ID of the test fixture class
bool
should_run_
;
// True iff this test should run
bool
should_run_
;
// True iff this test should run
...
@@ -983,7 +984,7 @@ class GTEST_API_ TestCase {
...
@@ -983,7 +984,7 @@ class GTEST_API_ TestCase {
std
::
string
name_
;
std
::
string
name_
;
// Name of the parameter type, or NULL if this is not a typed or a
// Name of the parameter type, or NULL if this is not a typed or a
// type-parameterized test.
// type-parameterized test.
const
internal
::
scoped
_ptr
<
const
::
std
::
string
>
type_param_
;
const
std
::
unique
_ptr
<
const
::
std
::
string
>
type_param_
;
// The vector of TestInfos in their original order. It owns the
// The vector of TestInfos in their original order. It owns the
// elements in the vector.
// elements in the vector.
std
::
vector
<
TestInfo
*>
test_info_list_
;
std
::
vector
<
TestInfo
*>
test_info_list_
;
...
...
googletest/include/gtest/internal/gtest-death-test-internal.h
View file @
e857f9cd
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-internal.h"
#include <stdio.h>
#include <stdio.h>
#include <memory>
namespace
testing
{
namespace
testing
{
namespace
internal
{
namespace
internal
{
...
@@ -196,7 +197,7 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
...
@@ -196,7 +197,7 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
} \
} \
if (gtest_dt != nullptr) { \
if (gtest_dt != nullptr) { \
::testing::internal::scoped
_ptr< ::testing::internal::DeathTest> \
std::unique
_ptr< ::testing::internal::DeathTest> \
gtest_dt_ptr(gtest_dt); \
gtest_dt_ptr(gtest_dt); \
switch (gtest_dt->AssumeRole()) { \
switch (gtest_dt->AssumeRole()) { \
case ::testing::internal::DeathTest::OVERSEE_TEST: \
case ::testing::internal::DeathTest::OVERSEE_TEST: \
...
...
googletest/include/gtest/internal/gtest-param-util.h
View file @
e857f9cd
...
@@ -154,7 +154,7 @@ class ParamIterator {
...
@@ -154,7 +154,7 @@ class ParamIterator {
private:
private:
friend
class
ParamGenerator
<
T
>
;
friend
class
ParamGenerator
<
T
>
;
explicit
ParamIterator
(
ParamIteratorInterface
<
T
>*
impl
)
:
impl_
(
impl
)
{}
explicit
ParamIterator
(
ParamIteratorInterface
<
T
>*
impl
)
:
impl_
(
impl
)
{}
s
coped
_ptr
<
ParamIteratorInterface
<
T
>
>
impl_
;
s
td
::
unique
_ptr
<
ParamIteratorInterface
<
T
>
>
impl_
;
};
};
// ParamGeneratorInterface<T> is the binary interface to access generators
// ParamGeneratorInterface<T> is the binary interface to access generators
...
@@ -354,9 +354,9 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
...
@@ -354,9 +354,9 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
// A cached value of *iterator_. We keep it here to allow access by
// A cached value of *iterator_. We keep it here to allow access by
// pointer in the wrapping iterator's operator->().
// pointer in the wrapping iterator's operator->().
// value_ needs to be mutable to be accessed in Current().
// value_ needs to be mutable to be accessed in Current().
// Use of s
coped
_ptr helps manage cached value's lifetime,
// Use of s
td::unique
_ptr helps manage cached value's lifetime,
// which is bound by the lifespan of the iterator itself.
// which is bound by the lifespan of the iterator itself.
mutable
s
coped
_ptr
<
const
T
>
value_
;
mutable
s
td
::
unique
_ptr
<
const
T
>
value_
;
};
// class ValuesInIteratorRangeGenerator::Iterator
};
// class ValuesInIteratorRangeGenerator::Iterator
// No implementation - assignment is unsupported.
// No implementation - assignment is unsupported.
...
@@ -602,7 +602,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
...
@@ -602,7 +602,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
const
std
::
string
test_case_base_name
;
const
std
::
string
test_case_base_name
;
const
std
::
string
test_base_name
;
const
std
::
string
test_base_name
;
const
s
coped
_ptr
<
TestMetaFactoryBase
<
ParamType
>
>
test_meta_factory
;
const
s
td
::
unique
_ptr
<
TestMetaFactoryBase
<
ParamType
>
>
test_meta_factory
;
};
};
using
TestInfoContainer
=
::
std
::
vector
<
std
::
shared_ptr
<
TestInfo
>
>
;
using
TestInfoContainer
=
::
std
::
vector
<
std
::
shared_ptr
<
TestInfo
>
>
;
// Records data received from INSTANTIATE_TEST_CASE_P macros:
// Records data received from INSTANTIATE_TEST_CASE_P macros:
...
...
googletest/include/gtest/internal/gtest-port.h
View file @
e857f9cd
...
@@ -212,8 +212,6 @@
...
@@ -212,8 +212,6 @@
// IteratorTraits - partial implementation of std::iterator_traits, which
// IteratorTraits - partial implementation of std::iterator_traits, which
// is not available in libCstd when compiled with Sun C++.
// is not available in libCstd when compiled with Sun C++.
//
//
// Smart pointers:
// scoped_ptr - as in TR2.
//
//
// Regular expressions:
// Regular expressions:
// RE - a simple regular expression class using the POSIX
// RE - a simple regular expression class using the POSIX
...
@@ -253,9 +251,11 @@
...
@@ -253,9 +251,11 @@
#include <ctype.h> // for isspace, etc
#include <ctype.h> // for isspace, etc
#include <stddef.h> // for ptrdiff_t
#include <stddef.h> // for ptrdiff_t
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <memory>
#ifndef _WIN32_WCE
#ifndef _WIN32_WCE
# include <sys/types.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <sys/stat.h>
...
@@ -1010,48 +1010,6 @@ typedef ::std::wstring wstring;
...
@@ -1010,48 +1010,6 @@ typedef ::std::wstring wstring;
// returns 'condition'.
// returns 'condition'.
GTEST_API_
bool
IsTrue
(
bool
condition
);
GTEST_API_
bool
IsTrue
(
bool
condition
);
// Defines scoped_ptr.
// This implementation of scoped_ptr is PARTIAL - it only contains
// enough stuff to satisfy Google Test's need.
template
<
typename
T
>
class
scoped_ptr
{
public:
typedef
T
element_type
;
explicit
scoped_ptr
(
T
*
p
=
nullptr
)
:
ptr_
(
p
)
{}
~
scoped_ptr
()
{
reset
();
}
T
&
operator
*
()
const
{
return
*
ptr_
;
}
T
*
operator
->
()
const
{
return
ptr_
;
}
T
*
get
()
const
{
return
ptr_
;
}
T
*
release
()
{
T
*
const
ptr
=
ptr_
;
ptr_
=
nullptr
;
return
ptr
;
}
void
reset
(
T
*
p
=
nullptr
)
{
if
(
p
!=
ptr_
)
{
if
(
IsTrue
(
sizeof
(
T
)
>
0
))
{
// Makes sure T is a complete type.
delete
ptr_
;
}
ptr_
=
p
;
}
}
friend
void
swap
(
scoped_ptr
&
a
,
scoped_ptr
&
b
)
{
using
std
::
swap
;
swap
(
a
.
ptr_
,
b
.
ptr_
);
}
private:
T
*
ptr_
;
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
scoped_ptr
);
};
// Defines RE.
// Defines RE.
#if GTEST_USES_PCRE
#if GTEST_USES_PCRE
...
@@ -1845,7 +1803,7 @@ class ThreadLocal : public ThreadLocalBase {
...
@@ -1845,7 +1803,7 @@ class ThreadLocal : public ThreadLocalBase {
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
InstanceValueHolderFactory
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
InstanceValueHolderFactory
);
};
};
s
coped
_ptr
<
ValueHolderFactory
>
default_factory_
;
s
td
::
unique
_ptr
<
ValueHolderFactory
>
default_factory_
;
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
ThreadLocal
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
ThreadLocal
);
};
};
...
@@ -2056,7 +2014,7 @@ class GTEST_API_ ThreadLocal {
...
@@ -2056,7 +2014,7 @@ class GTEST_API_ ThreadLocal {
// A key pthreads uses for looking up per-thread values.
// A key pthreads uses for looking up per-thread values.
const
pthread_key_t
key_
;
const
pthread_key_t
key_
;
s
coped
_ptr
<
ValueHolderFactory
>
default_factory_
;
s
td
::
unique
_ptr
<
ValueHolderFactory
>
default_factory_
;
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
ThreadLocal
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
ThreadLocal
);
};
};
...
...
googletest/src/gtest-internal-inl.h
View file @
e857f9cd
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include <string.h> // For memmove.
#include <string.h> // For memmove.
#include <algorithm>
#include <algorithm>
#include <memory>
#include <string>
#include <string>
#include <vector>
#include <vector>
...
@@ -913,8 +914,8 @@ class GTEST_API_ UnitTestImpl {
...
@@ -913,8 +914,8 @@ class GTEST_API_ UnitTestImpl {
#if GTEST_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
// The decomposed components of the gtest_internal_run_death_test flag,
// The decomposed components of the gtest_internal_run_death_test flag,
// parsed when RUN_ALL_TESTS is called.
// parsed when RUN_ALL_TESTS is called.
internal
::
scoped
_ptr
<
InternalRunDeathTestFlag
>
internal_run_death_test_flag_
;
std
::
unique
_ptr
<
InternalRunDeathTestFlag
>
internal_run_death_test_flag_
;
internal
::
scoped
_ptr
<
internal
::
DeathTestFactory
>
death_test_factory_
;
std
::
unique
_ptr
<
internal
::
DeathTestFactory
>
death_test_factory_
;
#endif // GTEST_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
// A per-thread stack of traces created by the SCOPED_TRACE() macro.
// A per-thread stack of traces created by the SCOPED_TRACE() macro.
...
@@ -1174,7 +1175,7 @@ class StreamingListener : public EmptyTestEventListener {
...
@@ -1174,7 +1175,7 @@ class StreamingListener : public EmptyTestEventListener {
std
::
string
FormatBool
(
bool
value
)
{
return
value
?
"1"
:
"0"
;
}
std
::
string
FormatBool
(
bool
value
)
{
return
value
?
"1"
:
"0"
;
}
const
s
coped
_ptr
<
AbstractSocketWriter
>
socket_writer_
;
const
s
td
::
unique
_ptr
<
AbstractSocketWriter
>
socket_writer_
;
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
StreamingListener
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
StreamingListener
);
};
// class StreamingListener
};
// class StreamingListener
...
...
googletest/src/gtest-port.cc
View file @
e857f9cd
...
@@ -410,14 +410,14 @@ class ThreadWithParamSupport : public ThreadWithParamBase {
...
@@ -410,14 +410,14 @@ class ThreadWithParamSupport : public ThreadWithParamBase {
:
runnable_
(
runnable
),
:
runnable_
(
runnable
),
thread_can_start_
(
thread_can_start
)
{
thread_can_start_
(
thread_can_start
)
{
}
}
s
coped
_ptr
<
Runnable
>
runnable_
;
s
td
::
unique
_ptr
<
Runnable
>
runnable_
;
// Does not own.
// Does not own.
Notification
*
thread_can_start_
;
Notification
*
thread_can_start_
;
};
};
static
DWORD
WINAPI
ThreadMain
(
void
*
ptr
)
{
static
DWORD
WINAPI
ThreadMain
(
void
*
ptr
)
{
// Transfers ownership.
// Transfers ownership.
s
coped
_ptr
<
ThreadMainParam
>
param
(
static_cast
<
ThreadMainParam
*>
(
ptr
));
s
td
::
unique
_ptr
<
ThreadMainParam
>
param
(
static_cast
<
ThreadMainParam
*>
(
ptr
));
if
(
param
->
thread_can_start_
!=
nullptr
)
if
(
param
->
thread_can_start_
!=
nullptr
)
param
->
thread_can_start_
->
WaitForNotification
();
param
->
thread_can_start_
->
WaitForNotification
();
param
->
runnable_
->
Run
();
param
->
runnable_
->
Run
();
...
...
googletest/test/googletest-output-test_.cc
View file @
e857f9cd
...
@@ -524,8 +524,7 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
...
@@ -524,8 +524,7 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
private:
private:
SpawnThreadNotifications
notifications_
;
SpawnThreadNotifications
notifications_
;
testing
::
internal
::
scoped_ptr
<
ThreadWithParam
<
SpawnThreadNotifications
*>
>
std
::
unique_ptr
<
ThreadWithParam
<
SpawnThreadNotifications
*>
>
thread_
;
thread_
;
};
};
#endif // GTEST_IS_THREADSAFE
#endif // GTEST_IS_THREADSAFE
...
...
googletest/test/googletest-port-test.cc
View file @
e857f9cd
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#endif // GTEST_OS_MAC
#endif // GTEST_OS_MAC
#include <list>
#include <list>
#include <memory>
#include <utility> // For std::pair and std::make_pair.
#include <utility> // For std::pair and std::make_pair.
#include <vector>
#include <vector>
...
@@ -218,14 +219,6 @@ TEST(IteratorTraitsTest, WorksForPointerToConst) {
...
@@ -218,14 +219,6 @@ TEST(IteratorTraitsTest, WorksForPointerToConst) {
IteratorTraits
<
const
void
*
const
*>::
value_type
>
();
IteratorTraits
<
const
void
*
const
*>::
value_type
>
();
}
}
// Tests that the element_type typedef is available in scoped_ptr and refers
// to the parameter type.
TEST
(
ScopedPtrTest
,
DefinesElementType
)
{
StaticAssertTypeEq
<
int
,
::
testing
::
internal
::
scoped_ptr
<
int
>::
element_type
>
();
}
// FIXME: Implement THE REST of scoped_ptr tests.
TEST
(
GtestCheckSyntaxTest
,
BehavesLikeASingleStatement
)
{
TEST
(
GtestCheckSyntaxTest
,
BehavesLikeASingleStatement
)
{
if
(
AlwaysFalse
())
if
(
AlwaysFalse
())
GTEST_CHECK_
(
false
)
<<
"This should never be executed; "
GTEST_CHECK_
(
false
)
<<
"This should never be executed; "
...
@@ -1095,7 +1088,7 @@ TEST(MutexTest, OnlyOneThreadCanLockAtATime) {
...
@@ -1095,7 +1088,7 @@ TEST(MutexTest, OnlyOneThreadCanLockAtATime) {
typedef
ThreadWithParam
<
pair
<
AtomicCounterWithMutex
*
,
int
>
>
ThreadType
;
typedef
ThreadWithParam
<
pair
<
AtomicCounterWithMutex
*
,
int
>
>
ThreadType
;
const
int
kCycleCount
=
20
;
const
int
kCycleCount
=
20
;
const
int
kThreadCount
=
7
;
const
int
kThreadCount
=
7
;
s
coped
_ptr
<
ThreadType
>
counting_threads
[
kThreadCount
];
s
td
::
unique
_ptr
<
ThreadType
>
counting_threads
[
kThreadCount
];
Notification
threads_can_start
;
Notification
threads_can_start
;
// Creates and runs kThreadCount threads that increment locked_counter
// Creates and runs kThreadCount threads that increment locked_counter
// kCycleCount times each.
// kCycleCount times each.
...
...
googletest/test/googletest-shuffle-test_.cc
View file @
e857f9cd
...
@@ -41,7 +41,6 @@ using ::testing::Test;
...
@@ -41,7 +41,6 @@ using ::testing::Test;
using
::
testing
::
TestEventListeners
;
using
::
testing
::
TestEventListeners
;
using
::
testing
::
TestInfo
;
using
::
testing
::
TestInfo
;
using
::
testing
::
UnitTest
;
using
::
testing
::
UnitTest
;
using
::
testing
::
internal
::
scoped_ptr
;
// The test methods are empty, as the sole purpose of this program is
// The test methods are empty, as the sole purpose of this program is
// to print the test names before/after shuffling.
// to print the test names before/after shuffling.
...
...
googletest/test/gtest_stress_test.cc
View file @
e857f9cd
...
@@ -45,7 +45,6 @@ namespace {
...
@@ -45,7 +45,6 @@ namespace {
using
internal
::
Notification
;
using
internal
::
Notification
;
using
internal
::
TestPropertyKeyIs
;
using
internal
::
TestPropertyKeyIs
;
using
internal
::
ThreadWithParam
;
using
internal
::
ThreadWithParam
;
using
internal
::
scoped_ptr
;
// In order to run tests in this file, for platforms where Google Test is
// In order to run tests in this file, for platforms where Google Test is
// thread safe, implement ThreadWithParam. See the description of its API
// thread safe, implement ThreadWithParam. See the description of its API
...
@@ -119,7 +118,7 @@ void CheckTestFailureCount(int expected_failures) {
...
@@ -119,7 +118,7 @@ void CheckTestFailureCount(int expected_failures) {
// concurrently.
// concurrently.
TEST
(
StressTest
,
CanUseScopedTraceAndAssertionsInManyThreads
)
{
TEST
(
StressTest
,
CanUseScopedTraceAndAssertionsInManyThreads
)
{
{
{
s
coped
_ptr
<
ThreadWithParam
<
int
>
>
threads
[
kThreadCount
];
s
td
::
unique
_ptr
<
ThreadWithParam
<
int
>
>
threads
[
kThreadCount
];
Notification
threads_can_start
;
Notification
threads_can_start
;
for
(
int
i
=
0
;
i
!=
kThreadCount
;
i
++
)
for
(
int
i
=
0
;
i
!=
kThreadCount
;
i
++
)
threads
[
i
].
reset
(
new
ThreadWithParam
<
int
>
(
&
ManyAsserts
,
threads
[
i
].
reset
(
new
ThreadWithParam
<
int
>
(
&
ManyAsserts
,
...
...
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