mirror of
https://github.com/google/benchmark.git
synced 2025-03-14 03:10:22 +08:00
Use stringstream instead of atoi to avoid sign error.
The sane thing here would be to use std::stoul but this is not available in the android-ndk...
This commit is contained in:
parent
df0df4aba9
commit
6abd53777b
@ -74,12 +74,18 @@ int main(int argc, char* argv[]) {
|
||||
TestReporter test_reporter;
|
||||
benchmark::RunSpecifiedBenchmarks(&test_reporter);
|
||||
|
||||
// Make sure we ran all of the tests
|
||||
const size_t count = test_reporter.GetCount();
|
||||
const size_t expected = (argc == 2) ? std::atol(argv[1]) : count;
|
||||
if (count != expected) {
|
||||
std::cerr << "ERROR: Expected " << expected << " tests to be ran but only "
|
||||
<< count << " completed" << std::endl;
|
||||
return -1;
|
||||
if (argc == 2) {
|
||||
// Make sure we ran all of the tests
|
||||
std::stringstream ss(argv[1]);
|
||||
size_t expected;
|
||||
ss >> expected;
|
||||
|
||||
const size_t count = test_reporter.GetCount();
|
||||
if (count != expected) {
|
||||
std::cerr << "ERROR: Expected " << expected << " tests to be ran but only "
|
||||
<< count << " completed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user