Changeset 6278 for trunk/psLib/test/sys/tst_psString.c
- Timestamp:
- Feb 1, 2006, 10:40:56 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/sys/tst_psString.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sys/tst_psString.c
r6218 r6278 20 20 * @author Eric Van Alst, MHPCC 21 21 * 22 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $23 * @date $Date: 2006-0 1-27 01:49:05$22 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 23 * @date $Date: 2006-02-01 20:40:56 $ 24 24 * 25 25 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 53 53 static psS32 testStrSplit00(void); 54 static psS32 testNULLStrings(void); 54 55 55 56 testDescription tests[] = { … … 72 73 {testStrPrepend03,14, "Test prepend null-op", 0, false}, 73 74 {testStrSplit00,15, "Test String Splitting", 0, false}, 75 {testNULLStrings,666, "Test NULL String Error Handling", 0, false}, 74 76 {NULL} 75 77 }; … … 619 621 } 620 622 623 static psS32 testNULLStrings(void) 624 { 625 psString nullTest = NULL; 626 psString output = NULL; 627 ssize_t outSize = 0; 628 char** nullDest = NULL; 629 char** test; 630 //psStringCopy should return NULL for NULL input string 631 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 632 output = psStringCopy(nullTest); 633 if (output != NULL) { 634 psError(PS_ERR_BAD_PARAMETER_NULL, false, 635 "psStringCopy failed to return NULL for NULL input string.\n"); 636 return 1; 637 } 638 //psStringNCopy should return NULL for NULL input string 639 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 640 output = psStringNCopy(nullTest, 100); 641 if (output != NULL) { 642 psError(PS_ERR_BAD_PARAMETER_NULL, false, 643 "psStringNCopy failed to return NULL for NULL input string.\n"); 644 return 2; 645 } 646 647 //psStringAppend should return 0 for NULL input destination 648 outSize = psStringAppend(nullDest, ""); 649 if (outSize != 0) { 650 psError(PS_ERR_BAD_PARAMETER_NULL, false, 651 "psStringAppend failed to return 0 for NULL input destination.\n"); 652 return 3; 653 } 654 //psStringAppend should return 0 for NULL input format 655 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 656 outSize = psStringAppend(test, nullTest); 657 if (outSize != 0) { 658 psError(PS_ERR_BAD_PARAMETER_NULL, false, 659 "psStringAppend failed to return 0 for NULL input format.\n"); 660 return 4; 661 } 662 //psStringPrepend should return 0 for NULL input destination 663 outSize = psStringPrepend(nullDest, " "); 664 if (outSize != 0) { 665 psError(PS_ERR_BAD_PARAMETER_NULL, false, 666 "psStringPrepend failed to return 0 for NULL input destination.\n"); 667 return 3; 668 } 669 //psStringPrepend should return 0 for NULL input format 670 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 671 outSize = psStringPrepend(test, nullTest); 672 if (outSize != 0) { 673 psError(PS_ERR_BAD_PARAMETER_NULL, false, 674 "psStringPrepend failed to return 0 for NULL input format.\n"); 675 return 4; 676 } 677 //psStringSplit should return NULL for NULL input string 678 psList *nullList = NULL; 679 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 680 nullList = psStringSplit(nullTest, ","); 681 if (nullList != NULL) { 682 psError(PS_ERR_BAD_PARAMETER_NULL, false, 683 "psStringSplit failed to return NULL for NULL input string.\n"); 684 return 5; 685 } 686 //psStringSplit should return NULL for NULL input splitter 687 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 688 nullList = psStringSplit("Hello World", nullTest); 689 if (nullList != NULL) { 690 psError(PS_ERR_BAD_PARAMETER_NULL, false, 691 "psStringSplit failed to return NULL for NULL input splitter.\n"); 692 return 6; 693 } 694 695 return 0; 696 } 697
Note:
See TracChangeset
for help on using the changeset viewer.
