| 344 | }; |
| 345 | |
| 346 | void PreIncTestInt8() |
| 347 | { |
| 348 | size_t i; |
| 349 | |
| 350 | for( i = 0; i < COUNTOF(inc_int8); ++i ) |
| 351 | { |
| 352 | bool fSuccess = true; |
| 353 | try |
| 354 | { |
| 355 | SafeInt< std::int8_t > si(inc_int8[i].x); |
| 356 | SafeInt< std::int8_t > vv = ++si; |
| 357 | |
| 358 | if(vv != inc_int8[i].y) |
| 359 | { |
| 360 | fSuccess = false; |
| 361 | } |
| 362 | } |
| 363 | catch(SafeIntException&) |
| 364 | { |
| 365 | fSuccess = false; |
| 366 | } |
| 367 | |
| 368 | if( fSuccess != inc_int8[i].fExpected ) |
| 369 | { |
| 370 | cerr << "Error in case inc_int8 throw (1): "; |
| 371 | cerr << HEX(2) << (0xFF & (int)inc_int8[i].x) << ", "; |
| 372 | cerr << "expected = " << inc_int8[i].fExpected << endl; |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | void PostIncTestInt8() |
| 378 | { |