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
6baed3c1
Commit
6baed3c1
authored
Feb 25, 2010
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes MSVC warnings in 64-bit mode.
parent
4879aac7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
14 deletions
+15
-14
gtest-internal-inl.h
src/gtest-internal-inl.h
+2
-2
gtest-test-part.cc
src/gtest-test-part.cc
+1
-1
gtest.cc
src/gtest.cc
+11
-10
gtest_unittest.cc
test/gtest_unittest.cc
+1
-1
No files found.
src/gtest-internal-inl.h
View file @
6baed3c1
...
@@ -251,7 +251,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id);
...
@@ -251,7 +251,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id);
// the given predicate.
// the given predicate.
template
<
class
Container
,
typename
Predicate
>
template
<
class
Container
,
typename
Predicate
>
inline
int
CountIf
(
const
Container
&
c
,
Predicate
predicate
)
{
inline
int
CountIf
(
const
Container
&
c
,
Predicate
predicate
)
{
return
st
d
::
count_if
(
c
.
begin
(),
c
.
end
(),
predicate
);
return
st
atic_cast
<
int
>
(
std
::
count_if
(
c
.
begin
(),
c
.
end
(),
predicate
)
);
}
}
// Applies a function/functor to each element in the container.
// Applies a function/functor to each element in the container.
...
@@ -294,7 +294,7 @@ void ShuffleRange(internal::Random* random, int begin, int end,
...
@@ -294,7 +294,7 @@ void ShuffleRange(internal::Random* random, int begin, int end,
// Performs an in-place shuffle of the vector's elements.
// Performs an in-place shuffle of the vector's elements.
template
<
typename
E
>
template
<
typename
E
>
inline
void
Shuffle
(
internal
::
Random
*
random
,
std
::
vector
<
E
>*
v
)
{
inline
void
Shuffle
(
internal
::
Random
*
random
,
std
::
vector
<
E
>*
v
)
{
ShuffleRange
(
random
,
0
,
v
->
size
(
),
v
);
ShuffleRange
(
random
,
0
,
static_cast
<
int
>
(
v
->
size
()
),
v
);
}
}
// A function for deleting an object. Handy for being used as a
// A function for deleting an object. Handy for being used as a
...
...
src/gtest-test-part.cc
View file @
6baed3c1
...
@@ -81,7 +81,7 @@ const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
...
@@ -81,7 +81,7 @@ const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
// Returns the number of TestPartResult objects in the array.
// Returns the number of TestPartResult objects in the array.
int
TestPartResultArray
::
size
()
const
{
int
TestPartResultArray
::
size
()
const
{
return
array_
.
size
(
);
return
static_cast
<
int
>
(
array_
.
size
()
);
}
}
namespace
internal
{
namespace
internal
{
...
...
src/gtest.cc
View file @
6baed3c1
...
@@ -690,7 +690,7 @@ int UnitTestImpl::failed_test_case_count() const {
...
@@ -690,7 +690,7 @@ int UnitTestImpl::failed_test_case_count() const {
// Gets the number of all test cases.
// Gets the number of all test cases.
int
UnitTestImpl
::
total_test_case_count
()
const
{
int
UnitTestImpl
::
total_test_case_count
()
const
{
return
test_cases_
.
size
(
);
return
static_cast
<
int
>
(
test_cases_
.
size
()
);
}
}
// Gets the number of all test cases that contain at least one test
// Gets the number of all test cases that contain at least one test
...
@@ -1898,12 +1898,12 @@ bool TestResult::HasNonfatalFailure() const {
...
@@ -1898,12 +1898,12 @@ bool TestResult::HasNonfatalFailure() const {
// Gets the number of all test parts. This is the sum of the number
// Gets the number of all test parts. This is the sum of the number
// of successful test parts and the number of failed test parts.
// of successful test parts and the number of failed test parts.
int
TestResult
::
total_part_count
()
const
{
int
TestResult
::
total_part_count
()
const
{
return
test_part_results_
.
size
(
);
return
static_cast
<
int
>
(
test_part_results_
.
size
()
);
}
}
// Returns the number of the test properties.
// Returns the number of the test properties.
int
TestResult
::
test_property_count
()
const
{
int
TestResult
::
test_property_count
()
const
{
return
test_properties_
.
size
(
);
return
static_cast
<
int
>
(
test_properties_
.
size
()
);
}
}
// class Test
// class Test
...
@@ -2350,7 +2350,7 @@ int TestCase::test_to_run_count() const {
...
@@ -2350,7 +2350,7 @@ int TestCase::test_to_run_count() const {
// Gets the number of all tests.
// Gets the number of all tests.
int
TestCase
::
total_test_count
()
const
{
int
TestCase
::
total_test_count
()
const
{
return
test_info_list_
.
size
(
);
return
static_cast
<
int
>
(
test_info_list_
.
size
()
);
}
}
// Creates a TestCase with the given name.
// Creates a TestCase with the given name.
...
@@ -2395,7 +2395,7 @@ TestInfo* TestCase::GetMutableTestInfo(int i) {
...
@@ -2395,7 +2395,7 @@ TestInfo* TestCase::GetMutableTestInfo(int i) {
// destruction of the TestCase object.
// destruction of the TestCase object.
void
TestCase
::
AddTestInfo
(
TestInfo
*
test_info
)
{
void
TestCase
::
AddTestInfo
(
TestInfo
*
test_info
)
{
test_info_list_
.
push_back
(
test_info
);
test_info_list_
.
push_back
(
test_info
);
test_indices_
.
push_back
(
test_indices_
.
size
(
));
test_indices_
.
push_back
(
static_cast
<
int
>
(
test_indices_
.
size
()
));
}
}
// Runs every test in this TestCase.
// Runs every test in this TestCase.
...
@@ -2458,7 +2458,7 @@ void TestCase::ShuffleTests(internal::Random* random) {
...
@@ -2458,7 +2458,7 @@ void TestCase::ShuffleTests(internal::Random* random) {
// Restores the test order to before the first shuffle.
// Restores the test order to before the first shuffle.
void
TestCase
::
UnshuffleTests
()
{
void
TestCase
::
UnshuffleTests
()
{
for
(
size_t
i
=
0
;
i
<
test_indices_
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
test_indices_
.
size
();
i
++
)
{
test_indices_
[
i
]
=
i
;
test_indices_
[
i
]
=
static_cast
<
int
>
(
i
)
;
}
}
}
}
...
@@ -3567,7 +3567,8 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
...
@@ -3567,7 +3567,8 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
if
(
impl_
->
gtest_trace_stack
().
size
()
>
0
)
{
if
(
impl_
->
gtest_trace_stack
().
size
()
>
0
)
{
msg
<<
"
\n
"
<<
GTEST_NAME_
<<
" trace:"
;
msg
<<
"
\n
"
<<
GTEST_NAME_
<<
" trace:"
;
for
(
int
i
=
impl_
->
gtest_trace_stack
().
size
();
i
>
0
;
--
i
)
{
for
(
int
i
=
static_cast
<
int
>
(
impl_
->
gtest_trace_stack
().
size
());
i
>
0
;
--
i
)
{
const
internal
::
TraceInfo
&
trace
=
impl_
->
gtest_trace_stack
()[
i
-
1
];
const
internal
::
TraceInfo
&
trace
=
impl_
->
gtest_trace_stack
()[
i
-
1
];
msg
<<
"
\n
"
<<
internal
::
FormatFileLocation
(
trace
.
file
,
trace
.
line
)
msg
<<
"
\n
"
<<
internal
::
FormatFileLocation
(
trace
.
file
,
trace
.
line
)
<<
" "
<<
trace
.
message
;
<<
" "
<<
trace
.
message
;
...
@@ -3907,7 +3908,7 @@ TestCase* UnitTestImpl::GetTestCase(const char* test_case_name,
...
@@ -3907,7 +3908,7 @@ TestCase* UnitTestImpl::GetTestCase(const char* test_case_name,
test_cases_
.
push_back
(
new_test_case
);
test_cases_
.
push_back
(
new_test_case
);
}
}
test_case_indices_
.
push_back
(
test_case_indices_
.
size
(
));
test_case_indices_
.
push_back
(
static_cast
<
int
>
(
test_case_indices_
.
size
()
));
return
new_test_case
;
return
new_test_case
;
}
}
...
@@ -4270,7 +4271,7 @@ void UnitTestImpl::ShuffleTests() {
...
@@ -4270,7 +4271,7 @@ void UnitTestImpl::ShuffleTests() {
// Shuffles the non-death test cases.
// Shuffles the non-death test cases.
ShuffleRange
(
random
(),
last_death_test_case_
+
1
,
ShuffleRange
(
random
(),
last_death_test_case_
+
1
,
test_cases_
.
size
(
),
&
test_case_indices_
);
static_cast
<
int
>
(
test_cases_
.
size
()
),
&
test_case_indices_
);
// Shuffles the tests inside each test case.
// Shuffles the tests inside each test case.
for
(
size_t
i
=
0
;
i
<
test_cases_
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
test_cases_
.
size
();
i
++
)
{
...
@@ -4284,7 +4285,7 @@ void UnitTestImpl::UnshuffleTests() {
...
@@ -4284,7 +4285,7 @@ void UnitTestImpl::UnshuffleTests() {
// Unshuffles the tests in each test case.
// Unshuffles the tests in each test case.
test_cases_
[
i
]
->
UnshuffleTests
();
test_cases_
[
i
]
->
UnshuffleTests
();
// Resets the index of each test case.
// Resets the index of each test case.
test_case_indices_
[
i
]
=
i
;
test_case_indices_
[
i
]
=
static_cast
<
int
>
(
i
)
;
}
}
}
}
...
...
test/gtest_unittest.cc
View file @
6baed3c1
...
@@ -683,7 +683,7 @@ class VectorShuffleTest : public Test {
...
@@ -683,7 +683,7 @@ class VectorShuffleTest : public Test {
}
}
static
bool
VectorIsShuffled
(
const
TestingVector
&
vector
)
{
static
bool
VectorIsShuffled
(
const
TestingVector
&
vector
)
{
return
RangeIsShuffled
(
vector
,
0
,
vector
.
size
(
));
return
RangeIsShuffled
(
vector
,
0
,
static_cast
<
int
>
(
vector
.
size
()
));
}
}
static
bool
VectorIsUnshuffled
(
const
TestingVector
&
vector
)
{
static
bool
VectorIsUnshuffled
(
const
TestingVector
&
vector
)
{
...
...
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