| 973 | }; |
| 974 | |
| 975 | void MultVerifyInt64Int64() |
| 976 | { |
| 977 | size_t i; |
| 978 | |
| 979 | for( i = 0; i < COUNTOF(int64_int64); ++i ) |
| 980 | { |
| 981 | __int64 ret; |
| 982 | if( SafeMultiply(int64_int64[i].x, int64_int64[i].y, ret) != int64_int64[i].fExpected ) |
| 983 | { |
| 984 | //assert(false); |
| 985 | // printf("Error in case %I64X, %I64X, expected = %s\n", |
| 986 | // int64_int64[i].x, int64_int64[i].y, int64_int64[i].fExpected ? "true" : "false"); |
| 987 | cerr << "Error in case int64_int64: "; |
| 988 | cerr << hex << setw(16) << setfill('0') << int64_int64[i].x << ", "; |
| 989 | cerr << hex << setw(16) << setfill('0') << int64_int64[i].y << ", "; |
| 990 | cerr << "expected = " << int64_int64[i].fExpected << endl; |
| 991 | } |
| 992 | |
| 993 | bool fSuccess = true; |
| 994 | try |
| 995 | { |
| 996 | SafeInt<signed __int64> si(int64_int64[i].x); |
| 997 | si *= int64_int64[i].y; |
| 998 | } |
| 999 | catch(...) |
| 1000 | { |
| 1001 | fSuccess = false; |
| 1002 | } |
| 1003 | |
| 1004 | if( fSuccess != int64_int64[i].fExpected ) |
| 1005 | { |
| 1006 | // printf("Error in case int64_int64 throw: %I64X, %I64X, expected = %s\n", |
| 1007 | // int64_int64[i].x, int64_int64[i].y, int64_int64[i].fExpected ? "true" : "false"); |
| 1008 | cerr << "Error in case int64_int64 throw: "; |
| 1009 | cerr << hex << setw(16) << setfill('0') << int64_int64[i].x << ", "; |
| 1010 | cerr << hex << setw(16) << setfill('0') << int64_int64[i].y << ", "; |
| 1011 | cerr << "expected = " << int64_int64[i].fExpected << endl; |
| 1012 | } |
| 1013 | } |
| 1014 | } |
| 1015 | |
| 1016 | static const MultTest< __int64, unsigned __int64 > int64_uint64[] = |
| 1017 | { |
no test coverage detected