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

Function PreDecTestUint8

Test/IncDecVerify.cpp:654–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

652};
653
654void PreDecTestUint8()
655{
656 size_t i;
657
658 for( i = 0; i < COUNTOF(dec_uint8); ++i )
659 {
660 bool fSuccess = true;
661 try
662 {
663 SafeInt<std::uint8_t> si(dec_uint8[i].x);
664 SafeInt<std::uint8_t> vv = --si;
665
666 if(vv != dec_uint8[i].y)
667 {
668 fSuccess = false;
669 }
670 }
671 catch(SafeIntException&)
672 {
673 fSuccess = false;
674 }
675
676 if( fSuccess != dec_uint8[i].fExpected )
677 {
678 cerr << "Error in case dec_uint8 throw (1): ";
679 cerr << HEX(2) << (0xFF & (int)dec_uint8[i].x) << ", ";
680 cerr << "expected = " << dec_uint8[i].fExpected << endl;
681 }
682 }
683}
684
685void PostDecTestUint8()
686{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected