@@ -224,18 +224,18 @@ Runner& Runner::add(TestCaseFactory factory) {
224224 return *this ;
225225}
226226
227- unsigned int Runner::testCount () const {
228- return static_cast < unsigned int >( tests_.size () );
227+ size_t Runner::testCount () const {
228+ return tests_.size ();
229229}
230230
231- JSONCPP_STRING Runner::testNameAt (unsigned int index) const {
231+ JSONCPP_STRING Runner::testNameAt (size_t index) const {
232232 TestCase* test = tests_[index]();
233233 JSONCPP_STRING name = test->testName ();
234234 delete test;
235235 return name;
236236}
237237
238- void Runner::runTestAt (unsigned int index, TestResult& result) const {
238+ void Runner::runTestAt (size_t index, TestResult& result) const {
239239 TestCase* test = tests_[index]();
240240 result.setTestName (test->testName ());
241241 printf (" Testing %s: " , test->testName ());
@@ -257,9 +257,9 @@ void Runner::runTestAt(unsigned int index, TestResult& result) const {
257257}
258258
259259bool Runner::runAllTest (bool printSummary) const {
260- unsigned int count = testCount ();
260+ size_t const count = testCount ();
261261 std::deque<TestResult> failures;
262- for (unsigned int index = 0 ; index < count; ++index) {
262+ for (size_t index = 0 ; index < count; ++index) {
263263 TestResult result;
264264 runTestAt (index, result);
265265 if (result.failed ()) {
@@ -269,7 +269,7 @@ bool Runner::runAllTest(bool printSummary) const {
269269
270270 if (failures.empty ()) {
271271 if (printSummary) {
272- printf (" All %u tests passed\n " , count);
272+ printf (" All %zu tests passed\n " , count);
273273 }
274274 return true ;
275275 } else {
@@ -278,19 +278,19 @@ bool Runner::runAllTest(bool printSummary) const {
278278 }
279279
280280 if (printSummary) {
281- auto failedCount = static_cast < unsigned int >( failures.size () );
282- unsigned int passedCount = count - failedCount;
283- printf (" %u/%u tests passed (%u failure(s))\n " , passedCount, count ,
284- failedCount);
281+ size_t const failedCount = failures.size ();
282+ size_t const passedCount = count - failedCount;
283+ printf (" %zu/%zu tests passed (%zu failure(s))\n " ,
284+ passedCount, count, failedCount);
285285 }
286286 return false ;
287287 }
288288}
289289
290290bool Runner::testIndex (const JSONCPP_STRING& testName,
291- unsigned int & indexOut) const {
292- unsigned int count = testCount ();
293- for (unsigned int index = 0 ; index < count; ++index) {
291+ size_t & indexOut) const {
292+ const size_t count = testCount ();
293+ for (size_t index = 0 ; index < count; ++index) {
294294 if (testNameAt (index) == testName) {
295295 indexOut = index;
296296 return true ;
@@ -300,8 +300,8 @@ bool Runner::testIndex(const JSONCPP_STRING& testName,
300300}
301301
302302void Runner::listTests () const {
303- unsigned int count = testCount ();
304- for (unsigned int index = 0 ; index < count; ++index) {
303+ const size_t count = testCount ();
304+ for (size_t index = 0 ; index < count; ++index) {
305305 printf (" %s\n " , testNameAt (index).c_str ());
306306 }
307307}
@@ -319,7 +319,7 @@ int Runner::runCommandLine(int argc, const char* argv[]) const {
319319 } else if (opt == " --test" ) {
320320 ++index;
321321 if (index < argc) {
322- unsigned int testNameIndex;
322+ size_t testNameIndex;
323323 if (testIndex (argv[index], testNameIndex)) {
324324 subrunner.add (tests_[testNameIndex]);
325325 } else {
0 commit comments