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

Function PostIncTestUint8

Test/IncDecVerify.cpp:69–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69void PostIncTestUint8()
70{
71 size_t i;
72
73 for( i = 0; i < COUNTOF(inc_uint8); ++i )
74 {
75 bool fSuccess = true;
76 try
77 {
78 SafeInt<std::uint8_t> si(inc_uint8[i].x);
79 SafeInt<std::uint8_t> vv = si++;
80
81 if(vv != inc_uint8[i].x)
82 {
83 fSuccess = false;
84 }
85 }
86 catch(SafeIntException&)
87 {
88 fSuccess = false;
89 }
90
91 if( fSuccess != inc_uint8[i].fExpected )
92 {
93 cerr << "Error in case inc_uint8 throw (2): ";
94 cerr << HEX(2) << (0xFF & (int)inc_uint8[i].x) << ", ";
95 cerr << "expected = " << inc_uint8[i].fExpected << endl;
96 }
97 }
98}
99
100static const IncTest< std::uint16_t > inc_uint16[] =
101{

Callers 1

IncDecVerifyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected