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

Function PreIncTestUint8

Test/IncDecVerify.cpp:38–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36};
37
38void PreIncTestUint8()
39{
40 size_t i;
41
42 for( i = 0; i < COUNTOF(inc_uint8); ++i )
43 {
44 bool fSuccess = true;
45 try
46 {
47 SafeInt<std::uint8_t> si(inc_uint8[i].x);
48 SafeInt<std::uint8_t> vv = ++si;
49
50 if(vv != inc_uint8[i].y)
51 {
52 fSuccess = false;
53 }
54 }
55 catch(SafeIntException&)
56 {
57 fSuccess = false;
58 }
59
60 if( fSuccess != inc_uint8[i].fExpected )
61 {
62 cerr << "Error in case inc_uint8 throw (1): ";
63 cerr << HEX(2) << (0xFF & (int)inc_uint8[i].x) << ", ";
64 cerr << "expected = " << inc_uint8[i].fExpected << endl;
65 }
66 }
67}
68
69void PostIncTestUint8()
70{

Callers 1

IncDecVerifyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected