mirror of https://github.com/google/benchmark.git
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) {
|
int main(int argc, char** argv) {
|
||||||
// Make a fake argv and append the new --benchmark_min_time=<foo> to it.
|
// Make a fake argv and append the new --benchmark_min_time=<foo> to it.
|
||||||
int fake_argc = argc + 1;
|
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];
|
for (int i = 0; i < argc; ++i) fake_argv[i] = argv[i];
|
||||||
fake_argv[argc] = "--benchmark_min_time=4x";
|
fake_argv[argc] = "--benchmark_min_time=4x";
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ BENCHMARK(BM_MyBench);
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
// Make a fake argv and append the new --benchmark_min_time=<foo> to it.
|
// Make a fake argv and append the new --benchmark_min_time=<foo> to it.
|
||||||
int fake_argc = argc + 1;
|
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];
|
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;
|
std::vector<std::pair<std::string, double>> measurements;
|
||||||
|
|
||||||
// Start all counters together to see if they hold
|
// Start all counters together to see if they hold
|
||||||
int max_counters = kMaxCounters;
|
size_t max_counters = kMaxCounters;
|
||||||
for (int i = 0; i < kMaxCounters; ++i) {
|
for (size_t i = 0; i < kMaxCounters; ++i) {
|
||||||
auto& counter(*perf_counter_measurements[i]);
|
auto& counter(*perf_counter_measurements[i]);
|
||||||
EXPECT_EQ(counter.num_counters(), 1);
|
EXPECT_EQ(counter.num_counters(), 1);
|
||||||
if (!counter.Start()) {
|
if (!counter.Start()) {
|
||||||
|
@ -182,13 +182,13 @@ TEST(PerfCountersTest, CreateExistingMeasurements) {
|
||||||
ASSERT_GE(max_counters, kMinValidCounters);
|
ASSERT_GE(max_counters, kMinValidCounters);
|
||||||
|
|
||||||
// Start all together
|
// 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]);
|
auto& counter(*perf_counter_measurements[i]);
|
||||||
EXPECT_TRUE(counter.Stop(measurements) || (i >= kMinValidCounters));
|
EXPECT_TRUE(counter.Stop(measurements) || (i >= kMinValidCounters));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start/stop individually
|
// 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]);
|
auto& counter(*perf_counter_measurements[i]);
|
||||||
measurements.clear();
|
measurements.clear();
|
||||||
counter.Start();
|
counter.Start();
|
||||||
|
|
Loading…
Reference in New Issue