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

Function PostDecTestUint16

Test/IncDecVerify.cpp:760–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758}
759
760void PostDecTestUint16()
761{
762 size_t i;
763
764 for( i = 0; i < COUNTOF(dec_uint16); ++i )
765 {
766 bool fSuccess = true;
767 try
768 {
769 SafeInt<std::uint16_t> si(dec_uint16[i].x);
770 SafeInt<std::uint16_t> vv = si--;
771
772 if(vv != dec_uint16[i].x)
773 {
774 fSuccess = false;
775 }
776 }
777 catch(SafeIntException&)
778 {
779 fSuccess = false;
780 }
781
782 if( fSuccess != dec_uint16[i].fExpected )
783 {
784 cerr << "Error in case dec_uint16 throw (2): ";
785 cerr << HEX(4) << dec_uint16[i].x << ", ";
786 cerr << "expected = " << dec_uint16[i].fExpected << endl;
787 }
788 }
789}
790
791static const DecTest< std::uint32_t > dec_uint32[] =
792{

Callers 1

IncDecVerifyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected