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
3149e0e8
Unverified
Commit
3149e0e8
authored
Oct 05, 2018
by
Gennadiy Civil
Committed by
GitHub
Oct 05, 2018
Browse files
Merge branch 'master' into python3-tests
parents
4b82df5b
40f82ce5
Changes
60
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
381 additions
and
722 deletions
+381
-722
googletest/src/gtest-typed-test.cc
googletest/src/gtest-typed-test.cc
+1
-1
googletest/src/gtest.cc
googletest/src/gtest.cc
+103
-121
googletest/test/googletest-catch-exceptions-test_.cc
googletest/test/googletest-catch-exceptions-test_.cc
+1
-20
googletest/test/googletest-death-test-test.cc
googletest/test/googletest-death-test-test.cc
+10
-11
googletest/test/googletest-linked-ptr-test.cc
googletest/test/googletest-linked-ptr-test.cc
+10
-10
googletest/test/googletest-listener-test.cc
googletest/test/googletest-listener-test.cc
+1
-1
googletest/test/googletest-message-test.cc
googletest/test/googletest-message-test.cc
+2
-2
googletest/test/googletest-output-test_.cc
googletest/test/googletest-output-test_.cc
+5
-6
googletest/test/googletest-param-test-test.cc
googletest/test/googletest-param-test-test.cc
+0
-9
googletest/test/googletest-port-test.cc
googletest/test/googletest-port-test.cc
+13
-13
googletest/test/googletest-printers-test.cc
googletest/test/googletest-printers-test.cc
+15
-19
googletest/test/googletest-throw-on-failure-test_.cc
googletest/test/googletest-throw-on-failure-test_.cc
+1
-1
googletest/test/googletest-tuple-test.cc
googletest/test/googletest-tuple-test.cc
+1
-1
googletest/test/gtest-typed-test_test.cc
googletest/test/gtest-typed-test_test.cc
+4
-4
googletest/test/gtest-unittest-api_test.cc
googletest/test/gtest-unittest-api_test.cc
+6
-6
googletest/test/gtest_assert_by_exception_test.cc
googletest/test/gtest_assert_by_exception_test.cc
+1
-2
googletest/test/gtest_premature_exit_test.cc
googletest/test/gtest_premature_exit_test.cc
+2
-2
googletest/test/gtest_stress_test.cc
googletest/test/gtest_stress_test.cc
+1
-1
googletest/test/gtest_throw_on_failure_ex_test.cc
googletest/test/gtest_throw_on_failure_ex_test.cc
+1
-2
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+203
-490
No files found.
googletest/src/gtest-typed-test.cc
View file @
3149e0e8
...
@@ -48,7 +48,7 @@ static const char* SkipSpaces(const char* str) {
...
@@ -48,7 +48,7 @@ static const char* SkipSpaces(const char* str) {
static
std
::
vector
<
std
::
string
>
SplitIntoTestNames
(
const
char
*
src
)
{
static
std
::
vector
<
std
::
string
>
SplitIntoTestNames
(
const
char
*
src
)
{
std
::
vector
<
std
::
string
>
name_vec
;
std
::
vector
<
std
::
string
>
name_vec
;
src
=
SkipSpaces
(
src
);
src
=
SkipSpaces
(
src
);
for
(;
src
!=
NULL
;
src
=
SkipComma
(
src
))
{
for
(;
src
!=
nullptr
;
src
=
SkipComma
(
src
))
{
name_vec
.
push_back
(
StripTrailingSpaces
(
GetPrefixUntilComma
(
src
)));
name_vec
.
push_back
(
StripTrailingSpaces
(
GetPrefixUntilComma
(
src
)));
}
}
return
name_vec
;
return
name_vec
;
...
...
googletest/src/gtest.cc
View file @
3149e0e8
This diff is collapsed.
Click to expand it.
googletest/test/googletest-catch-exceptions-test_.cc
View file @
3149e0e8
...
@@ -137,25 +137,6 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
...
@@ -137,25 +137,6 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
<<
"called unexpectedly."
;
<<
"called unexpectedly."
;
}
}
// Exceptions in destructors are not supported in C++11.
#if !GTEST_LANG_CXX11
class
CxxExceptionInDestructorTest
:
public
Test
{
public:
static
void
TearDownTestCase
()
{
printf
(
"%s"
,
"CxxExceptionInDestructorTest::TearDownTestCase() "
"called as expected.
\n
"
);
}
protected:
~
CxxExceptionInDestructorTest
()
{
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_
(
throw
std
::
runtime_error
(
"Standard C++ exception"
));
}
};
TEST_F
(
CxxExceptionInDestructorTest
,
ThrowsExceptionInDestructor
)
{}
#endif // C++11 mode
class
CxxExceptionInSetUpTestCaseTest
:
public
Test
{
class
CxxExceptionInSetUpTestCaseTest
:
public
Test
{
public:
public:
...
@@ -296,7 +277,7 @@ TEST(CxxExceptionTest, ThrowsNonStdCxxException) {
...
@@ -296,7 +277,7 @@ TEST(CxxExceptionTest, ThrowsNonStdCxxException) {
// ones.
// ones.
void
TerminateHandler
()
{
void
TerminateHandler
()
{
fprintf
(
stderr
,
"%s
\n
"
,
"Unhandled C++ exception terminating the program."
);
fprintf
(
stderr
,
"%s
\n
"
,
"Unhandled C++ exception terminating the program."
);
fflush
(
NULL
);
fflush
(
nullptr
);
exit
(
3
);
exit
(
3
);
}
}
...
...
googletest/test/googletest-death-test-test.cc
View file @
3149e0e8
...
@@ -370,13 +370,13 @@ void SetSigprofActionAndTimer() {
...
@@ -370,13 +370,13 @@ void SetSigprofActionAndTimer() {
timer
.
it_interval
.
tv_sec
=
0
;
timer
.
it_interval
.
tv_sec
=
0
;
timer
.
it_interval
.
tv_usec
=
1
;
timer
.
it_interval
.
tv_usec
=
1
;
timer
.
it_value
=
timer
.
it_interval
;
timer
.
it_value
=
timer
.
it_interval
;
ASSERT_EQ
(
0
,
setitimer
(
ITIMER_PROF
,
&
timer
,
NULL
));
ASSERT_EQ
(
0
,
setitimer
(
ITIMER_PROF
,
&
timer
,
nullptr
));
struct
sigaction
signal_action
;
struct
sigaction
signal_action
;
memset
(
&
signal_action
,
0
,
sizeof
(
signal_action
));
memset
(
&
signal_action
,
0
,
sizeof
(
signal_action
));
sigemptyset
(
&
signal_action
.
sa_mask
);
sigemptyset
(
&
signal_action
.
sa_mask
);
signal_action
.
sa_sigaction
=
SigprofAction
;
signal_action
.
sa_sigaction
=
SigprofAction
;
signal_action
.
sa_flags
=
SA_RESTART
|
SA_SIGINFO
;
signal_action
.
sa_flags
=
SA_RESTART
|
SA_SIGINFO
;
ASSERT_EQ
(
0
,
sigaction
(
SIGPROF
,
&
signal_action
,
NULL
));
ASSERT_EQ
(
0
,
sigaction
(
SIGPROF
,
&
signal_action
,
nullptr
));
}
}
// Disables ITIMER_PROF timer and ignores SIGPROF signal.
// Disables ITIMER_PROF timer and ignores SIGPROF signal.
...
@@ -385,7 +385,7 @@ void DisableSigprofActionAndTimer(struct sigaction* old_signal_action) {
...
@@ -385,7 +385,7 @@ void DisableSigprofActionAndTimer(struct sigaction* old_signal_action) {
timer
.
it_interval
.
tv_sec
=
0
;
timer
.
it_interval
.
tv_sec
=
0
;
timer
.
it_interval
.
tv_usec
=
0
;
timer
.
it_interval
.
tv_usec
=
0
;
timer
.
it_value
=
timer
.
it_interval
;
timer
.
it_value
=
timer
.
it_interval
;
ASSERT_EQ
(
0
,
setitimer
(
ITIMER_PROF
,
&
timer
,
NULL
));
ASSERT_EQ
(
0
,
setitimer
(
ITIMER_PROF
,
&
timer
,
nullptr
));
struct
sigaction
signal_action
;
struct
sigaction
signal_action
;
memset
(
&
signal_action
,
0
,
sizeof
(
signal_action
));
memset
(
&
signal_action
,
0
,
sizeof
(
signal_action
));
sigemptyset
(
&
signal_action
.
sa_mask
);
sigemptyset
(
&
signal_action
.
sa_mask
);
...
@@ -466,7 +466,7 @@ TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
...
@@ -466,7 +466,7 @@ TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
if
(
!
testing
::
GTEST_FLAG
(
death_test_use_fork
))
{
if
(
!
testing
::
GTEST_FLAG
(
death_test_use_fork
))
{
testing
::
GTEST_FLAG
(
death_test_style
)
=
"threadsafe"
;
testing
::
GTEST_FLAG
(
death_test_style
)
=
"threadsafe"
;
pthread_flag
=
false
;
pthread_flag
=
false
;
ASSERT_EQ
(
0
,
pthread_atfork
(
&
SetPthreadFlag
,
NULL
,
NULL
));
ASSERT_EQ
(
0
,
pthread_atfork
(
&
SetPthreadFlag
,
nullptr
,
nullptr
));
ASSERT_DEATH
(
_exit
(
1
),
""
);
ASSERT_DEATH
(
_exit
(
1
),
""
);
ASSERT_FALSE
(
pthread_flag
);
ASSERT_FALSE
(
pthread_flag
);
}
}
...
@@ -1001,7 +1001,7 @@ bool MockDeathTestFactory::Create(const char* /*statement*/,
...
@@ -1001,7 +1001,7 @@ bool MockDeathTestFactory::Create(const char* /*statement*/,
if
(
create_
)
{
if
(
create_
)
{
*
test
=
new
MockDeathTest
(
this
,
role_
,
status_
,
passed_
);
*
test
=
new
MockDeathTest
(
this
,
role_
,
status_
,
passed_
);
}
else
{
}
else
{
*
test
=
NULL
;
*
test
=
nullptr
;
}
}
return
true
;
return
true
;
}
}
...
@@ -1021,9 +1021,9 @@ class MacroLogicDeathTest : public testing::Test {
...
@@ -1021,9 +1021,9 @@ class MacroLogicDeathTest : public testing::Test {
static
void
TearDownTestCase
()
{
static
void
TearDownTestCase
()
{
delete
replacer_
;
delete
replacer_
;
replacer_
=
NULL
;
replacer_
=
nullptr
;
delete
factory_
;
delete
factory_
;
factory_
=
NULL
;
factory_
=
nullptr
;
}
}
// Runs a death test that breaks the rules by returning. Such a death
// Runs a death test that breaks the rules by returning. Such a death
...
@@ -1037,10 +1037,9 @@ class MacroLogicDeathTest : public testing::Test {
...
@@ -1037,10 +1037,9 @@ class MacroLogicDeathTest : public testing::Test {
}
}
};
};
testing
::
internal
::
ReplaceDeathTestFactory
*
MacroLogicDeathTest
::
replacer_
testing
::
internal
::
ReplaceDeathTestFactory
*
MacroLogicDeathTest
::
replacer_
=
=
NULL
;
nullptr
;
MockDeathTestFactory
*
MacroLogicDeathTest
::
factory_
=
NULL
;
MockDeathTestFactory
*
MacroLogicDeathTest
::
factory_
=
nullptr
;
// Test that nothing happens when the factory doesn't return a DeathTest:
// Test that nothing happens when the factory doesn't return a DeathTest:
TEST_F
(
MacroLogicDeathTest
,
NothingHappens
)
{
TEST_F
(
MacroLogicDeathTest
,
NothingHappens
)
{
...
...
googletest/test/googletest-linked-ptr-test.cc
View file @
3149e0e8
...
@@ -38,7 +38,7 @@ using testing::Message;
...
@@ -38,7 +38,7 @@ using testing::Message;
using
testing
::
internal
::
linked_ptr
;
using
testing
::
internal
::
linked_ptr
;
int
num
;
int
num
;
Message
*
history
=
NULL
;
Message
*
history
=
nullptr
;
// Class which tracks allocation/deallocation
// Class which tracks allocation/deallocation
class
A
{
class
A
{
...
@@ -67,7 +67,7 @@ class LinkedPtrTest : public testing::Test {
...
@@ -67,7 +67,7 @@ class LinkedPtrTest : public testing::Test {
virtual
~
LinkedPtrTest
()
{
virtual
~
LinkedPtrTest
()
{
delete
history
;
delete
history
;
history
=
NULL
;
history
=
nullptr
;
}
}
};
};
...
@@ -77,18 +77,18 @@ TEST_F(LinkedPtrTest, GeneralTest) {
...
@@ -77,18 +77,18 @@ TEST_F(LinkedPtrTest, GeneralTest) {
// Use explicit function call notation here to suppress self-assign warning.
// Use explicit function call notation here to suppress self-assign warning.
a0
.
operator
=
(
a0
);
a0
.
operator
=
(
a0
);
a1
=
a2
;
a1
=
a2
;
ASSERT_EQ
(
a0
.
get
(),
static_cast
<
A
*>
(
NULL
));
ASSERT_EQ
(
a0
.
get
(),
static_cast
<
A
*>
(
nullptr
));
ASSERT_EQ
(
a1
.
get
(),
static_cast
<
A
*>
(
NULL
));
ASSERT_EQ
(
a1
.
get
(),
static_cast
<
A
*>
(
nullptr
));
ASSERT_EQ
(
a2
.
get
(),
static_cast
<
A
*>
(
NULL
));
ASSERT_EQ
(
a2
.
get
(),
static_cast
<
A
*>
(
nullptr
));
ASSERT_TRUE
(
a0
==
NULL
);
ASSERT_TRUE
(
a0
==
nullptr
);
ASSERT_TRUE
(
a1
==
NULL
);
ASSERT_TRUE
(
a1
==
nullptr
);
ASSERT_TRUE
(
a2
==
NULL
);
ASSERT_TRUE
(
a2
==
nullptr
);
{
{
linked_ptr
<
A
>
a3
(
new
A
);
linked_ptr
<
A
>
a3
(
new
A
);
a0
=
a3
;
a0
=
a3
;
ASSERT_TRUE
(
a0
==
a3
);
ASSERT_TRUE
(
a0
==
a3
);
ASSERT_TRUE
(
a0
!=
NULL
);
ASSERT_TRUE
(
a0
!=
nullptr
);
ASSERT_TRUE
(
a0
.
get
()
==
a3
);
ASSERT_TRUE
(
a0
.
get
()
==
a3
);
ASSERT_TRUE
(
a0
==
a3
.
get
());
ASSERT_TRUE
(
a0
==
a3
.
get
());
linked_ptr
<
A
>
a4
(
a0
);
linked_ptr
<
A
>
a4
(
a0
);
...
@@ -101,7 +101,7 @@ TEST_F(LinkedPtrTest, GeneralTest) {
...
@@ -101,7 +101,7 @@ TEST_F(LinkedPtrTest, GeneralTest) {
linked_ptr
<
A
>
a6
(
b0
);
linked_ptr
<
A
>
a6
(
b0
);
ASSERT_TRUE
(
b0
==
a6
);
ASSERT_TRUE
(
b0
==
a6
);
ASSERT_TRUE
(
a6
==
b0
);
ASSERT_TRUE
(
a6
==
b0
);
ASSERT_TRUE
(
b0
!=
NULL
);
ASSERT_TRUE
(
b0
!=
nullptr
);
a5
=
b0
;
a5
=
b0
;
a5
=
b0
;
a5
=
b0
;
a3
->
Use
();
a3
->
Use
();
...
...
googletest/test/googletest-listener-test.cc
View file @
3149e0e8
...
@@ -47,7 +47,7 @@ using ::testing::TestPartResult;
...
@@ -47,7 +47,7 @@ using ::testing::TestPartResult;
using
::
testing
::
UnitTest
;
using
::
testing
::
UnitTest
;
// Used by tests to register their events.
// Used by tests to register their events.
std
::
vector
<
std
::
string
>*
g_events
=
NULL
;
std
::
vector
<
std
::
string
>*
g_events
=
nullptr
;
namespace
testing
{
namespace
testing
{
namespace
internal
{
namespace
internal
{
...
...
googletest/test/googletest-message-test.cc
View file @
3149e0e8
...
@@ -85,7 +85,7 @@ TEST(MessageTest, StreamsPointer) {
...
@@ -85,7 +85,7 @@ TEST(MessageTest, StreamsPointer) {
// Tests streaming a NULL non-char pointer.
// Tests streaming a NULL non-char pointer.
TEST
(
MessageTest
,
StreamsNullPointer
)
{
TEST
(
MessageTest
,
StreamsNullPointer
)
{
int
*
p
=
NULL
;
int
*
p
=
nullptr
;
EXPECT_EQ
(
"(null)"
,
(
Message
()
<<
p
).
GetString
());
EXPECT_EQ
(
"(null)"
,
(
Message
()
<<
p
).
GetString
());
}
}
...
@@ -96,7 +96,7 @@ TEST(MessageTest, StreamsCString) {
...
@@ -96,7 +96,7 @@ TEST(MessageTest, StreamsCString) {
// Tests streaming a NULL C string.
// Tests streaming a NULL C string.
TEST
(
MessageTest
,
StreamsNullCString
)
{
TEST
(
MessageTest
,
StreamsNullCString
)
{
char
*
p
=
NULL
;
char
*
p
=
nullptr
;
EXPECT_EQ
(
"(null)"
,
(
Message
()
<<
p
).
GetString
());
EXPECT_EQ
(
"(null)"
,
(
Message
()
<<
p
).
GetString
());
}
}
...
...
googletest/test/googletest-output-test_.cc
View file @
3149e0e8
...
@@ -174,7 +174,7 @@ TEST(SCOPED_TRACETest, AcceptedValues) {
...
@@ -174,7 +174,7 @@ TEST(SCOPED_TRACETest, AcceptedValues) {
SCOPED_TRACE
(
"literal string"
);
SCOPED_TRACE
(
"literal string"
);
SCOPED_TRACE
(
std
::
string
(
"std::string"
));
SCOPED_TRACE
(
std
::
string
(
"std::string"
));
SCOPED_TRACE
(
1337
);
// streamable type
SCOPED_TRACE
(
1337
);
// streamable type
const
char
*
null_value
=
NULL
;
const
char
*
null_value
=
nullptr
;
SCOPED_TRACE
(
null_value
);
SCOPED_TRACE
(
null_value
);
ADD_FAILURE
()
<<
"Just checking that all these values work fine."
;
ADD_FAILURE
()
<<
"Just checking that all these values work fine."
;
...
@@ -306,9 +306,8 @@ TEST(SCOPED_TRACETest, WorksConcurrently) {
...
@@ -306,9 +306,8 @@ TEST(SCOPED_TRACETest, WorksConcurrently) {
printf
(
"(expecting 6 failures)
\n
"
);
printf
(
"(expecting 6 failures)
\n
"
);
CheckPoints
check_points
;
CheckPoints
check_points
;
ThreadWithParam
<
CheckPoints
*>
thread
(
&
ThreadWithScopedTrace
,
ThreadWithParam
<
CheckPoints
*>
thread
(
&
ThreadWithScopedTrace
,
&
check_points
,
&
check_points
,
nullptr
);
NULL
);
check_points
.
n1
.
WaitForNotification
();
check_points
.
n1
.
WaitForNotification
();
{
{
...
@@ -511,7 +510,7 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
...
@@ -511,7 +510,7 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
// Starts a thread and waits for it to begin.
// Starts a thread and waits for it to begin.
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
thread_
.
reset
(
new
ThreadWithParam
<
SpawnThreadNotifications
*>
(
thread_
.
reset
(
new
ThreadWithParam
<
SpawnThreadNotifications
*>
(
&
ThreadRoutine
,
&
notifications_
,
NULL
));
&
ThreadRoutine
,
&
notifications_
,
nullptr
));
notifications_
.
spawn_thread_started
.
WaitForNotification
();
notifications_
.
spawn_thread_started
.
WaitForNotification
();
}
}
// Tells the thread to finish, and reaps it.
// Tells the thread to finish, and reaps it.
...
@@ -966,7 +965,7 @@ TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
...
@@ -966,7 +965,7 @@ TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
class
ExpectFailureWithThreadsTest
:
public
ExpectFailureTest
{
class
ExpectFailureWithThreadsTest
:
public
ExpectFailureTest
{
protected:
protected:
static
void
AddFailureInOtherThread
(
FailureMode
failure
)
{
static
void
AddFailureInOtherThread
(
FailureMode
failure
)
{
ThreadWithParam
<
FailureMode
>
thread
(
&
AddFailure
,
failure
,
NULL
);
ThreadWithParam
<
FailureMode
>
thread
(
&
AddFailure
,
failure
,
nullptr
);
thread
.
Join
();
thread
.
Join
();
}
}
};
};
...
...
googletest/test/googletest-param-test-test.cc
View file @
3149e0e8
...
@@ -535,8 +535,6 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
...
@@ -535,8 +535,6 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
VerifyGenerator
(
gen
,
expected_values
);
VerifyGenerator
(
gen
,
expected_values
);
}
}
#if GTEST_LANG_CXX11
class
NonDefaultConstructAssignString
{
class
NonDefaultConstructAssignString
{
public:
public:
NonDefaultConstructAssignString
(
const
std
::
string
&
s
)
:
str_
(
s
)
{}
NonDefaultConstructAssignString
(
const
std
::
string
&
s
)
:
str_
(
s
)
{}
...
@@ -579,7 +577,6 @@ TEST(CombineTest, NonDefaultConstructAssign) {
...
@@ -579,7 +577,6 @@ TEST(CombineTest, NonDefaultConstructAssign) {
EXPECT_TRUE
(
it
==
gen
.
end
());
EXPECT_TRUE
(
it
==
gen
.
end
());
}
}
#endif // GTEST_LANG_CXX11
# endif // GTEST_HAS_COMBINE
# endif // GTEST_HAS_COMBINE
// Tests that an generator produces correct sequence after being
// Tests that an generator produces correct sequence after being
...
@@ -913,8 +910,6 @@ INSTANTIATE_TEST_CASE_P(CustomParamNameFunction,
...
@@ -913,8 +910,6 @@ INSTANTIATE_TEST_CASE_P(CustomParamNameFunction,
Values
(
std
::
string
(
"FunctionName"
)),
Values
(
std
::
string
(
"FunctionName"
)),
CustomParamNameFunction
);
CustomParamNameFunction
);
#if GTEST_LANG_CXX11
// Test custom naming with a lambda
// Test custom naming with a lambda
class
CustomLambdaNamingTest
:
public
TestWithParam
<
std
::
string
>
{};
class
CustomLambdaNamingTest
:
public
TestWithParam
<
std
::
string
>
{};
...
@@ -926,8 +921,6 @@ INSTANTIATE_TEST_CASE_P(CustomParamNameLambda, CustomLambdaNamingTest,
...
@@ -926,8 +921,6 @@ INSTANTIATE_TEST_CASE_P(CustomParamNameLambda, CustomLambdaNamingTest,
return
inf
.
param
;
return
inf
.
param
;
});
});
#endif // GTEST_LANG_CXX11
TEST
(
CustomNamingTest
,
CheckNameRegistry
)
{
TEST
(
CustomNamingTest
,
CheckNameRegistry
)
{
::
testing
::
UnitTest
*
unit_test
=
::
testing
::
UnitTest
::
GetInstance
();
::
testing
::
UnitTest
*
unit_test
=
::
testing
::
UnitTest
::
GetInstance
();
std
::
set
<
std
::
string
>
test_names
;
std
::
set
<
std
::
string
>
test_names
;
...
@@ -944,9 +937,7 @@ TEST(CustomNamingTest, CheckNameRegistry) {
...
@@ -944,9 +937,7 @@ TEST(CustomNamingTest, CheckNameRegistry) {
}
}
EXPECT_EQ
(
1u
,
test_names
.
count
(
"CustomTestNames/FunctorName"
));
EXPECT_EQ
(
1u
,
test_names
.
count
(
"CustomTestNames/FunctorName"
));
EXPECT_EQ
(
1u
,
test_names
.
count
(
"CustomTestNames/FunctionName"
));
EXPECT_EQ
(
1u
,
test_names
.
count
(
"CustomTestNames/FunctionName"
));
#if GTEST_LANG_CXX11
EXPECT_EQ
(
1u
,
test_names
.
count
(
"CustomTestNames/LambdaName"
));
EXPECT_EQ
(
1u
,
test_names
.
count
(
"CustomTestNames/LambdaName"
));
#endif // GTEST_LANG_CXX11
}
}
// Test a numeric name to ensure PrintToStringParamName works correctly.
// Test a numeric name to ensure PrintToStringParamName works correctly.
...
...
googletest/test/googletest-port-test.cc
View file @
3149e0e8
...
@@ -262,9 +262,9 @@ TEST(FormatFileLocationTest, FormatsFileLocation) {
...
@@ -262,9 +262,9 @@ TEST(FormatFileLocationTest, FormatsFileLocation) {
}
}
TEST
(
FormatFileLocationTest
,
FormatsUnknownFile
)
{
TEST
(
FormatFileLocationTest
,
FormatsUnknownFile
)
{
EXPECT_PRED_FORMAT2
(
EXPECT_PRED_FORMAT2
(
IsSubstring
,
"unknown file"
,
IsSubstring
,
"unknown file"
,
FormatFileLocation
(
NULL
,
42
));
FormatFileLocation
(
nullptr
,
42
));
EXPECT_PRED_FORMAT2
(
IsSubstring
,
"42"
,
FormatFileLocation
(
NULL
,
42
));
EXPECT_PRED_FORMAT2
(
IsSubstring
,
"42"
,
FormatFileLocation
(
nullptr
,
42
));
}
}
TEST
(
FormatFileLocationTest
,
FormatsUknownLine
)
{
TEST
(
FormatFileLocationTest
,
FormatsUknownLine
)
{
...
@@ -272,7 +272,7 @@ TEST(FormatFileLocationTest, FormatsUknownLine) {
...
@@ -272,7 +272,7 @@ TEST(FormatFileLocationTest, FormatsUknownLine) {
}
}
TEST
(
FormatFileLocationTest
,
FormatsUknownFileAndLine
)
{
TEST
(
FormatFileLocationTest
,
FormatsUknownFileAndLine
)
{
EXPECT_EQ
(
"unknown file:"
,
FormatFileLocation
(
NULL
,
-
1
));
EXPECT_EQ
(
"unknown file:"
,
FormatFileLocation
(
nullptr
,
-
1
));
}
}
// Verifies behavior of FormatCompilerIndependentFileLocation.
// Verifies behavior of FormatCompilerIndependentFileLocation.
...
@@ -282,7 +282,7 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsFileLocation) {
...
@@ -282,7 +282,7 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsFileLocation) {
TEST
(
FormatCompilerIndependentFileLocationTest
,
FormatsUknownFile
)
{
TEST
(
FormatCompilerIndependentFileLocationTest
,
FormatsUknownFile
)
{
EXPECT_EQ
(
"unknown file:42"
,
EXPECT_EQ
(
"unknown file:42"
,
FormatCompilerIndependentFileLocation
(
NULL
,
42
));
FormatCompilerIndependentFileLocation
(
nullptr
,
42
));
}
}
TEST
(
FormatCompilerIndependentFileLocationTest
,
FormatsUknownLine
)
{
TEST
(
FormatCompilerIndependentFileLocationTest
,
FormatsUknownLine
)
{
...
@@ -290,7 +290,7 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownLine) {
...
@@ -290,7 +290,7 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownLine) {
}
}
TEST
(
FormatCompilerIndependentFileLocationTest
,
FormatsUknownFileAndLine
)
{
TEST
(
FormatCompilerIndependentFileLocationTest
,
FormatsUknownFileAndLine
)
{
EXPECT_EQ
(
"unknown file"
,
FormatCompilerIndependentFileLocation
(
NULL
,
-
1
));
EXPECT_EQ
(
"unknown file"
,
FormatCompilerIndependentFileLocation
(
nullptr
,
-
1
));
}
}
#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_FUCHSIA
#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_FUCHSIA
...
@@ -298,7 +298,7 @@ void* ThreadFunc(void* data) {
...
@@ -298,7 +298,7 @@ void* ThreadFunc(void* data) {
internal
::
Mutex
*
mutex
=
static_cast
<
internal
::
Mutex
*>
(
data
);
internal
::
Mutex
*
mutex
=
static_cast
<
internal
::
Mutex
*>
(
data
);
mutex
->
Lock
();
mutex
->
Lock
();
mutex
->
Unlock
();
mutex
->
Unlock
();
return
NULL
;
return
nullptr
;
}
}
TEST
(
GetThreadCountTest
,
ReturnsCorrectValue
)
{
TEST
(
GetThreadCountTest
,
ReturnsCorrectValue
)
{
...
@@ -965,7 +965,7 @@ TEST(ThreadLocalTest, DefaultConstructorInitializesToDefaultValues) {
...
@@ -965,7 +965,7 @@ TEST(ThreadLocalTest, DefaultConstructorInitializesToDefaultValues) {
EXPECT_EQ
(
0
,
t1
.
get
());
EXPECT_EQ
(
0
,
t1
.
get
());
ThreadLocal
<
void
*>
t2
;
ThreadLocal
<
void
*>
t2
;
EXPECT_TRUE
(
t2
.
get
()
==
NULL
);
EXPECT_TRUE
(
t2
.
get
()
==
nullptr
);
}
}
TEST
(
ThreadLocalTest
,
SingleParamConstructorInitializesToParam
)
{
TEST
(
ThreadLocalTest
,
SingleParamConstructorInitializesToParam
)
{
...
@@ -1015,7 +1015,7 @@ void AddTwo(int* param) { *param += 2; }
...
@@ -1015,7 +1015,7 @@ void AddTwo(int* param) { *param += 2; }
TEST
(
ThreadWithParamTest
,
ConstructorExecutesThreadFunc
)
{
TEST
(
ThreadWithParamTest
,
ConstructorExecutesThreadFunc
)
{
int
i
=
40
;
int
i
=
40
;
ThreadWithParam
<
int
*>
thread
(
&
AddTwo
,
&
i
,
NULL
);
ThreadWithParam
<
int
*>
thread
(
&
AddTwo
,
&
i
,
nullptr
);
thread
.
Join
();
thread
.
Join
();
EXPECT_EQ
(
42
,
i
);
EXPECT_EQ
(
42
,
i
);
}
}
...
@@ -1055,7 +1055,7 @@ class AtomicCounterWithMutex {
...
@@ -1055,7 +1055,7 @@ class AtomicCounterWithMutex {
// functionality as we are testing them here.
// functionality as we are testing them here.
pthread_mutex_t
memory_barrier_mutex
;
pthread_mutex_t
memory_barrier_mutex
;
GTEST_CHECK_POSIX_SUCCESS_
(
GTEST_CHECK_POSIX_SUCCESS_
(
pthread_mutex_init
(
&
memory_barrier_mutex
,
NULL
));
pthread_mutex_init
(
&
memory_barrier_mutex
,
nullptr
));
GTEST_CHECK_POSIX_SUCCESS_
(
pthread_mutex_lock
(
&
memory_barrier_mutex
));
GTEST_CHECK_POSIX_SUCCESS_
(
pthread_mutex_lock
(
&
memory_barrier_mutex
));
SleepMilliseconds
(
random_
.
Generate
(
30
));
SleepMilliseconds
(
random_
.
Generate
(
30
));
...
@@ -1118,7 +1118,7 @@ TEST(MutexTest, OnlyOneThreadCanLockAtATime) {
...
@@ -1118,7 +1118,7 @@ TEST(MutexTest, OnlyOneThreadCanLockAtATime) {
template
<
typename
T
>
template
<
typename
T
>
void
RunFromThread
(
void
(
func
)(
T
),
T
param
)
{
void
RunFromThread
(
void
(
func
)(
T
),
T
param
)
{
ThreadWithParam
<
T
>
thread
(
func
,
param
,
NULL
);
ThreadWithParam
<
T
>
thread
(
func
,
param
,
nullptr
);
thread
.
Join
();
thread
.
Join
();
}
}
...
@@ -1250,8 +1250,8 @@ TEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) {
...
@@ -1250,8 +1250,8 @@ TEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) {
ASSERT_EQ
(
0U
,
DestructorCall
::
List
().
size
());
ASSERT_EQ
(
0U
,
DestructorCall
::
List
().
size
());
// This creates another DestructorTracker object in the new thread.
// This creates another DestructorTracker object in the new thread.
ThreadWithParam
<
ThreadParam
>
thread
(
ThreadWithParam
<
ThreadParam
>
thread
(
&
CallThreadLocalGet
,
&
CallThreadLocalGet
,
&
thread_local_tracker
,
NULL
);
&
thread_local_tracker
,
nullptr
);
thread
.
Join
();
thread
.
Join
();
// The thread has exited, and we should have a DestroyedTracker
// The thread has exited, and we should have a DestroyedTracker
...
...
googletest/test/googletest-printers-test.cc
View file @
3149e0e8
...
@@ -405,7 +405,7 @@ TEST(PrintCStringTest, NonConst) {
...
@@ -405,7 +405,7 @@ TEST(PrintCStringTest, NonConst) {
// NULL C string.
// NULL C string.
TEST
(
PrintCStringTest
,
Null
)
{
TEST
(
PrintCStringTest
,
Null
)
{
const
char
*
p
=
NULL
;
const
char
*
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -440,7 +440,7 @@ TEST(PrintWideCStringTest, NonConst) {
...
@@ -440,7 +440,7 @@ TEST(PrintWideCStringTest, NonConst) {
// NULL wide C string.
// NULL wide C string.
TEST
(
PrintWideCStringTest
,
Null
)
{
TEST
(
PrintWideCStringTest
,
Null
)
{
const
wchar_t
*
p
=
NULL
;
const
wchar_t
*
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -460,7 +460,7 @@ TEST(PrintWideCStringTest, EscapesProperly) {
...
@@ -460,7 +460,7 @@ TEST(PrintWideCStringTest, EscapesProperly) {
TEST
(
PrintCharPointerTest
,
SignedChar
)
{
TEST
(
PrintCharPointerTest
,
SignedChar
)
{
signed
char
*
p
=
reinterpret_cast
<
signed
char
*>
(
0x1234
);
signed
char
*
p
=
reinterpret_cast
<
signed
char
*>
(
0x1234
);
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
p
=
NULL
;
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -468,7 +468,7 @@ TEST(PrintCharPointerTest, SignedChar) {
...
@@ -468,7 +468,7 @@ TEST(PrintCharPointerTest, SignedChar) {
TEST
(
PrintCharPointerTest
,
ConstSignedChar
)
{
TEST
(
PrintCharPointerTest
,
ConstSignedChar
)
{
signed
char
*
p
=
reinterpret_cast
<
signed
char
*>
(
0x1234
);
signed
char
*
p
=
reinterpret_cast
<
signed
char
*>
(
0x1234
);
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
p
=
NULL
;
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -476,7 +476,7 @@ TEST(PrintCharPointerTest, ConstSignedChar) {
...
@@ -476,7 +476,7 @@ TEST(PrintCharPointerTest, ConstSignedChar) {
TEST
(
PrintCharPointerTest
,
UnsignedChar
)
{
TEST
(
PrintCharPointerTest
,
UnsignedChar
)
{
unsigned
char
*
p
=
reinterpret_cast
<
unsigned
char
*>
(
0x1234
);
unsigned
char
*
p
=
reinterpret_cast
<
unsigned
char
*>
(
0x1234
);
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
p
=
NULL
;
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -484,7 +484,7 @@ TEST(PrintCharPointerTest, UnsignedChar) {
...
@@ -484,7 +484,7 @@ TEST(PrintCharPointerTest, UnsignedChar) {
TEST
(
PrintCharPointerTest
,
ConstUnsignedChar
)
{
TEST
(
PrintCharPointerTest
,
ConstUnsignedChar
)
{
const
unsigned
char
*
p
=
reinterpret_cast
<
const
unsigned
char
*>
(
0x1234
);
const
unsigned
char
*
p
=
reinterpret_cast
<
const
unsigned
char
*>
(
0x1234
);
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
p
=
NULL
;
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -494,7 +494,7 @@ TEST(PrintCharPointerTest, ConstUnsignedChar) {
...
@@ -494,7 +494,7 @@ TEST(PrintCharPointerTest, ConstUnsignedChar) {
TEST
(
PrintPointerToBuiltInTypeTest
,
Bool
)
{
TEST
(
PrintPointerToBuiltInTypeTest
,
Bool
)
{
bool
*
p
=
reinterpret_cast
<
bool
*>
(
0xABCD
);
bool
*
p
=
reinterpret_cast
<
bool
*>
(
0xABCD
);
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
p
=
NULL
;
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -502,7 +502,7 @@ TEST(PrintPointerToBuiltInTypeTest, Bool) {
...
@@ -502,7 +502,7 @@ TEST(PrintPointerToBuiltInTypeTest, Bool) {
TEST
(
PrintPointerToBuiltInTypeTest
,
Void
)
{
TEST
(
PrintPointerToBuiltInTypeTest
,
Void
)
{
void
*
p
=
reinterpret_cast
<
void
*>
(
0xABCD
);
void
*
p
=
reinterpret_cast
<
void
*>
(
0xABCD
);
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
p
=
NULL
;
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -510,7 +510,7 @@ TEST(PrintPointerToBuiltInTypeTest, Void) {
...
@@ -510,7 +510,7 @@ TEST(PrintPointerToBuiltInTypeTest, Void) {
TEST
(
PrintPointerToBuiltInTypeTest
,
ConstVoid
)
{
TEST
(
PrintPointerToBuiltInTypeTest
,
ConstVoid
)
{
const
void
*
p
=
reinterpret_cast
<
const
void
*>
(
0xABCD
);
const
void
*
p
=
reinterpret_cast
<
const
void
*>
(
0xABCD
);
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
p
=
NULL
;
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -518,7 +518,7 @@ TEST(PrintPointerToBuiltInTypeTest, ConstVoid) {
...
@@ -518,7 +518,7 @@ TEST(PrintPointerToBuiltInTypeTest, ConstVoid) {
TEST
(
PrintPointerToPointerTest
,
IntPointerPointer
)
{
TEST
(
PrintPointerToPointerTest
,
IntPointerPointer
)
{
int
**
p
=
reinterpret_cast
<
int
**>
(
0xABCD
);
int
**
p
=
reinterpret_cast
<
int
**>
(
0xABCD
);
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
EXPECT_EQ
(
PrintPointer
(
p
),
Print
(
p
));
p
=
NULL
;
p
=
nullptr
;
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
EXPECT_EQ
(
"NULL"
,
Print
(
p
));
}
}
...
@@ -1109,9 +1109,7 @@ TEST(PrintStdTupleTest, NestedTuple) {
...
@@ -1109,9 +1109,7 @@ TEST(PrintStdTupleTest, NestedTuple) {
EXPECT_EQ
(
"((5, true), 'a' (97, 0x61))"
,
Print
(
nested
));
EXPECT_EQ
(
"((5, true), 'a' (97, 0x61))"
,
Print
(
nested
));
}
}
#endif // GTEST_LANG_CXX11
#endif // GTEST_HAS_TR1_TUPLE
#if GTEST_LANG_CXX11
TEST
(
PrintNullptrT
,
Basic
)
{
TEST
(
PrintNullptrT
,
Basic
)
{
EXPECT_EQ
(
"(nullptr)"
,
Print
(
nullptr
));
EXPECT_EQ
(
"(nullptr)"
,
Print
(
nullptr
));
...
@@ -1131,8 +1129,6 @@ TEST(PrintReferenceWrapper, Unprintable) {
...
@@ -1131,8 +1129,6 @@ TEST(PrintReferenceWrapper, Unprintable) {
Print
(
std
::
cref
(
up
)));
Print
(
std
::
cref
(
up
)));
}
}
#endif // GTEST_LANG_CXX11
// Tests printing user-defined unprintable types.
// Tests printing user-defined unprintable types.
// Unprintable types in the global namespace.
// Unprintable types in the global namespace.
...
@@ -1402,7 +1398,7 @@ TEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsStdWString) {
...
@@ -1402,7 +1398,7 @@ TEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsStdWString) {
// char array vs pointer
// char array vs pointer
TEST
(
FormatForComparisonFailureMessageTest
,
WorksForCharArrayVsPointer
)
{
TEST
(
FormatForComparisonFailureMessageTest
,
WorksForCharArrayVsPointer
)
{
char
str
[]
=
"hi
\"
world
\"
"
;
char
str
[]
=
"hi
\"
world
\"
"
;
char
*
p
=
NULL
;
char
*
p
=
nullptr
;
EXPECT_EQ
(
PrintPointer
(
str
),
EXPECT_EQ
(
PrintPointer
(
str
),
FormatForComparisonFailureMessage
(
str
,
p
).
c_str
());
FormatForComparisonFailureMessage
(
str
,
p
).
c_str
());
}
}
...
@@ -1417,7 +1413,7 @@ TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsCharArray) {
...
@@ -1417,7 +1413,7 @@ TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsCharArray) {
// wchar_t array vs pointer
// wchar_t array vs pointer
TEST
(
FormatForComparisonFailureMessageTest
,
WorksForWCharArrayVsPointer
)
{
TEST
(
FormatForComparisonFailureMessageTest
,
WorksForWCharArrayVsPointer
)
{
wchar_t
str
[]
=
L"hi
\"
world
\"
"
;
wchar_t
str
[]
=
L"hi
\"
world
\"
"
;
wchar_t
*
p
=
NULL
;
wchar_t
*
p
=
nullptr
;
EXPECT_EQ
(
PrintPointer
(
str
),
EXPECT_EQ
(
PrintPointer
(
str
),
FormatForComparisonFailureMessage
(
str
,
p
).
c_str
());
FormatForComparisonFailureMessage
(
str
,
p
).
c_str
());
}
}
...
@@ -1618,7 +1614,7 @@ TEST(UniversalTersePrintTest, WorksForCString) {
...
@@ -1618,7 +1614,7 @@ TEST(UniversalTersePrintTest, WorksForCString) {
UniversalTersePrint
(
s2
,
&
ss2
);
UniversalTersePrint
(
s2
,
&
ss2
);
EXPECT_EQ
(
"
\"
abc
\"
"
,
ss2
.
str
());
EXPECT_EQ
(
"
\"
abc
\"
"
,
ss2
.
str
());
const
char
*
s3
=
NULL
;
const
char
*
s3
=
nullptr
;
::
std
::
stringstream
ss3
;
::
std
::
stringstream
ss3
;
UniversalTersePrint
(
s3
,
&
ss3
);
UniversalTersePrint
(
s3
,
&
ss3
);
EXPECT_EQ
(
"NULL"
,
ss3
.
str
());
EXPECT_EQ
(
"NULL"
,
ss3
.
str
());
...
@@ -1648,7 +1644,7 @@ TEST(UniversalPrintTest, WorksForCString) {
...
@@ -1648,7 +1644,7 @@ TEST(UniversalPrintTest, WorksForCString) {
UniversalPrint
(
s2
,
&
ss2
);
UniversalPrint
(
s2
,
&
ss2
);
EXPECT_EQ
(
PrintPointer
(
s2
)
+
" pointing to
\"
abc
\"
"
,
std
::
string
(
ss2
.
str
()));
EXPECT_EQ
(
PrintPointer
(
s2
)
+
" pointing to
\"
abc
\"
"
,
std
::
string
(
ss2
.
str
()));
const
char
*
s3
=
NULL
;
const
char
*
s3
=
nullptr
;
::
std
::
stringstream
ss3
;
::
std
::
stringstream
ss3
;
UniversalPrint
(
s3
,
&
ss3
);
UniversalPrint
(
s3
,
&
ss3
);
EXPECT_EQ
(
"NULL"
,
ss3
.
str
());
EXPECT_EQ
(
"NULL"
,
ss3
.
str
());
...
...
googletest/test/googletest-throw-on-failure-test_.cc
View file @
3149e0e8
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
// ones.
// ones.
void
TerminateHandler
()
{
void
TerminateHandler
()
{
fprintf
(
stderr
,
"%s
\n
"
,
"Unhandled C++ exception terminating the program."
);
fprintf
(
stderr
,
"%s
\n
"
,
"Unhandled C++ exception terminating the program."
);
fflush
(
NULL
);
fflush
(
nullptr
);
exit
(
1
);
exit
(
1
);
}
}
...
...
googletest/test/googletest-tuple-test.cc
View file @
3149e0e8
...
@@ -158,7 +158,7 @@ TEST(TupleConstructorTest, DefaultConstructorDefaultInitializesEachField) {
...
@@ -158,7 +158,7 @@ TEST(TupleConstructorTest, DefaultConstructorDefaultInitializesEachField) {
b3
=
a3
;
b3
=
a3
;
EXPECT_EQ
(
0.0
,
get
<
0
>
(
b3
));
EXPECT_EQ
(
0.0
,
get
<
0
>
(
b3
));
EXPECT_EQ
(
'\0'
,
get
<
1
>
(
b3
));
EXPECT_EQ
(
'\0'
,
get
<
1
>
(
b3
));
EXPECT_TRUE
(
get
<
2
>
(
b3
)
==
NULL
);
EXPECT_TRUE
(
get
<
2
>
(
b3
)
==
nullptr
);
tuple
<
int
,
int
,
int
,
int
,
int
,
int
,
int
,
int
,
int
,
int
>
a10
,
b10
;
tuple
<
int
,
int
,
int
,
int
,
int
,
int
,
int
,
int
,
int
,
int
>
a10
,
b10
;
b10
=
a10
;
b10
=
a10
;
...
...
googletest/test/gtest-typed-test_test.cc
View file @
3149e0e8
...
@@ -55,7 +55,7 @@ class CommonTest : public Test {
...
@@ -55,7 +55,7 @@ class CommonTest : public Test {
static
void
TearDownTestCase
()
{
static
void
TearDownTestCase
()
{
delete
shared_
;
delete
shared_
;
shared_
=
NULL
;
shared_
=
nullptr
;
}
}
// This 'protected:' is optional. There's no harm in making all
// This 'protected:' is optional. There's no harm in making all
...
@@ -85,7 +85,7 @@ class CommonTest : public Test {
...
@@ -85,7 +85,7 @@ class CommonTest : public Test {
};
};
template
<
typename
T
>
template
<
typename
T
>
T
*
CommonTest
<
T
>::
shared_
=
NULL
;
T
*
CommonTest
<
T
>::
shared_
=
nullptr
;
// This #ifdef block tests typed tests.
// This #ifdef block tests typed tests.
#if GTEST_HAS_TYPED_TEST
#if GTEST_HAS_TYPED_TEST
...
@@ -121,7 +121,7 @@ TYPED_TEST(CommonTest, ValuesAreCorrect) {
...
@@ -121,7 +121,7 @@ TYPED_TEST(CommonTest, ValuesAreCorrect) {
TYPED_TEST
(
CommonTest
,
ValuesAreStillCorrect
)
{
TYPED_TEST
(
CommonTest
,
ValuesAreStillCorrect
)
{
// Static members of the fixture class template can also be visited
// Static members of the fixture class template can also be visited
// via 'this'.
// via 'this'.
ASSERT_TRUE
(
this
->
shared_
!=
NULL
);
ASSERT_TRUE
(
this
->
shared_
!=
nullptr
);
EXPECT_EQ
(
5
,
*
this
->
shared_
);
EXPECT_EQ
(
5
,
*
this
->
shared_
);
// TypeParam can be used to refer to the type parameter.
// TypeParam can be used to refer to the type parameter.
...
@@ -292,7 +292,7 @@ TYPED_TEST_P(DerivedTest, ValuesAreCorrect) {
...
@@ -292,7 +292,7 @@ TYPED_TEST_P(DerivedTest, ValuesAreCorrect) {
TYPED_TEST_P
(
DerivedTest
,
ValuesAreStillCorrect
)
{
TYPED_TEST_P
(
DerivedTest
,
ValuesAreStillCorrect
)
{
// Static members of the fixture class template can also be visited
// Static members of the fixture class template can also be visited
// via 'this'.
// via 'this'.
ASSERT_TRUE
(
this
->
shared_
!=
NULL
);
ASSERT_TRUE
(
this
->
shared_
!=
nullptr
);
EXPECT_EQ
(
5
,
*
this
->
shared_
);
EXPECT_EQ
(
5
,
*
this
->
shared_
);
EXPECT_EQ
(
2
,
this
->
value_
);
EXPECT_EQ
(
2
,
this
->
value_
);
}
}
...
...
googletest/test/gtest-unittest-api_test.cc
View file @
3149e0e8
...
@@ -76,7 +76,7 @@ class UnitTestHelper {
...
@@ -76,7 +76,7 @@ class UnitTestHelper {
if
(
0
==
strcmp
(
test_case
->
name
(),
name
))
if
(
0
==
strcmp
(
test_case
->
name
(),
name
))
return
test_case
;
return
test_case
;
}
}
return
NULL
;
return
nullptr
;
}
}
// Returns the array of pointers to all tests in a particular test case
// Returns the array of pointers to all tests in a particular test case
...
@@ -137,7 +137,7 @@ TEST(ApiTest, UnitTestImmutableAccessorsWork) {
...
@@ -137,7 +137,7 @@ TEST(ApiTest, UnitTestImmutableAccessorsWork) {
}
}
AssertionResult
IsNull
(
const
char
*
str
)
{
AssertionResult
IsNull
(
const
char
*
str
)
{
if
(
str
!=
NULL
)
{
if
(
str
!=
nullptr
)
{
return
testing
::
AssertionFailure
()
<<
"argument is "
<<
str
;
return
testing
::
AssertionFailure
()
<<
"argument is "
<<
str
;
}
}
return
AssertionSuccess
();
return
AssertionSuccess
();
...
@@ -145,7 +145,7 @@ AssertionResult IsNull(const char* str) {
...
@@ -145,7 +145,7 @@ AssertionResult IsNull(const char* str) {
TEST
(
ApiTest
,
TestCaseImmutableAccessorsWork
)
{
TEST
(
ApiTest
,
TestCaseImmutableAccessorsWork
)
{
const
TestCase
*
test_case
=
UnitTestHelper
::
FindTestCase
(
"ApiTest"
);
const
TestCase
*
test_case
=
UnitTestHelper
::
FindTestCase
(
"ApiTest"
);
ASSERT_TRUE
(
test_case
!=
NULL
);
ASSERT_TRUE
(
test_case
!=
nullptr
);
EXPECT_STREQ
(
"ApiTest"
,
test_case
->
name
());
EXPECT_STREQ
(
"ApiTest"
,
test_case
->
name
());
EXPECT_TRUE
(
IsNull
(
test_case
->
type_param
()));
EXPECT_TRUE
(
IsNull
(
test_case
->
type_param
()));
...
@@ -181,11 +181,11 @@ TEST(ApiTest, TestCaseImmutableAccessorsWork) {
...
@@ -181,11 +181,11 @@ TEST(ApiTest, TestCaseImmutableAccessorsWork) {
EXPECT_TRUE
(
tests
[
3
]
->
should_run
());
EXPECT_TRUE
(
tests
[
3
]
->
should_run
());
delete
[]
tests
;
delete
[]
tests
;
tests
=
NULL
;
tests
=
nullptr
;
#if GTEST_HAS_TYPED_TEST
#if GTEST_HAS_TYPED_TEST
test_case
=
UnitTestHelper
::
FindTestCase
(
"TestCaseWithCommentTest/0"
);
test_case
=
UnitTestHelper
::
FindTestCase
(
"TestCaseWithCommentTest/0"
);
ASSERT_TRUE
(
test_case
!=
NULL
);
ASSERT_TRUE
(
test_case
!=
nullptr
);
EXPECT_STREQ
(
"TestCaseWithCommentTest/0"
,
test_case
->
name
());
EXPECT_STREQ
(
"TestCaseWithCommentTest/0"
,
test_case
->
name
());
EXPECT_STREQ
(
GetTypeName
<
int
>
().
c_str
(),
test_case
->
type_param
());
EXPECT_STREQ
(
GetTypeName
<
int
>
().
c_str
(),
test_case
->
type_param
());
...
@@ -208,7 +208,7 @@ TEST(ApiTest, TestCaseImmutableAccessorsWork) {
...
@@ -208,7 +208,7 @@ TEST(ApiTest, TestCaseImmutableAccessorsWork) {
TEST
(
ApiTest
,
TestCaseDisabledAccessorsWork
)
{
TEST
(
ApiTest
,
TestCaseDisabledAccessorsWork
)
{
const
TestCase
*
test_case
=
UnitTestHelper
::
FindTestCase
(
"DISABLED_Test"
);
const
TestCase
*
test_case
=
UnitTestHelper
::
FindTestCase
(
"DISABLED_Test"
);
ASSERT_TRUE
(
test_case
!=
NULL
);
ASSERT_TRUE
(
test_case
!=
nullptr
);
EXPECT_STREQ
(
"DISABLED_Test"
,
test_case
->
name
());
EXPECT_STREQ
(
"DISABLED_Test"
,
test_case
->
name
());
EXPECT_TRUE
(
IsNull
(
test_case
->
type_param
()));
EXPECT_TRUE
(
IsNull
(
test_case
->
type_param
()));
...
...
googletest/test/gtest_assert_by_exception_test.cc
View file @
3149e0e8
...
@@ -80,8 +80,7 @@ TEST(Test, Test) {
...
@@ -80,8 +80,7 @@ TEST(Test, Test) {
try
{
try
{
AssertFalse
();
AssertFalse
();
}
catch
(
const
testing
::
AssertionException
&
e
)
{
}
catch
(
const
testing
::
AssertionException
&
e
)
{
if
(
strstr
(
e
.
what
(),
"Expected failure"
)
!=
NULL
)
if
(
strstr
(
e
.
what
(),
"Expected failure"
)
!=
nullptr
)
throw
;
throw
;
printf
(
"%s"
,
printf
(
"%s"
,
"A failed assertion did throw an exception of the right type, "
"A failed assertion did throw an exception of the right type, "
...
...
googletest/test/gtest_premature_exit_test.cc
View file @
3149e0e8
...
@@ -56,7 +56,7 @@ class PrematureExitTest : public Test {
...
@@ -56,7 +56,7 @@ class PrematureExitTest : public Test {
premature_exit_file_path_
=
GetEnv
(
"TEST_PREMATURE_EXIT_FILE"
);
premature_exit_file_path_
=
GetEnv
(
"TEST_PREMATURE_EXIT_FILE"
);
// Normalize NULL to "" for ease of handling.
// Normalize NULL to "" for ease of handling.
if
(
premature_exit_file_path_
==
NULL
)
{
if
(
premature_exit_file_path_
==
nullptr
)
{
premature_exit_file_path_
=
""
;
premature_exit_file_path_
=
""
;
}
}
}
}
...
@@ -113,7 +113,7 @@ int main(int argc, char **argv) {
...
@@ -113,7 +113,7 @@ int main(int argc, char **argv) {
// Test that the premature-exit file is deleted upon return from
// Test that the premature-exit file is deleted upon return from
// RUN_ALL_TESTS().
// RUN_ALL_TESTS().
const
char
*
const
filepath
=
GetEnv
(
"TEST_PREMATURE_EXIT_FILE"
);
const
char
*
const
filepath
=
GetEnv
(
"TEST_PREMATURE_EXIT_FILE"
);
if
(
filepath
!=
NULL
&&
*
filepath
!=
'\0'
)
{
if
(
filepath
!=
nullptr
&&
*
filepath
!=
'\0'
)
{
if
(
PrematureExitTest
::
FileExists
(
filepath
))
{
if
(
PrematureExitTest
::
FileExists
(
filepath
))
{
printf
(
printf
(
"File %s shouldn't exist after the test program finishes, but does."
,
"File %s shouldn't exist after the test program finishes, but does."
,
...
...
googletest/test/gtest_stress_test.cc
View file @
3149e0e8
...
@@ -163,7 +163,7 @@ void FailingThread(bool is_fatal) {
...
@@ -163,7 +163,7 @@ void FailingThread(bool is_fatal) {
}
}
void
GenerateFatalFailureInAnotherThread
(
bool
is_fatal
)
{
void
GenerateFatalFailureInAnotherThread
(
bool
is_fatal
)
{
ThreadWithParam
<
bool
>
thread
(
&
FailingThread
,
is_fatal
,
NULL
);
ThreadWithParam
<
bool
>
thread
(
&
FailingThread
,
is_fatal
,
nullptr
);
thread
.
Join
();
thread
.
Join
();
}
}
...
...
googletest/test/gtest_throw_on_failure_ex_test.cc
View file @
3149e0e8
...
@@ -63,8 +63,7 @@ void TestFailureThrowsRuntimeError() {
...
@@ -63,8 +63,7 @@ void TestFailureThrowsRuntimeError() {
try
{
try
{
EXPECT_EQ
(
2
,
3
)
<<
"Expected failure"
;
EXPECT_EQ
(
2
,
3
)
<<
"Expected failure"
;
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
if
(
strstr
(
e
.
what
(),
"Expected failure"
)
!=
NULL
)
if
(
strstr
(
e
.
what
(),
"Expected failure"
)
!=
nullptr
)
return
;
return
;
printf
(
"%s"
,
printf
(
"%s"
,
"A failed assertion did throw an exception of the right type, "
"A failed assertion did throw an exception of the right type, "
...
...
googletest/test/gtest_unittest.cc
View file @
3149e0e8
This diff is collapsed.
Click to expand it.
Prev
1
2
3
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