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

Function PostIncTestUint16

Test/IncDecVerify.cpp:144–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144void PostIncTestUint16()
145{
146 size_t i;
147
148 for( i = 0; i < COUNTOF(inc_uint16); ++i )
149 {
150 bool fSuccess = true;
151 try
152 {
153 SafeInt<std::uint16_t> si(inc_uint16[i].x);
154 SafeInt<std::uint16_t> vv = si++;
155
156 if(vv != inc_uint16[i].x)
157 {
158 fSuccess = false;
159 }
160 }
161 catch(SafeIntException&)
162 {
163 fSuccess = false;
164 }
165
166 if( fSuccess != inc_uint16[i].fExpected )
167 {
168 cerr << "Error in case inc_uint16 throw (2): ";
169 cerr << HEX(4) << inc_uint16[i].x << ", ";
170 cerr << "expected = " << inc_uint16[i].fExpected << endl;
171 }
172 }
173}
174
175static const IncTest< std::uint32_t > inc_uint32[] =
176{

Callers 1

IncDecVerifyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected