mirror of
https://github.com/google/benchmark.git
synced 2024-12-25 20:10:13 +08:00
Fix code triggering -Wsign-conversion (#1596)
* Fix code triggering -Wsign-conversion * more test
This commit is contained in:
parent
318dd44225
commit
fec77322b4
@ -46,7 +46,7 @@ BENCHMARK(BM_MyBench);
|
||||
int main(int argc, char** argv) {
|
||||
// Make a fake argv and append the new --benchmark_min_time=<foo> to it.
|
||||
int fake_argc = argc + 1;
|
||||
const char** fake_argv = new const char*[fake_argc];
|
||||
const char** fake_argv = new const char*[static_cast<size_t>(fake_argc)];
|
||||
for (int i = 0; i < argc; ++i) fake_argv[i] = argv[i];
|
||||
fake_argv[argc] = "--benchmark_min_time=4x";
|
||||
|
||||
|
@ -71,7 +71,7 @@ BENCHMARK(BM_MyBench);
|
||||
int main(int argc, char** argv) {
|
||||
// Make a fake argv and append the new --benchmark_min_time=<foo> to it.
|
||||
int fake_argc = argc + 1;
|
||||
const char** fake_argv = new const char*[fake_argc];
|
||||
const char** fake_argv = new const char*[static_cast<size_t>(fake_argc)];
|
||||
|
||||
for (int i = 0; i < argc; ++i) fake_argv[i] = argv[i];
|
||||
|
||||
|
@ -169,8 +169,8 @@ TEST(PerfCountersTest, CreateExistingMeasurements) {
|
||||
std::vector<std::pair<std::string, double>> measurements;
|
||||
|
||||
// Start all counters together to see if they hold
|
||||
int max_counters = kMaxCounters;
|
||||
for (int i = 0; i < kMaxCounters; ++i) {
|
||||
size_t max_counters = kMaxCounters;
|
||||
for (size_t i = 0; i < kMaxCounters; ++i) {
|
||||
auto& counter(*perf_counter_measurements[i]);
|
||||
EXPECT_EQ(counter.num_counters(), 1);
|
||||
if (!counter.Start()) {
|
||||
@ -182,13 +182,13 @@ TEST(PerfCountersTest, CreateExistingMeasurements) {
|
||||
ASSERT_GE(max_counters, kMinValidCounters);
|
||||
|
||||
// Start all together
|
||||
for (int i = 0; i < max_counters; ++i) {
|
||||
for (size_t i = 0; i < max_counters; ++i) {
|
||||
auto& counter(*perf_counter_measurements[i]);
|
||||
EXPECT_TRUE(counter.Stop(measurements) || (i >= kMinValidCounters));
|
||||
}
|
||||
|
||||
// Start/stop individually
|
||||
for (int i = 0; i < max_counters; ++i) {
|
||||
for (size_t i = 0; i < max_counters; ++i) {
|
||||
auto& counter(*perf_counter_measurements[i]);
|
||||
measurements.clear();
|
||||
counter.Start();
|
||||
|
Loading…
Reference in New Issue
Block a user