| 1558 | }; |
| 1559 | |
| 1560 | void DivVerifyInt64Int64() |
| 1561 | { |
| 1562 | size_t i; |
| 1563 | |
| 1564 | for( i = 0; i < sizeof(int64_int64)/sizeof(int64_int64[0]); ++i ) |
| 1565 | { |
| 1566 | std::int64_t ret; |
| 1567 | if( SafeDivide(int64_int64[i].x, int64_int64[i].y, ret) != int64_int64[i].fExpected ) |
| 1568 | { |
| 1569 | //assert(false); |
| 1570 | printf("Error in case int64_int64: %I64X, %I64X, expected = %s\n", int64_int64[i].x, int64_int64[i].y, int64_int64[i].fExpected ? "true" : "false"); |
| 1571 | } |
| 1572 | |
| 1573 | // Now test throwing version |
| 1574 | bool fSuccess = true; |
| 1575 | try |
| 1576 | { |
| 1577 | SafeInt<std::int64_t> si(int64_int64[i].x); |
| 1578 | si /= int64_int64[i].y; |
| 1579 | } |
| 1580 | catch(...) |
| 1581 | { |
| 1582 | fSuccess = false; |
| 1583 | } |
| 1584 | |
| 1585 | if( fSuccess != int64_int64[i].fExpected ) |
| 1586 | { |
| 1587 | printf("Error in case int64_int64 throw: %I64X, %I64X, expected = %s\n", int64_int64[i].x, int64_int64[i].y, int64_int64[i].fExpected ? "true" : "false"); |
| 1588 | } |
| 1589 | |
| 1590 | // Also need to test the version that assigns back out |
| 1591 | // to a plain int, as it has different logic |
| 1592 | fSuccess = true; |
| 1593 | try |
| 1594 | { |
| 1595 | std::int64_t x(int64_int64[i].x); |
| 1596 | x /= SafeInt<std::int64_t>(int64_int64[i].y); |
| 1597 | } |
| 1598 | catch(...) |
| 1599 | { |
| 1600 | fSuccess = false; |
| 1601 | } |
| 1602 | |
| 1603 | if( fSuccess != int64_int64[i].fExpected ) |
| 1604 | { |
| 1605 | printf("Error in case int64_int64 throw: %I64X, %I64X, expected = %s\n", int64_int64[i].x, int64_int64[i].y, int64_int64[i].fExpected ? "true" : "false"); |
| 1606 | } |
| 1607 | } |
| 1608 | } |
| 1609 | |
| 1610 | void DivVerifyInt64Int64_2() |
| 1611 | { |
no test coverage detected