| 764 | }; |
| 765 | |
| 766 | void MultVerifyUint64Int() |
| 767 | { |
| 768 | size_t i; |
| 769 | |
| 770 | for( i = 0; i < COUNTOF(uint64_int32); ++i ) |
| 771 | { |
| 772 | std::uint64_t ret; |
| 773 | if( SafeMultiply(uint64_int32[i].x, uint64_int32[i].y, ret) != uint64_int32[i].fExpected ) |
| 774 | { |
| 775 | //assert(false); |
| 776 | // printf("Error in case %I64X, %I64X, expected = %s\n", |
| 777 | // uint64_int32[i].x, uint64_int32[i].y, uint64_int32[i].fExpected ? "true" : "false"); |
| 778 | cerr << "Error in case uint64_int32: "; |
| 779 | cerr << hex << setw(16) << setfill('0') << uint64_int32[i].x << ", "; |
| 780 | cerr << hex << setw(16) << setfill('0') << uint64_int32[i].y << ", "; |
| 781 | cerr << "expected = " << uint64_int32[i].fExpected << endl; |
| 782 | } |
| 783 | |
| 784 | bool fSuccess = true; |
| 785 | try |
| 786 | { |
| 787 | SafeInt<std::uint64_t> si(uint64_int32[i].x); |
| 788 | si *= uint64_int32[i].y; |
| 789 | } |
| 790 | catch(...) |
| 791 | { |
| 792 | fSuccess = false; |
| 793 | } |
| 794 | |
| 795 | if( fSuccess != uint64_int32[i].fExpected ) |
| 796 | { |
| 797 | // printf("Error in case uint64_int32 throw: %I64X, %I64X, expected = %s\n", |
| 798 | // uint64_int32[i].x, uint64_int32[i].y, uint64_int32[i].fExpected ? "true" : "false"); |
| 799 | cerr << "Error in case uint64_int32 throw: "; |
| 800 | cerr << hex << setw(16) << setfill('0') << uint64_int32[i].x << ", "; |
| 801 | cerr << hex << setw(16) << setfill('0') << uint64_int32[i].y << ", "; |
| 802 | cerr << "expected = " << uint64_int32[i].fExpected << endl; |
| 803 | } |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | static const MultTest< std::int64_t, std::int64_t > int64_int64[] = |
| 808 | { |
no test coverage detected