Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
88e0df62
Commit
88e0df62
authored
Sep 08, 2010
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes all uses of StrStream; fixes the VC projects and simplifies them by using gtest-all.cc.
parent
35c39756
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
332 deletions
+34
-332
gtest-message.h
include/gtest/gtest-message.h
+12
-13
gtest.h
include/gtest/gtest.h
+4
-4
gtest-port.h
include/gtest/internal/gtest-port.h
+0
-2
gtest-string.h
include/gtest/internal/gtest-string.h
+2
-2
gtest-md.vcproj
msvc/gtest-md.vcproj
+1
-112
gtest.vcproj
msvc/gtest.vcproj
+1
-112
gtest_main-md.vcproj
msvc/gtest_main-md.vcproj
+0
-36
gtest_main.vcproj
msvc/gtest_main.vcproj
+0
-36
gtest.cc
src/gtest.cc
+12
-12
gtest-message_test.cc
test/gtest-message_test.cc
+2
-3
No files found.
include/gtest/gtest-message.h
View file @
88e0df62
...
@@ -58,7 +58,7 @@ namespace testing {
...
@@ -58,7 +58,7 @@ namespace testing {
// Typical usage:
// Typical usage:
//
//
// 1. You stream a bunch of values to a Message object.
// 1. You stream a bunch of values to a Message object.
// It will remember the text in a
StrS
tream.
// It will remember the text in a
strings
tream.
// 2. Then you stream the Message object to an ostream.
// 2. Then you stream the Message object to an ostream.
// This causes the text in the Message to be streamed
// This causes the text in the Message to be streamed
// to the ostream.
// to the ostream.
...
@@ -74,7 +74,7 @@ namespace testing {
...
@@ -74,7 +74,7 @@ namespace testing {
// Message is not intended to be inherited from. In particular, its
// Message is not intended to be inherited from. In particular, its
// destructor is not virtual.
// destructor is not virtual.
//
//
// Note that
StrS
tream behaves differently in gcc and in MSVC. You
// Note that
strings
tream behaves differently in gcc and in MSVC. You
// can stream a NULL char pointer to it in the former, but not in the
// can stream a NULL char pointer to it in the former, but not in the
// latter (it causes an access violation if you do). The Message
// latter (it causes an access violation if you do). The Message
// class hides this difference by treating a NULL char pointer as
// class hides this difference by treating a NULL char pointer as
...
@@ -87,27 +87,26 @@ class GTEST_API_ Message {
...
@@ -87,27 +87,26 @@ class GTEST_API_ Message {
public
:
public
:
// Constructs an empty Message.
// Constructs an empty Message.
// We allocate the
StrStream separately because it
otherwise each use of
// We allocate the
stringstream separately because
otherwise each use of
// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
// stack frame leading to huge stack frames in some cases; gcc does not reuse
// stack frame leading to huge stack frames in some cases; gcc does not reuse
// the stack space.
// the stack space.
Message
()
:
ss_
(
new
internal
::
StrS
tream
)
{
Message
()
:
ss_
(
new
::
std
::
strings
tream
)
{
// By default, we want there to be enough precision when printing
// By default, we want there to be enough precision when printing
// a double to a Message.
// a double to a Message.
*
ss_
<<
std
::
setprecision
(
std
::
numeric_limits
<
double
>::
digits10
+
2
);
*
ss_
<<
std
::
setprecision
(
std
::
numeric_limits
<
double
>::
digits10
+
2
);
}
}
// Copy constructor.
// Copy constructor.
Message
(
const
Message
&
msg
)
:
ss_
(
new
internal
::
StrS
tream
)
{
// NOLINT
Message
(
const
Message
&
msg
)
:
ss_
(
new
::
std
::
strings
tream
)
{
// NOLINT
*
ss_
<<
msg
.
GetString
();
*
ss_
<<
msg
.
GetString
();
}
}
// Constructs a Message from a C-string.
// Constructs a Message from a C-string.
explicit
Message
(
const
char
*
str
)
:
ss_
(
new
internal
::
StrS
tream
)
{
explicit
Message
(
const
char
*
str
)
:
ss_
(
new
::
std
::
strings
tream
)
{
*
ss_
<<
str
;
*
ss_
<<
str
;
}
}
~
Message
()
{
delete
ss_
;
}
#if GTEST_OS_SYMBIAN
#if GTEST_OS_SYMBIAN
// Streams a value (either a pointer or not) to this object.
// Streams a value (either a pointer or not) to this object.
template
<
typename
T
>
template
<
typename
T
>
...
@@ -119,7 +118,7 @@ class GTEST_API_ Message {
...
@@ -119,7 +118,7 @@ class GTEST_API_ Message {
// Streams a non-pointer value to this object.
// Streams a non-pointer value to this object.
template
<
typename
T
>
template
<
typename
T
>
inline
Message
&
operator
<<
(
const
T
&
val
)
{
inline
Message
&
operator
<<
(
const
T
&
val
)
{
::
GTestStreamToHelper
(
ss_
,
val
);
::
GTestStreamToHelper
(
ss_
.
get
()
,
val
);
return
*
this
;
return
*
this
;
}
}
...
@@ -141,7 +140,7 @@ class GTEST_API_ Message {
...
@@ -141,7 +140,7 @@ class GTEST_API_ Message {
if
(
pointer
==
NULL
)
{
if
(
pointer
==
NULL
)
{
*
ss_
<<
"(null)"
;
*
ss_
<<
"(null)"
;
}
else
{
}
else
{
::
GTestStreamToHelper
(
ss_
,
pointer
);
::
GTestStreamToHelper
(
ss_
.
get
()
,
pointer
);
}
}
return
*
this
;
return
*
this
;
}
}
...
@@ -189,7 +188,7 @@ class GTEST_API_ Message {
...
@@ -189,7 +188,7 @@ class GTEST_API_ Message {
//
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
internal
::
String
GetString
()
const
{
internal
::
String
GetString
()
const
{
return
internal
::
Str
StreamToString
(
ss_
);
return
internal
::
Str
ingStreamToString
(
ss_
.
get
()
);
}
}
private
:
private
:
...
@@ -203,17 +202,17 @@ class GTEST_API_ Message {
...
@@ -203,17 +202,17 @@ class GTEST_API_ Message {
if
(
pointer
==
NULL
)
{
if
(
pointer
==
NULL
)
{
*
ss_
<<
"(null)"
;
*
ss_
<<
"(null)"
;
}
else
{
}
else
{
::
GTestStreamToHelper
(
ss_
,
pointer
);
::
GTestStreamToHelper
(
ss_
.
get
()
,
pointer
);
}
}
}
}
template
<
typename
T
>
template
<
typename
T
>
inline
void
StreamHelper
(
internal
::
false_type
/*dummy*/
,
const
T
&
value
)
{
inline
void
StreamHelper
(
internal
::
false_type
/*dummy*/
,
const
T
&
value
)
{
::
GTestStreamToHelper
(
ss_
,
value
);
::
GTestStreamToHelper
(
ss_
.
get
()
,
value
);
}
}
#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.
internal
::
StrStream
*
const
ss_
;
const
internal
::
scoped_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.
...
...
include/gtest/gtest.h
View file @
88e0df62
...
@@ -1517,18 +1517,18 @@ AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
...
@@ -1517,18 +1517,18 @@ AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
return
AssertionSuccess
();
return
AssertionSuccess
();
}
}
StrS
tream
expected_ss
;
::
std
::
strings
tream
expected_ss
;
expected_ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
RawType
>::
digits10
+
2
)
expected_ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
RawType
>::
digits10
+
2
)
<<
expected
;
<<
expected
;
StrS
tream
actual_ss
;
::
std
::
strings
tream
actual_ss
;
actual_ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
RawType
>::
digits10
+
2
)
actual_ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
RawType
>::
digits10
+
2
)
<<
actual
;
<<
actual
;
return
EqFailure
(
expected_expression
,
return
EqFailure
(
expected_expression
,
actual_expression
,
actual_expression
,
StrStreamToString
(
&
expected_ss
),
Str
ing
StreamToString
(
&
expected_ss
),
StrStreamToString
(
&
actual_ss
),
Str
ing
StreamToString
(
&
actual_ss
),
false
);
false
);
}
}
...
...
include/gtest/internal/gtest-port.h
View file @
88e0df62
...
@@ -732,8 +732,6 @@ typedef ::wstring wstring;
...
@@ -732,8 +732,6 @@ typedef ::wstring wstring;
typedef
::
std
::
wstring
wstring
;
typedef
::
std
::
wstring
wstring
;
#endif // GTEST_HAS_GLOBAL_WSTRING
#endif // GTEST_HAS_GLOBAL_WSTRING
typedef
::
std
::
stringstream
StrStream
;
// A helper for suppressing warnings on constant condition. It just
// A helper for suppressing warnings on constant condition. It just
// returns 'condition'.
// returns 'condition'.
GTEST_API_
bool
IsTrue
(
bool
condition
);
GTEST_API_
bool
IsTrue
(
bool
condition
);
...
...
include/gtest/internal/gtest-string.h
View file @
88e0df62
...
@@ -329,9 +329,9 @@ inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
...
@@ -329,9 +329,9 @@ inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
return
os
;
return
os
;
}
}
// Gets the content of the
StrS
tream's buffer as a String. Each '\0'
// Gets the content of the
strings
tream's buffer as a String. Each '\0'
// character in the buffer is replaced with "\\0".
// character in the buffer is replaced with "\\0".
GTEST_API_
String
Str
StreamToString
(
StrS
tream
*
stream
);
GTEST_API_
String
Str
ingStreamToString
(
::
std
::
strings
tream
*
stream
);
// Converts a streamable value to a String. A NULL pointer is
// Converts a streamable value to a String. A NULL pointer is
// converted to "(null)". When the input value is a ::string,
// converted to "(null)". When the input value is a ::string,
...
...
msvc/gtest-md.vcproj
View file @
88e0df62
...
@@ -100,82 +100,7 @@
...
@@ -100,82 +100,7 @@
Filter=
"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
Filter=
"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
<File
RelativePath=
"..\src\gtest-death-test.cc"
>
RelativePath=
"..\src\gtest-all.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest-filepath.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest-port.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest-test-part.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest-typed-test.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest.cc"
>
<FileConfiguration
<FileConfiguration
Name=
"Debug|Win32"
>
Name=
"Debug|Win32"
>
<Tool
<Tool
...
@@ -194,42 +119,6 @@
...
@@ -194,42 +119,6 @@
Name=
"Header Files"
Name=
"Header Files"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
"..\include\gtest\internal\gtest-death-test-internal.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-death-test.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-filepath.h"
>
</File>
<File
RelativePath=
"..\src\gtest-internal-inl.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-internal.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-message.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-port.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-spi.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-string.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest_pred_impl.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest_prod.h"
>
</File>
</Filter>
</Filter>
</Files>
</Files>
<Globals>
<Globals>
...
...
msvc/gtest.vcproj
View file @
88e0df62
...
@@ -100,82 +100,7 @@
...
@@ -100,82 +100,7 @@
Filter=
"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
Filter=
"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
<File
RelativePath=
"..\src\gtest-death-test.cc"
>
RelativePath=
"..\src\gtest-all.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest-filepath.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest-test-part.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest-port.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest-typed-test.cc"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
""..";"..\include""
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\src\gtest.cc"
>
<FileConfiguration
<FileConfiguration
Name=
"Debug|Win32"
>
Name=
"Debug|Win32"
>
<Tool
<Tool
...
@@ -194,42 +119,6 @@
...
@@ -194,42 +119,6 @@
Name=
"Header Files"
Name=
"Header Files"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
"..\include\gtest\internal\gtest-death-test-internal.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-death-test.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-filepath.h"
>
</File>
<File
RelativePath=
"..\src\gtest-internal-inl.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-internal.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-message.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-port.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-spi.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-string.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest_pred_impl.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest_prod.h"
>
</File>
</Filter>
</Filter>
</Files>
</Files>
<Globals>
<Globals>
...
...
msvc/gtest_main-md.vcproj
View file @
88e0df62
...
@@ -122,42 +122,6 @@
...
@@ -122,42 +122,6 @@
Name=
"Header Files"
Name=
"Header Files"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
"..\include\gtest\internal\gtest-death-test-internal.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-death-test.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-filepath.h"
>
</File>
<File
RelativePath=
"..\src\gtest-internal-inl.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-internal.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-message.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-port.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-spi.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-string.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest_pred_impl.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest_prod.h"
>
</File>
</Filter>
</Filter>
</Files>
</Files>
<Globals>
<Globals>
...
...
msvc/gtest_main.vcproj
View file @
88e0df62
...
@@ -122,42 +122,6 @@
...
@@ -122,42 +122,6 @@
Name=
"Header Files"
Name=
"Header Files"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
"..\include\gtest\internal\gtest-death-test-internal.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-death-test.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-filepath.h"
>
</File>
<File
RelativePath=
"..\src\gtest-internal-inl.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-internal.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-message.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-port.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest-spi.h"
>
</File>
<File
RelativePath=
"..\include\gtest\internal\gtest-string.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest_pred_impl.h"
>
</File>
<File
RelativePath=
"..\include\gtest\gtest_prod.h"
>
</File>
</Filter>
</Filter>
</Files>
</Files>
<Globals>
<Globals>
...
...
src/gtest.cc
View file @
88e0df62
...
@@ -1072,18 +1072,18 @@ AssertionResult FloatingPointLE(const char* expr1,
...
@@ -1072,18 +1072,18 @@ AssertionResult FloatingPointLE(const char* expr1,
// val2 is NaN, as the IEEE floating-point standard requires that
// val2 is NaN, as the IEEE floating-point standard requires that
// any predicate involving a NaN must return false.
// any predicate involving a NaN must return false.
StrS
tream
val1_ss
;
::
std
::
strings
tream
val1_ss
;
val1_ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
RawType
>::
digits10
+
2
)
val1_ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
RawType
>::
digits10
+
2
)
<<
val1
;
<<
val1
;
StrS
tream
val2_ss
;
::
std
::
strings
tream
val2_ss
;
val2_ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
RawType
>::
digits10
+
2
)
val2_ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
RawType
>::
digits10
+
2
)
<<
val2
;
<<
val2
;
Message
msg
;
Message
msg
;
msg
<<
"Expected: ("
<<
expr1
<<
") <= ("
<<
expr2
<<
")
\n
"
msg
<<
"Expected: ("
<<
expr1
<<
") <= ("
<<
expr2
<<
")
\n
"
<<
" Actual: "
<<
StrStreamToString
(
&
val1_ss
)
<<
" vs "
<<
" Actual: "
<<
Str
ing
StreamToString
(
&
val1_ss
)
<<
" vs "
<<
StrStreamToString
(
&
val2_ss
);
<<
Str
ing
StreamToString
(
&
val2_ss
);
return
AssertionFailure
(
msg
);
return
AssertionFailure
(
msg
);
}
}
...
@@ -1508,7 +1508,7 @@ String WideStringToUtf8(const wchar_t* str, int num_chars) {
...
@@ -1508,7 +1508,7 @@ String WideStringToUtf8(const wchar_t* str, int num_chars) {
if
(
num_chars
==
-
1
)
if
(
num_chars
==
-
1
)
num_chars
=
static_cast
<
int
>
(
wcslen
(
str
));
num_chars
=
static_cast
<
int
>
(
wcslen
(
str
));
StrS
tream
stream
;
::
std
::
strings
tream
stream
;
for
(
int
i
=
0
;
i
<
num_chars
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_chars
;
++
i
)
{
UInt32
unicode_code_point
;
UInt32
unicode_code_point
;
...
@@ -1525,7 +1525,7 @@ String WideStringToUtf8(const wchar_t* str, int num_chars) {
...
@@ -1525,7 +1525,7 @@ String WideStringToUtf8(const wchar_t* str, int num_chars) {
char
buffer
[
32
];
// CodePointToUtf8 requires a buffer this big.
char
buffer
[
32
];
// CodePointToUtf8 requires a buffer this big.
stream
<<
CodePointToUtf8
(
unicode_code_point
,
buffer
);
stream
<<
CodePointToUtf8
(
unicode_code_point
,
buffer
);
}
}
return
StrStreamToString
(
&
stream
);
return
Str
ing
StreamToString
(
&
stream
);
}
}
// Converts a wide C string to a String using the UTF-8 encoding.
// Converts a wide C string to a String using the UTF-8 encoding.
...
@@ -1733,16 +1733,16 @@ String String::Format(const char * format, ...) {
...
@@ -1733,16 +1733,16 @@ String String::Format(const char * format, ...) {
}
}
}
}
// Converts the buffer in a
StrS
tream to a String, converting NUL
// Converts the buffer in a
strings
tream to a String, converting NUL
// bytes to "\\0" along the way.
// bytes to "\\0" along the way.
String
Str
StreamToString
(
StrS
tream
*
ss
)
{
String
Str
ingStreamToString
(
::
std
::
strings
tream
*
ss
)
{
const
::
std
::
string
&
str
=
ss
->
str
();
const
::
std
::
string
&
str
=
ss
->
str
();
const
char
*
const
start
=
str
.
c_str
();
const
char
*
const
start
=
str
.
c_str
();
const
char
*
const
end
=
start
+
str
.
length
();
const
char
*
const
end
=
start
+
str
.
length
();
// We need to use a helper
StrS
tream to do this transformation
// We need to use a helper
strings
tream to do this transformation
// because String doesn't support push_back().
// because String doesn't support push_back().
StrS
tream
helper
;
::
std
::
strings
tream
helper
;
for
(
const
char
*
ch
=
start
;
ch
!=
end
;
++
ch
)
{
for
(
const
char
*
ch
=
start
;
ch
!=
end
;
++
ch
)
{
if
(
*
ch
==
'\0'
)
{
if
(
*
ch
==
'\0'
)
{
helper
<<
"
\\
0"
;
// Replaces NUL with "\\0";
helper
<<
"
\\
0"
;
// Replaces NUL with "\\0";
...
@@ -3262,9 +3262,9 @@ void XmlUnitTestResultPrinter::PrintXmlTestCase(FILE* out,
...
@@ -3262,9 +3262,9 @@ void XmlUnitTestResultPrinter::PrintXmlTestCase(FILE* out,
"errors=
\"
0
\"
time=
\"
%s
\"
>
\n
"
,
"errors=
\"
0
\"
time=
\"
%s
\"
>
\n
"
,
FormatTimeInMillisAsSeconds
(
test_case
.
elapsed_time
()).
c_str
());
FormatTimeInMillisAsSeconds
(
test_case
.
elapsed_time
()).
c_str
());
for
(
int
i
=
0
;
i
<
test_case
.
total_test_count
();
++
i
)
{
for
(
int
i
=
0
;
i
<
test_case
.
total_test_count
();
++
i
)
{
StrS
tream
stream
;
::
std
::
strings
tream
stream
;
OutputXmlTestInfo
(
&
stream
,
test_case
.
name
(),
*
test_case
.
GetTestInfo
(
i
));
OutputXmlTestInfo
(
&
stream
,
test_case
.
name
(),
*
test_case
.
GetTestInfo
(
i
));
fprintf
(
out
,
"%s"
,
StrStreamToString
(
&
stream
).
c_str
());
fprintf
(
out
,
"%s"
,
Str
ing
StreamToString
(
&
stream
).
c_str
());
}
}
fprintf
(
out
,
" </testsuite>
\n
"
);
fprintf
(
out
,
" </testsuite>
\n
"
);
}
}
...
...
test/gtest-message_test.cc
View file @
88e0df62
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
namespace
{
namespace
{
using
::
testing
::
Message
;
using
::
testing
::
Message
;
using
::
testing
::
internal
::
StrStream
;
// A helper function that turns a Message into a C string.
// A helper function that turns a Message into a C string.
const
char
*
ToCString
(
const
Message
&
msg
)
{
const
char
*
ToCString
(
const
Message
&
msg
)
{
...
@@ -154,9 +153,9 @@ TEST(MessageTest, GetString) {
...
@@ -154,9 +153,9 @@ TEST(MessageTest, GetString) {
// Tests streaming a Message object to an ostream.
// Tests streaming a Message object to an ostream.
TEST
(
MessageTest
,
StreamsToOStream
)
{
TEST
(
MessageTest
,
StreamsToOStream
)
{
Message
msg
(
"Hello"
);
Message
msg
(
"Hello"
);
StrS
tream
ss
;
::
std
::
strings
tream
ss
;
ss
<<
msg
;
ss
<<
msg
;
EXPECT_STREQ
(
"Hello"
,
testing
::
internal
::
StrStreamToString
(
&
ss
).
c_str
());
EXPECT_STREQ
(
"Hello"
,
testing
::
internal
::
Str
ing
StreamToString
(
&
ss
).
c_str
());
}
}
// Tests that a Message object doesn't take up too much stack space.
// Tests that a Message object doesn't take up too much stack space.
...
...
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