| 805 | }; |
| 806 | |
| 807 | void MultVerifyUint64Int() |
| 808 | { |
| 809 | size_t i; |
| 810 | |
| 811 | for( i = 0; i < COUNTOF(uint64_int32); ++i ) |
| 812 | { |
| 813 | unsigned __int64 ret; |
| 814 | if( SafeMultiply(uint64_int32[i].x, uint64_int32[i].y, ret) != uint64_int32[i].fExpected ) |
| 815 | { |
| 816 | //assert(false); |
| 817 | // printf("Error in case %I64X, %I64X, expected = %s\n", |
| 818 | // uint64_int32[i].x, uint64_int32[i].y, uint64_int32[i].fExpected ? "true" : "false"); |
| 819 | cerr << "Error in case uint64_int32: "; |
| 820 | cerr << hex << setw(16) << setfill('0') << uint64_int32[i].x << ", "; |
| 821 | cerr << hex << setw(16) << setfill('0') << uint64_int32[i].y << ", "; |
| 822 | cerr << "expected = " << uint64_int32[i].fExpected << endl; |
| 823 | } |
| 824 | |
| 825 | bool fSuccess = true; |
| 826 | try |
| 827 | { |
| 828 | SafeInt<unsigned __int64> si(uint64_int32[i].x); |
| 829 | si *= uint64_int32[i].y; |
| 830 | } |
| 831 | catch(...) |
| 832 | { |
| 833 | fSuccess = false; |
| 834 | } |
| 835 | |
| 836 | if( fSuccess != uint64_int32[i].fExpected ) |
| 837 | { |
| 838 | // printf("Error in case uint64_int32 throw: %I64X, %I64X, expected = %s\n", |
| 839 | // uint64_int32[i].x, uint64_int32[i].y, uint64_int32[i].fExpected ? "true" : "false"); |
| 840 | cerr << "Error in case uint64_int32 throw: "; |
| 841 | cerr << hex << setw(16) << setfill('0') << uint64_int32[i].x << ", "; |
| 842 | cerr << hex << setw(16) << setfill('0') << uint64_int32[i].y << ", "; |
| 843 | cerr << "expected = " << uint64_int32[i].fExpected << endl; |
| 844 | } |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | static const MultTest< __int64, __int64 > int64_int64[] = |
| 849 | { |
no test coverage detected