| 494 | }; |
| 495 | |
| 496 | void PreIncTestInt32() |
| 497 | { |
| 498 | size_t i; |
| 499 | |
| 500 | for( i = 0; i < COUNTOF(inc_int32); ++i ) |
| 501 | { |
| 502 | bool fSuccess = true; |
| 503 | try |
| 504 | { |
| 505 | SafeInt< std::int32_t > si(inc_int32[i].x); |
| 506 | SafeInt< std::int32_t > vv = ++si; |
| 507 | |
| 508 | if(vv != inc_int32[i].y) |
| 509 | { |
| 510 | fSuccess = false; |
| 511 | } |
| 512 | } |
| 513 | catch(SafeIntException&) |
| 514 | { |
| 515 | fSuccess = false; |
| 516 | } |
| 517 | |
| 518 | if( fSuccess != inc_int32[i].fExpected ) |
| 519 | { |
| 520 | cerr << "Error in case inc_int32 throw (1): "; |
| 521 | cerr << HEX(8) << inc_int32[i].x << ", "; |
| 522 | cerr << "expected = " << inc_int32[i].fExpected << endl; |
| 523 | } |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | void PostIncTestInt32() |
| 528 | { |