MCPcopy Create free account
hub / github.com/dcleblanc/SafeInt / PostIncTestInt16

Function PostIncTestInt16

Test/IncDecVerify.cpp:452–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452void PostIncTestInt16()
453{
454 size_t i;
455
456 for( i = 0; i < COUNTOF(inc_int16); ++i )
457 {
458 bool fSuccess = true;
459 try
460 {
461 SafeInt< std::int16_t > si(inc_int16[i].x);
462 SafeInt< std::int16_t > vv = si++;
463
464 if(vv != inc_int16[i].x)
465 {
466 fSuccess = false;
467 }
468 }
469 catch(SafeIntException&)
470 {
471 fSuccess = false;
472 }
473
474 if( fSuccess != inc_int16[i].fExpected )
475 {
476 cerr << "Error in case inc_int16 throw (2): ";
477 cerr << HEX(4) << inc_int16[i].x << ", ";
478 cerr << "expected = " << inc_int16[i].fExpected << endl;
479 }
480 }
481}
482
483static const IncTest< std::int32_t > inc_int32[] =
484{

Callers 1

IncDecVerifyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected