| 528 | }; |
| 529 | |
| 530 | void MultVerifyUintInt64() |
| 531 | { |
| 532 | size_t i; |
| 533 | |
| 534 | for( i = 0; i < COUNTOF(uint32_int64); ++i ) |
| 535 | { |
| 536 | unsigned __int32 ret; |
| 537 | if( SafeMultiply(uint32_int64[i].x, uint32_int64[i].y, ret) != uint32_int64[i].fExpected ) |
| 538 | { |
| 539 | //assert(false); |
| 540 | // printf("Error in case %I64X, %I64X, expected = %s\n", |
| 541 | // uint32_int64[i].x, uint32_int64[i].y, uint32_int64[i].fExpected ? "true" : "false"); |
| 542 | cerr << "Error in case uint32_int64: "; |
| 543 | cerr << hex << setw(16) << setfill('0') << uint32_int64[i].x << ", "; |
| 544 | cerr << hex << setw(16) << setfill('0') << uint32_int64[i].y << ", "; |
| 545 | cerr << "expected = " << uint32_int64[i].fExpected << endl; |
| 546 | } |
| 547 | |
| 548 | bool fSuccess = true; |
| 549 | try |
| 550 | { |
| 551 | SafeInt<unsigned __int32> si(uint32_int64[i].x); |
| 552 | si *= uint32_int64[i].y; |
| 553 | } |
| 554 | catch(...) |
| 555 | { |
| 556 | fSuccess = false; |
| 557 | } |
| 558 | |
| 559 | if( fSuccess != uint32_int64[i].fExpected ) |
| 560 | { |
| 561 | // printf("Error in case uint32_int64 throw: %I64X, %I64X, expected = %s\n", |
| 562 | // uint32_int64[i].x, uint32_int64[i].y, uint32_int64[i].fExpected ? "true" : "false"); |
| 563 | cerr << "Error in case uint32_int64 throw: "; |
| 564 | cerr << hex << setw(16) << setfill('0') << uint32_int64[i].x << ", "; |
| 565 | cerr << hex << setw(16) << setfill('0') << uint32_int64[i].y << ", "; |
| 566 | cerr << "expected = " << uint32_int64[i].fExpected << endl; |
| 567 | } |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | static const MultTest< unsigned __int64, __int64 > uint64_int64[] = |
| 572 | { |
no test coverage detected