| 36 | }; |
| 37 | |
| 38 | void 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 | |
| 69 | void PostIncTestUint8() |
| 70 | { |