Changeset 19952 in vbox for trunk/include
- Timestamp:
- May 23, 2009 11:58:05 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 47654
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/test.h
r19944 r19952 348 348 } \ 349 349 } while (0) 350 /** @def RTTEST_CHECK_RET 351 * Check whether a boolean expression holds true, returns on false. 352 * 353 * If the expression is false, call RTTestFailed giving the line number and expression. 354 * 355 * @param hTest The test handle. 356 * @param expr The expression to evaluate. 357 * @param rcRet What to return on failure. 358 */ 359 #define RTTEST_CHECK_RET(hTest, expr, rcRet) \ 360 do { if (!(expr)) { \ 361 RTTestFailed((hTest), "line %u: %s", __LINE__, #expr); \ 362 return (rcRet); \ 363 } \ 364 } while (0) 365 /** @def RTTEST_CHECK_RETV 366 * Check whether a boolean expression holds true, returns void on false. 367 * 368 * If the expression is false, call RTTestFailed giving the line number and expression. 369 * 370 * @param hTest The test handle. 371 * @param expr The expression to evaluate. 372 */ 373 #define RTTEST_CHECK_RETV(hTest, expr) \ 374 do { if (!(expr)) { \ 375 RTTestFailed((hTest), "line %u: %s", __LINE__, #expr); \ 376 return; \ 377 } \ 378 } while (0) 379 350 380 351 381 /** @def RTTEST_CHECK_MSG … … 365 395 } \ 366 396 } while (0) 367 368 /** @def RTTEST_CHECK_RET369 * Check whether a boolean expression holds true, returns on false.370 *371 * If the expression is false, call RTTestFailed giving the line number and expression.372 *373 * @param hTest The test handle.374 * @param expr The expression to evaluate.375 * @param rcRet What to return on failure.376 */377 #define RTTEST_CHECK_RET(hTest, expr, rcRet) \378 do { if (!(expr)) { \379 RTTestFailed((hTest), "line %u: %s", __LINE__, #expr); \380 return (rcRet); \381 } \382 } while (0)383 384 397 /** @def RTTEST_CHECK_MSG_RET 385 398 * Check whether a boolean expression holds true, returns on false. … … 400 413 } \ 401 414 } while (0) 402 403 /** @def RTTEST_CHECK_RETV404 * Check whether a boolean expression holds true, returns void on false.405 *406 * If the expression is false, call RTTestFailed giving the line number and expression.407 *408 * @param hTest The test handle.409 * @param expr The expression to evaluate.410 */411 #define RTTEST_CHECK_RETV(hTest, expr) \412 do { if (!(expr)) { \413 RTTestFailed((hTest), "line %u: %s", __LINE__, #expr); \414 return; \415 } \416 } while (0)417 418 415 /** @def RTTEST_CHECK_MSG_RET 419 416 * Check whether a boolean expression holds true, returns void on false. … … 434 431 } while (0) 435 432 433 436 434 /** @def RTTEST_CHECK_RC 437 435 * Check whether an expression returns a specific IPRT style status code. … … 445 443 * more than once by the macro. 446 444 */ 447 #define RTTEST_CHECK_RC( rcExpr, rcExpect) \445 #define RTTEST_CHECK_RC(hTest, rcExpr, rcExpect) \ 448 446 do { \ 449 447 int rcCheck = (rcExpr); \ … … 452 450 } \ 453 451 } while (0) 452 /** @def RTTEST_CHECK_RC_RET 453 * Check whether an expression returns a specific IPRT style status code. 454 * 455 * If a different status code is return, call RTTestFailed giving the line 456 * number, expression, actual and expected status codes, then return. 457 * 458 * @param hTest The test handle. 459 * @param rcExpr The expression resulting an IPRT status code. 460 * @param rcExpect The expected return code. This may be referenced 461 * more than once by the macro. 462 * @param rcRet The return code. 463 */ 464 #define RTTEST_CHECK_RC_RET(hTest, rcExpr, rcExpect, rcRet) \ 465 do { \ 466 int rcCheck = (rcExpr); \ 467 if (rcCheck != (rcExpect)) { \ 468 RTTestFailed((hTest), "line %u: %s: expected %Rrc, got %Rrc", __LINE__, #rcExpr, (rcExpect), rcCheck); \ 469 return (rcRet); \ 470 } \ 471 } while (0) 472 /** @def RTTEST_CHECK_RC_RETV 473 * Check whether an expression returns a specific IPRT style status code. 474 * 475 * If a different status code is return, call RTTestFailed giving the line 476 * number, expression, actual and expected status codes, then return. 477 * 478 * @param hTest The test handle. 479 * @param rcExpr The expression resulting an IPRT status code. 480 * @param rcExpect The expected return code. This may be referenced 481 * more than once by the macro. 482 */ 483 #define RTTEST_CHECK_RC_RETV(hTest, rcExpr, rcExpect) \ 484 do { \ 485 int rcCheck = (rcExpr); \ 486 if (rcCheck != (rcExpect)) { \ 487 RTTestFailed((hTest), "line %u: %s: expected %Rrc, got %Rrc", __LINE__, #rcExpr, (rcExpect), rcCheck); \ 488 return; \ 489 } \ 490 } while (0) 491 454 492 455 493 /** @def RTTEST_CHECK_RC_OK … … 467 505 if (RT_FAILURE(rcCheck)) { \ 468 506 RTTestFailed((hTest), "line %u: %s: %Rrc", __LINE__, #rcExpr, rc); \ 507 } \ 508 } while (0) 509 /** @def RTTEST_CHECK_RC_OK_RET 510 * Check whether a IPRT style status code indicates success. 511 * 512 * If the status indicates failure, call RTTestFailed giving the line number, 513 * expression and status code, then return with the specified value. 514 * 515 * @param hTest The test handle. 516 * @param rcExpr The expression resulting an IPRT status code. 517 * @param rcRet The return code. 518 */ 519 #define RTTEST_CHECK_RC_OK_RET(hTest, rcExpr, rcRet) \ 520 do { \ 521 int rcCheck = (rcExpr); \ 522 if (RT_FAILURE(rcCheck)) { \ 523 RTTestFailed((hTest), "line %u: %s: %Rrc", __LINE__, #rcExpr, rc); \ 524 return (rcRet); \ 525 } \ 526 } while (0) 527 /** @def RTTEST_CHECK_RC_OK_RETV 528 * Check whether a IPRT style status code indicates success. 529 * 530 * If the status indicates failure, call RTTestFailed giving the line number, 531 * expression and status code, then return. 532 * 533 * @param hTest The test handle. 534 * @param rcExpr The expression resulting an IPRT status code. 535 */ 536 #define RTTEST_CHECK_RC_OK_RETV(hTest, rcExpr) \ 537 do { \ 538 int rcCheck = (rcExpr); \ 539 if (RT_FAILURE(rcCheck)) { \ 540 RTTestFailed((hTest), "line %u: %s: %Rrc", __LINE__, #rcExpr, rc); \ 541 return; \ 469 542 } \ 470 543 } while (0) … … 619 692 } \ 620 693 } while (0) 694 /** @def RTTESTI_CHECK_RET 695 * Check whether a boolean expression holds true, returns on false. 696 * 697 * If the expression is false, call RTTestIFailed giving the line number and 698 * expression. 699 * 700 * @param expr The expression to evaluate. 701 * @param rcRet What to return on failure. 702 */ 703 #define RTTESTI_CHECK_RET(expr, rcRet) \ 704 do { if (!(expr)) { \ 705 RTTestIFailed("line %u: %s", __LINE__, #expr); \ 706 return (rcRet); \ 707 } \ 708 } while (0) 709 /** @def RTTESTI_CHECK_RETV 710 * Check whether a boolean expression holds true, returns void on false. 711 * 712 * If the expression is false, call RTTestIFailed giving the line number and 713 * expression. 714 * 715 * @param expr The expression to evaluate. 716 */ 717 #define RTTESTI_CHECK_RETV(expr) \ 718 do { if (!(expr)) { \ 719 RTTestIFailed("line %u: %s", __LINE__, #expr); \ 720 return; \ 721 } \ 722 } while (0) 723 621 724 622 725 /** @def RTTESTI_CHECK_MSG … … 636 739 } \ 637 740 } while (0) 638 639 /** @def RTTESTI_CHECK_RET640 * Check whether a boolean expression holds true, returns on false.641 *642 * If the expression is false, call RTTestIFailed giving the line number and643 * expression.644 *645 * @param expr The expression to evaluate.646 * @param rcRet What to return on failure.647 */648 #define RTTESTI_CHECK_RET(expr, rcRet) \649 do { if (!(expr)) { \650 RTTestIFailed("line %u: %s", __LINE__, #expr); \651 return (rcRet); \652 } \653 } while (0)654 655 741 /** @def RTTESTI_CHECK_MSG_RET 656 742 * Check whether a boolean expression holds true, returns on false. … … 671 757 } \ 672 758 } while (0) 673 674 /** @def RTTESTI_CHECK_RETV675 * Check whether a boolean expression holds true, returns void on false.676 *677 * If the expression is false, call RTTestIFailed giving the line number and678 * expression.679 *680 * @param expr The expression to evaluate.681 */682 #define RTTESTI_CHECK_RETV(expr) \683 do { if (!(expr)) { \684 RTTestIFailed("line %u: %s", __LINE__, #expr); \685 return; \686 } \687 } while (0)688 689 759 /** @def RTTESTI_CHECK_MSG_RET 690 760 * Check whether a boolean expression holds true, returns void on false. … … 705 775 } while (0) 706 776 777 707 778 /** @def RTTESTI_CHECK_RC 708 779 * Check whether an expression returns a specific IPRT style status code. … … 722 793 } \ 723 794 } while (0) 795 /** @def RTTESTI_CHECK_RC_RET 796 * Check whether an expression returns a specific IPRT style status code. 797 * 798 * If a different status code is return, call RTTestIFailed giving the line 799 * number, expression, actual and expected status codes, then return. 800 * 801 * @param rcExpr The expression resulting an IPRT status code. 802 * @param rcExpect The expected return code. This may be referenced 803 * more than once by the macro. 804 * @param rcRet The return code. 805 */ 806 #define RTTESTI_CHECK_RC_RET(rcExpr, rcExpect, rcRet) \ 807 do { \ 808 int rcCheck = (rcExpr); \ 809 if (rcCheck != (rcExpect)) { \ 810 RTTestIFailed("line %u: %s: expected %Rrc, got %Rrc", __LINE__, #rcExpr, (rcExpect), rcCheck); \ 811 return (rcRet); \ 812 } \ 813 } while (0) 814 /** @def RTTESTI_CHECK_RC_RETV 815 * Check whether an expression returns a specific IPRT style status code. 816 * 817 * If a different status code is return, call RTTestIFailed giving the line 818 * number, expression, actual and expected status codes, then return. 819 * 820 * @param rcExpr The expression resulting an IPRT status code. 821 * @param rcExpect The expected return code. This may be referenced 822 * more than once by the macro. 823 */ 824 #define RTTESTI_CHECK_RC_RETV(rcExpr, rcExpect) \ 825 do { \ 826 int rcCheck = (rcExpr); \ 827 if (rcCheck != (rcExpect)) { \ 828 RTTestIFailed("line %u: %s: expected %Rrc, got %Rrc", __LINE__, #rcExpr, (rcExpect), rcCheck); \ 829 return; \ 830 } \ 831 } while (0) 832 724 833 725 834 /** @def RTTESTI_CHECK_RC_OK … … 738 847 } \ 739 848 } while (0) 740 849 /** @def RTTESTI_CHECK_RC_OK_RET 850 * Check whether a IPRT style status code indicates success. 851 * 852 * If the status indicates failure, call RTTestIFailed giving the line number, 853 * expression and status code, then return with the specified value. 854 * 855 * @param rcExpr The expression resulting an IPRT status code. 856 * @param rcRet The return code. 857 */ 858 #define RTTESTI_CHECK_RC_OK_RET(rcExpr, rcRet) \ 859 do { \ 860 int rcCheck = (rcExpr); \ 861 if (RT_FAILURE(rcCheck)) { \ 862 RTTestIFailed("line %u: %s: %Rrc", __LINE__, #rcExpr, rcCheck); \ 863 return (rcRet); \ 864 } \ 865 } while (0) 866 /** @def RTTESTI_CHECK_RC_OK_RETV 867 * Check whether a IPRT style status code indicates success. 868 * 869 * If the status indicates failure, call RTTestIFailed giving the line number, 870 * expression and status code, then return. 871 * 872 * @param rcExpr The expression resulting an IPRT status code. 873 */ 874 #define RTTESTI_CHECK_RC_OK_RETV(rcExpr) \ 875 do { \ 876 int rcCheck = (rcExpr); \ 877 if (RT_FAILURE(rcCheck)) { \ 878 RTTestIFailed("line %u: %s: %Rrc", __LINE__, #rcExpr, rcCheck); \ 879 return; \ 880 } \ 881 } while (0) 741 882 742 883 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.