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
c18438ca
Commit
c18438ca
authored
Oct 11, 2010
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makes gtest wokr on MinGW (by Vlad Losev); removes unused linked_ptr::release()…
Makes gtest wokr on MinGW (by Vlad Losev); removes unused linked_ptr::release() method (by Zhanyong Wan).
parent
9c482422
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
58 deletions
+65
-58
gtest-linked_ptr.h
include/gtest/internal/gtest-linked_ptr.h
+0
-9
gtest-death-test.cc
src/gtest-death-test.cc
+8
-8
gtest-death-test_test.cc
test/gtest-death-test_test.cc
+1
-1
gtest-printers_test.cc
test/gtest-printers_test.cc
+10
-11
gtest_unittest.cc
test/gtest_unittest.cc
+46
-29
No files found.
include/gtest/internal/gtest-linked_ptr.h
View file @
c18438ca
...
@@ -172,15 +172,6 @@ class linked_ptr {
...
@@ -172,15 +172,6 @@ class linked_ptr {
T
*
get
()
const
{
return
value_
;
}
T
*
get
()
const
{
return
value_
;
}
T
*
operator
->
()
const
{
return
value_
;
}
T
*
operator
->
()
const
{
return
value_
;
}
T
&
operator
*
()
const
{
return
*
value_
;
}
T
&
operator
*
()
const
{
return
*
value_
;
}
// Release ownership of the pointed object and returns it.
// Sole ownership by this linked_ptr object is required.
T
*
release
()
{
bool
last
=
link_
.
depart
();
assert
(
last
);
T
*
v
=
value_
;
value_
=
NULL
;
return
v
;
}
bool
operator
==
(
T
*
p
)
const
{
return
value_
==
p
;
}
bool
operator
==
(
T
*
p
)
const
{
return
value_
==
p
;
}
bool
operator
!=
(
T
*
p
)
const
{
return
value_
!=
p
;
}
bool
operator
!=
(
T
*
p
)
const
{
return
value_
!=
p
;
}
...
...
src/gtest-death-test.cc
View file @
c18438ca
...
@@ -526,11 +526,11 @@ bool DeathTestImpl::Passed(bool status_ok) {
...
@@ -526,11 +526,11 @@ bool DeathTestImpl::Passed(bool status_ok) {
//
//
class
WindowsDeathTest
:
public
DeathTestImpl
{
class
WindowsDeathTest
:
public
DeathTestImpl
{
public
:
public
:
WindowsDeathTest
(
const
char
*
statement
,
WindowsDeathTest
(
const
char
*
a_
statement
,
const
RE
*
regex
,
const
RE
*
a_
regex
,
const
char
*
file
,
const
char
*
file
,
int
line
)
int
line
)
:
DeathTestImpl
(
statement
,
regex
),
file_
(
file
),
line_
(
line
)
{}
:
DeathTestImpl
(
a_statement
,
a_
regex
),
file_
(
file
),
line_
(
line
)
{}
// All of these virtual functions are inherited from DeathTest.
// All of these virtual functions are inherited from DeathTest.
virtual
int
Wait
();
virtual
int
Wait
();
...
@@ -587,12 +587,12 @@ int WindowsDeathTest::Wait() {
...
@@ -587,12 +587,12 @@ int WindowsDeathTest::Wait() {
GTEST_DEATH_TEST_CHECK_
(
GTEST_DEATH_TEST_CHECK_
(
WAIT_OBJECT_0
==
::
WaitForSingleObject
(
child_handle_
.
Get
(),
WAIT_OBJECT_0
==
::
WaitForSingleObject
(
child_handle_
.
Get
(),
INFINITE
));
INFINITE
));
DWORD
status
;
DWORD
status
_code
;
GTEST_DEATH_TEST_CHECK_
(
::
GetExitCodeProcess
(
child_handle_
.
Get
(),
&
status
)
GTEST_DEATH_TEST_CHECK_
(
!=
FALSE
);
::
GetExitCodeProcess
(
child_handle_
.
Get
(),
&
status_code
)
!=
FALSE
);
child_handle_
.
Reset
();
child_handle_
.
Reset
();
set_status
(
static_cast
<
int
>
(
status
));
set_status
(
static_cast
<
int
>
(
status
_code
));
return
this
->
status
();
return
status
();
}
}
// The AssumeRole process for a Windows death test. It creates a child
// The AssumeRole process for a Windows death test. It creates a child
...
...
test/gtest-death-test_test.cc
View file @
c18438ca
...
@@ -994,7 +994,7 @@ TEST(AutoHandleTest, AutoHandleWorks) {
...
@@ -994,7 +994,7 @@ TEST(AutoHandleTest, AutoHandleWorks) {
typedef
unsigned
__int64
BiggestParsable
;
typedef
unsigned
__int64
BiggestParsable
;
typedef
signed
__int64
BiggestSignedParsable
;
typedef
signed
__int64
BiggestSignedParsable
;
const
BiggestParsable
kBiggestParsableMax
=
ULLONG_MAX
;
const
BiggestParsable
kBiggestParsableMax
=
ULLONG_MAX
;
const
BiggestParsable
kBiggestSignedParsableMax
=
LLONG_MAX
;
const
Biggest
Signed
Parsable
kBiggestSignedParsableMax
=
LLONG_MAX
;
#else
#else
typedef
unsigned
long
long
BiggestParsable
;
typedef
unsigned
long
long
BiggestParsable
;
typedef
signed
long
long
BiggestSignedParsable
;
typedef
signed
long
long
BiggestSignedParsable
;
...
...
test/gtest-printers_test.cc
View file @
c18438ca
...
@@ -50,8 +50,8 @@
...
@@ -50,8 +50,8 @@
#include "gtest/gtest.h"
#include "gtest/gtest.h"
// hash_map and hash_set are available
on Windows
.
// hash_map and hash_set are available
under Visual C++
.
#if
GTEST_OS_WINDOWS
#if
_MSC_VER
#define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
#define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
#include <hash_map> // NOLINT
#include <hash_map> // NOLINT
#define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
#define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
...
@@ -212,17 +212,15 @@ using ::std::tr1::make_tuple;
...
@@ -212,17 +212,15 @@ using ::std::tr1::make_tuple;
using
::
std
::
tr1
::
tuple
;
using
::
std
::
tr1
::
tuple
;
#endif
#endif
#if
GTEST_OS_WINDOWS
#if
_MSC_VER
// MSVC defines the following classes in the ::stdext namespace while
// MSVC defines the following classes in the ::stdext namespace while
// gcc defines them in the :: namespace. Note that they are not part
// gcc defines them in the :: namespace. Note that they are not part
// of the C++ standard.
// of the C++ standard.
using
::
stdext
::
hash_map
;
using
::
stdext
::
hash_map
;
using
::
stdext
::
hash_set
;
using
::
stdext
::
hash_set
;
using
::
stdext
::
hash_multimap
;
using
::
stdext
::
hash_multimap
;
using
::
stdext
::
hash_multiset
;
using
::
stdext
::
hash_multiset
;
#endif
#endif // GTEST_OS_WINDOWS
// Prints a value to a string using the universal value printer. This
// Prints a value to a string using the universal value printer. This
// is a helper for testing UniversalPrinter<T>::Print() for various types.
// is a helper for testing UniversalPrinter<T>::Print() for various types.
...
@@ -333,8 +331,8 @@ TEST(PrintBuiltInTypeTest, Wchar_t) {
...
@@ -333,8 +331,8 @@ TEST(PrintBuiltInTypeTest, Wchar_t) {
EXPECT_EQ
(
"L'
\\
xFF' (255)"
,
Print
(
L'\xFF'
));
EXPECT_EQ
(
"L'
\\
xFF' (255)"
,
Print
(
L'\xFF'
));
EXPECT_EQ
(
"L' ' (32, 0x20)"
,
Print
(
L' '
));
EXPECT_EQ
(
"L' ' (32, 0x20)"
,
Print
(
L' '
));
EXPECT_EQ
(
"L'a' (97, 0x61)"
,
Print
(
L'a'
));
EXPECT_EQ
(
"L'a' (97, 0x61)"
,
Print
(
L'a'
));
EXPECT_EQ
(
"L'
\\
x576' (1398)"
,
Print
(
L
'\
x576
'
));
EXPECT_EQ
(
"L'
\\
x576' (1398)"
,
Print
(
static_cast
<
wchar_t
>
(
0x576
)
));
EXPECT_EQ
(
"L'
\\
xC74D' (51021)"
,
Print
(
L
'\
xC74D
'
));
EXPECT_EQ
(
"L'
\\
xC74D' (51021)"
,
Print
(
static_cast
<
wchar_t
>
(
0xC74D
)
));
}
}
// Test that Int64 provides more storage than wchar_t.
// Test that Int64 provides more storage than wchar_t.
...
@@ -440,10 +438,11 @@ TEST(PrintWideCStringTest, Null) {
...
@@ -440,10 +438,11 @@ TEST(PrintWideCStringTest, Null) {
// Tests that wide C strings are escaped properly.
// Tests that wide C strings are escaped properly.
TEST
(
PrintWideCStringTest
,
EscapesProperly
)
{
TEST
(
PrintWideCStringTest
,
EscapesProperly
)
{
const
wchar_t
*
p
=
L"'
\"
\?
\\\a\b\f\n\r\t\v\xD3\x576\x8D3\xC74D
a"
;
const
wchar_t
s
[]
=
{
'\''
,
'"'
,
'\?'
,
'\\'
,
'\a'
,
'\b'
,
'\f'
,
'\n'
,
'\r'
,
EXPECT_EQ
(
PrintPointer
(
p
)
+
" pointing to L
\"
'
\\\"\\
?
\\\\\\
a
\\
b
\\
f"
'\t'
,
'\v'
,
0xD3
,
0x576
,
0x8D3
,
0xC74D
,
' '
,
'a'
,
'\0'
};
EXPECT_EQ
(
PrintPointer
(
s
)
+
" pointing to L
\"
'
\\\"\\
?
\\\\\\
a
\\
b
\\
f"
"
\\
n
\\
r
\\
t
\\
v
\\
xD3
\\
x576
\\
x8D3
\\
xC74D a
\"
"
,
"
\\
n
\\
r
\\
t
\\
v
\\
xD3
\\
x576
\\
x8D3
\\
xC74D a
\"
"
,
Print
(
p
));
Print
(
static_cast
<
const
wchar_t
*>
(
s
)
));
}
}
#endif // native wchar_t
#endif // native wchar_t
...
...
test/gtest_unittest.cc
View file @
c18438ca
...
@@ -372,7 +372,11 @@ TEST(CodePointToUtf8Test, CanEncode8To11Bits) {
...
@@ -372,7 +372,11 @@ TEST(CodePointToUtf8Test, CanEncode8To11Bits) {
EXPECT_STREQ
(
"
\xC3\x93
"
,
CodePointToUtf8
(
L'\xD3'
,
buffer
));
EXPECT_STREQ
(
"
\xC3\x93
"
,
CodePointToUtf8
(
L'\xD3'
,
buffer
));
// 101 0111 0110 => 110-10101 10-110110
// 101 0111 0110 => 110-10101 10-110110
EXPECT_STREQ
(
"
\xD5\xB6
"
,
CodePointToUtf8
(
L
'\
x576
'
,
buffer
));
// Some compilers (e.g., GCC on MinGW) cannot handle non-ASCII codepoints
// in wide strings and wide chars. In order to accomodate them, we have to
// introduce such character constants as integers.
EXPECT_STREQ
(
"
\xD5\xB6
"
,
CodePointToUtf8
(
static_cast
<
wchar_t
>
(
0x576
),
buffer
));
}
}
// Tests that Unicode code-points that have 12 to 16 bits are encoded
// Tests that Unicode code-points that have 12 to 16 bits are encoded
...
@@ -380,10 +384,12 @@ TEST(CodePointToUtf8Test, CanEncode8To11Bits) {
...
@@ -380,10 +384,12 @@ TEST(CodePointToUtf8Test, CanEncode8To11Bits) {
TEST
(
CodePointToUtf8Test
,
CanEncode12To16Bits
)
{
TEST
(
CodePointToUtf8Test
,
CanEncode12To16Bits
)
{
char
buffer
[
32
];
char
buffer
[
32
];
// 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011
// 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011
EXPECT_STREQ
(
"
\xE0\xA3\x93
"
,
CodePointToUtf8
(
L
'\
x8D3
'
,
buffer
));
EXPECT_STREQ
(
"
\xE0\xA3\x93
"
,
CodePointToUtf8
(
static_cast
<
wchar_t
>
(
0x8D3
),
buffer
));
// 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101
// 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101
EXPECT_STREQ
(
"
\xEC\x9D\x8D
"
,
CodePointToUtf8
(
L
'\
xC74D
'
,
buffer
));
EXPECT_STREQ
(
"
\xEC\x9D\x8D
"
,
CodePointToUtf8
(
static_cast
<
wchar_t
>
(
0xC74D
),
buffer
));
}
}
#if !GTEST_WIDE_STRING_USES_UTF16_
#if !GTEST_WIDE_STRING_USES_UTF16_
...
@@ -438,20 +444,23 @@ TEST(WideStringToUtf8Test, CanEncode8To11Bits) {
...
@@ -438,20 +444,23 @@ TEST(WideStringToUtf8Test, CanEncode8To11Bits) {
EXPECT_STREQ
(
"
\xC3\x93
"
,
WideStringToUtf8
(
L"
\xD3
"
,
-
1
).
c_str
());
EXPECT_STREQ
(
"
\xC3\x93
"
,
WideStringToUtf8
(
L"
\xD3
"
,
-
1
).
c_str
());
// 101 0111 0110 => 110-10101 10-110110
// 101 0111 0110 => 110-10101 10-110110
EXPECT_STREQ
(
"
\xD5\xB6
"
,
WideStringToUtf8
(
L"
\x576
"
,
1
).
c_str
());
const
wchar_t
s
[]
=
{
0x576
,
'\0'
};
EXPECT_STREQ
(
"
\xD5\xB6
"
,
WideStringToUtf8
(
L"
\x576
"
,
-
1
).
c_str
());
EXPECT_STREQ
(
"
\xD5\xB6
"
,
WideStringToUtf8
(
s
,
1
).
c_str
());
EXPECT_STREQ
(
"
\xD5\xB6
"
,
WideStringToUtf8
(
s
,
-
1
).
c_str
());
}
}
// Tests that Unicode code-points that have 12 to 16 bits are encoded
// Tests that Unicode code-points that have 12 to 16 bits are encoded
// as 1110xxxx 10xxxxxx 10xxxxxx.
// as 1110xxxx 10xxxxxx 10xxxxxx.
TEST
(
WideStringToUtf8Test
,
CanEncode12To16Bits
)
{
TEST
(
WideStringToUtf8Test
,
CanEncode12To16Bits
)
{
// 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011
// 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011
EXPECT_STREQ
(
"
\xE0\xA3\x93
"
,
WideStringToUtf8
(
L"
\x8D3
"
,
1
).
c_str
());
const
wchar_t
s1
[]
=
{
0x8D3
,
'\0'
};
EXPECT_STREQ
(
"
\xE0\xA3\x93
"
,
WideStringToUtf8
(
L"
\x8D3
"
,
-
1
).
c_str
());
EXPECT_STREQ
(
"
\xE0\xA3\x93
"
,
WideStringToUtf8
(
s1
,
1
).
c_str
());
EXPECT_STREQ
(
"
\xE0\xA3\x93
"
,
WideStringToUtf8
(
s1
,
-
1
).
c_str
());
// 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101
// 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101
EXPECT_STREQ
(
"
\xEC\x9D\x8D
"
,
WideStringToUtf8
(
L"
\xC74D
"
,
1
).
c_str
());
const
wchar_t
s2
[]
=
{
0xC74D
,
'\0'
};
EXPECT_STREQ
(
"
\xEC\x9D\x8D
"
,
WideStringToUtf8
(
L"
\xC74D
"
,
-
1
).
c_str
());
EXPECT_STREQ
(
"
\xEC\x9D\x8D
"
,
WideStringToUtf8
(
s2
,
1
).
c_str
());
EXPECT_STREQ
(
"
\xEC\x9D\x8D
"
,
WideStringToUtf8
(
s2
,
-
1
).
c_str
());
}
}
// Tests that the conversion stops when the function encounters \0 character.
// Tests that the conversion stops when the function encounters \0 character.
...
@@ -465,7 +474,6 @@ TEST(WideStringToUtf8Test, StopsWhenLengthLimitReached) {
...
@@ -465,7 +474,6 @@ TEST(WideStringToUtf8Test, StopsWhenLengthLimitReached) {
EXPECT_STREQ
(
"ABC"
,
WideStringToUtf8
(
L"ABCDEF"
,
3
).
c_str
());
EXPECT_STREQ
(
"ABC"
,
WideStringToUtf8
(
L"ABCDEF"
,
3
).
c_str
());
}
}
#if !GTEST_WIDE_STRING_USES_UTF16_
#if !GTEST_WIDE_STRING_USES_UTF16_
// Tests that Unicode code-points that have 17 to 21 bits are encoded
// Tests that Unicode code-points that have 17 to 21 bits are encoded
// as 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. This code may not compile
// as 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. This code may not compile
...
@@ -489,25 +497,29 @@ TEST(WideStringToUtf8Test, CanEncodeInvalidCodePoint) {
...
@@ -489,25 +497,29 @@ TEST(WideStringToUtf8Test, CanEncodeInvalidCodePoint) {
// Tests that surrogate pairs are encoded correctly on the systems using
// Tests that surrogate pairs are encoded correctly on the systems using
// UTF-16 encoding in the wide strings.
// UTF-16 encoding in the wide strings.
TEST
(
WideStringToUtf8Test
,
CanEncodeValidUtf16SUrrogatePairs
)
{
TEST
(
WideStringToUtf8Test
,
CanEncodeValidUtf16SUrrogatePairs
)
{
EXPECT_STREQ
(
"
\xF0\x90\x90\x80
"
,
const
wchar_t
s
[]
=
{
0xD801
,
0xDC00
,
'\0'
};
WideStringToUtf8
(
L"
\xD801\xDC00
"
,
-
1
).
c_str
());
EXPECT_STREQ
(
"
\xF0\x90\x90\x80
"
,
WideStringToUtf8
(
s
,
-
1
).
c_str
());
}
}
// Tests that encoding an invalid UTF-16 surrogate pair
// Tests that encoding an invalid UTF-16 surrogate pair
// generates the expected result.
// generates the expected result.
TEST
(
WideStringToUtf8Test
,
CanEncodeInvalidUtf16SurrogatePair
)
{
TEST
(
WideStringToUtf8Test
,
CanEncodeInvalidUtf16SurrogatePair
)
{
// Leading surrogate is at the end of the string.
// Leading surrogate is at the end of the string.
EXPECT_STREQ
(
"
\xED\xA0\x80
"
,
WideStringToUtf8
(
L"
\xD800
"
,
-
1
).
c_str
());
const
wchar_t
s1
[]
=
{
0xD800
,
'\0'
};
EXPECT_STREQ
(
"
\xED\xA0\x80
"
,
WideStringToUtf8
(
s1
,
-
1
).
c_str
());
// Leading surrogate is not followed by the trailing surrogate.
// Leading surrogate is not followed by the trailing surrogate.
EXPECT_STREQ
(
"
\xED\xA0\x80
$"
,
WideStringToUtf8
(
L"
\xD800
$"
,
-
1
).
c_str
());
const
wchar_t
s2
[]
=
{
0xD800
,
'M'
,
'\0'
};
EXPECT_STREQ
(
"
\xED\xA0\x80
M"
,
WideStringToUtf8
(
s2
,
-
1
).
c_str
());
// Trailing surrogate appearas without a leading surrogate.
// Trailing surrogate appearas without a leading surrogate.
EXPECT_STREQ
(
"
\xED\xB0\x80
PQR"
,
WideStringToUtf8
(
L"
\xDC00
PQR"
,
-
1
).
c_str
());
const
wchar_t
s3
[]
=
{
0xDC00
,
'P'
,
'Q'
,
'R'
,
'\0'
};
EXPECT_STREQ
(
"
\xED\xB0\x80
PQR"
,
WideStringToUtf8
(
s3
,
-
1
).
c_str
());
}
}
#endif // !GTEST_WIDE_STRING_USES_UTF16_
#endif // !GTEST_WIDE_STRING_USES_UTF16_
// Tests that codepoint concatenation works correctly.
// Tests that codepoint concatenation works correctly.
#if !GTEST_WIDE_STRING_USES_UTF16_
#if !GTEST_WIDE_STRING_USES_UTF16_
TEST
(
WideStringToUtf8Test
,
ConcatenatesCodepointsCorrectly
)
{
TEST
(
WideStringToUtf8Test
,
ConcatenatesCodepointsCorrectly
)
{
const
wchar_t
s
[]
=
{
0x108634
,
0xC74D
,
'\n'
,
0x576
,
0x8D3
,
0x108634
,
'\0'
};
EXPECT_STREQ
(
EXPECT_STREQ
(
"
\xF4\x88\x98\xB4
"
"
\xF4\x88\x98\xB4
"
"
\xEC\x9D\x8D
"
"
\xEC\x9D\x8D
"
...
@@ -515,13 +527,14 @@ TEST(WideStringToUtf8Test, ConcatenatesCodepointsCorrectly) {
...
@@ -515,13 +527,14 @@ TEST(WideStringToUtf8Test, ConcatenatesCodepointsCorrectly) {
"
\xD5\xB6
"
"
\xD5\xB6
"
"
\xE0\xA3\x93
"
"
\xE0\xA3\x93
"
"
\xF4\x88\x98\xB4
"
,
"
\xF4\x88\x98\xB4
"
,
WideStringToUtf8
(
L"
\x1086
34
\xC74D\n\x576\x8D3\x1086
34"
,
-
1
).
c_str
());
WideStringToUtf8
(
s
,
-
1
).
c_str
());
}
}
#else
#else
TEST
(
WideStringToUtf8Test
,
ConcatenatesCodepointsCorrectly
)
{
TEST
(
WideStringToUtf8Test
,
ConcatenatesCodepointsCorrectly
)
{
const
wchar_t
s
[]
=
{
0xC74D
,
'\n'
,
0x576
,
0x8D3
,
'\0'
};
EXPECT_STREQ
(
EXPECT_STREQ
(
"
\xEC\x9D\x8D
"
"
\n
"
"
\xD5\xB6
"
"
\xE0\xA3\x93
"
,
"
\xEC\x9D\x8D
"
"
\n
"
"
\xD5\xB6
"
"
\xE0\xA3\x93
"
,
WideStringToUtf8
(
L"
\xC74D\n\x576\x8D3
"
,
-
1
).
c_str
());
WideStringToUtf8
(
s
,
-
1
).
c_str
());
}
}
#endif // !GTEST_WIDE_STRING_USES_UTF16_
#endif // !GTEST_WIDE_STRING_USES_UTF16_
...
@@ -4519,8 +4532,8 @@ TEST(EqAssertionTest, WideChar) {
...
@@ -4519,8 +4532,8 @@ TEST(EqAssertionTest, WideChar) {
wchar
=
L'b'
;
wchar
=
L'b'
;
EXPECT_NONFATAL_FAILURE
(
EXPECT_EQ
(
L'a'
,
wchar
),
EXPECT_NONFATAL_FAILURE
(
EXPECT_EQ
(
L'a'
,
wchar
),
"wchar"
);
"wchar"
);
wchar
=
L
'\
x8119
'
;
wchar
=
0x8119
;
EXPECT_FATAL_FAILURE
(
ASSERT_EQ
(
L
'\
x8120
'
,
wchar
),
EXPECT_FATAL_FAILURE
(
ASSERT_EQ
(
static_cast
<
wchar_t
>
(
0x8120
)
,
wchar
),
"Value of: wchar"
);
"Value of: wchar"
);
}
}
...
@@ -4558,20 +4571,22 @@ TEST(EqAssertionTest, StdString) {
...
@@ -4558,20 +4571,22 @@ TEST(EqAssertionTest, StdString) {
// Tests using ::std::wstring values in {EXPECT|ASSERT}_EQ.
// Tests using ::std::wstring values in {EXPECT|ASSERT}_EQ.
TEST
(
EqAssertionTest
,
StdWideString
)
{
TEST
(
EqAssertionTest
,
StdWideString
)
{
// Compares an std::wstring to a const wchar_t* that has identical
// content.
EXPECT_EQ
(
::
std
::
wstring
(
L"Test
\x8119
"
),
L"Test
\x8119
"
);
// Compares two identical std::wstrings.
// Compares two identical std::wstrings.
const
::
std
::
wstring
wstr1
(
L"A * in the middle"
);
const
::
std
::
wstring
wstr1
(
L"A * in the middle"
);
const
::
std
::
wstring
wstr2
(
wstr1
);
const
::
std
::
wstring
wstr2
(
wstr1
);
ASSERT_EQ
(
wstr1
,
wstr2
);
ASSERT_EQ
(
wstr1
,
wstr2
);
// Compares an std::wstring to a const wchar_t* that has identical
// content.
const
wchar_t
kTestX8119
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
0x8119
,
'\0'
};
EXPECT_EQ
(
::
std
::
wstring
(
kTestX8119
),
kTestX8119
);
// Compares an std::wstring to a const wchar_t* that has different
// Compares an std::wstring to a const wchar_t* that has different
// content.
// content.
const
wchar_t
kTestX8120
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
0x8120
,
'\0'
};
EXPECT_NONFATAL_FAILURE
({
// NOLINT
EXPECT_NONFATAL_FAILURE
({
// NOLINT
EXPECT_EQ
(
::
std
::
wstring
(
L"Test
\x8119
"
),
L"Test
\x8120
"
);
EXPECT_EQ
(
::
std
::
wstring
(
kTestX8119
),
kTestX8120
);
},
"
L
\"
Test
\\
x8120
\"
"
);
},
"
kTestX8120
"
);
// Compares two std::wstrings that have different contents, one of
// Compares two std::wstrings that have different contents, one of
// which having a NUL character in the middle.
// which having a NUL character in the middle.
...
@@ -4623,18 +4638,20 @@ TEST(EqAssertionTest, GlobalString) {
...
@@ -4623,18 +4638,20 @@ TEST(EqAssertionTest, GlobalString) {
// Tests using ::wstring values in {EXPECT|ASSERT}_EQ.
// Tests using ::wstring values in {EXPECT|ASSERT}_EQ.
TEST
(
EqAssertionTest
,
GlobalWideString
)
{
TEST
(
EqAssertionTest
,
GlobalWideString
)
{
// Compares a const wchar_t* to a ::wstring that has identical content.
ASSERT_EQ
(
L"Test
\x8119
"
,
::
wstring
(
L"Test
\x8119
"
));
// Compares two identical ::wstrings.
// Compares two identical ::wstrings.
static
const
::
wstring
wstr1
(
L"A * in the middle"
);
static
const
::
wstring
wstr1
(
L"A * in the middle"
);
static
const
::
wstring
wstr2
(
wstr1
);
static
const
::
wstring
wstr2
(
wstr1
);
EXPECT_EQ
(
wstr1
,
wstr2
);
EXPECT_EQ
(
wstr1
,
wstr2
);
// Compares a const wchar_t* to a ::wstring that has identical content.
const
wchar_t
kTestX8119
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
0x8119
,
'\0'
};
ASSERT_EQ
(
kTestX8119
,
::
wstring
(
kTestX8119
));
// Compares a const wchar_t* to a ::wstring that has different
// Compares a const wchar_t* to a ::wstring that has different
// content.
// content.
const
wchar_t
kTestX8120
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
0x8120
,
'\0'
};
EXPECT_NONFATAL_FAILURE
({
// NOLINT
EXPECT_NONFATAL_FAILURE
({
// NOLINT
EXPECT_EQ
(
L"Test
\x8120
"
,
::
wstring
(
L"Test
\x8119
"
));
EXPECT_EQ
(
kTestX8120
,
::
wstring
(
kTestX8119
));
},
"Test
\\
x8119"
);
},
"Test
\\
x8119"
);
// Compares a wchar_t* to a ::wstring that has different content.
// Compares a wchar_t* to a ::wstring that has different content.
...
...
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