| 142 | } |
| 143 | |
| 144 | void 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 | |
| 175 | static const IncTest< std::uint32_t > inc_uint32[] = |
| 176 | { |