Changeset 7880 for trunk/psLib/test/sys
- Timestamp:
- Jul 12, 2006, 11:25:39 AM (20 years ago)
- Location:
- trunk/psLib/test/sys
- Files:
-
- 1 added
- 5 edited
-
. (modified) (1 prop)
-
.cvsignore (modified) (1 diff)
-
Makefile.am (modified) (2 diffs)
-
tap_psStringSubstitute.c (added)
-
tst_psString.c (modified) (4 diffs)
-
verified/tst_psString.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sys
- Property svn:ignore
-
old new 17 17 core 18 18 core.* 19 tap_psStringSubstitute
-
- Property svn:ignore
-
trunk/psLib/test/sys/.cvsignore
r7210 r7880 17 17 core 18 18 core.* 19 tap_psStringSubstitute -
trunk/psLib/test/sys/Makefile.am
r7210 r7880 11 11 tst_psMemory \ 12 12 tst_psString \ 13 tst_psTrace 13 tst_psTrace \ 14 tap_psStringSubstitute 14 15 15 16 tst_psAbort_SOURCES = tst_psAbort.c … … 20 21 tst_psString_SOURCES = tst_psString.c 21 22 tst_psTrace_SOURCES = tst_psTrace.c 23 24 tap_psStringSubstitute_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/test/tap/src 25 tap_psStringSubstitute_LDFLAGS = $(AM_LDFLAGS) $(top_builddir)/test/tap/src/libtap.la 22 26 23 27 check_DATA = -
trunk/psLib/test/sys/tst_psString.c
r7831 r7880 20 20 * @author Eric Van Alst, MHPCC 21 21 * 22 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $23 * @date $Date: 2006-07- 06 22:26:13$22 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 23 * @date $Date: 2006-07-12 21:25:39 $ 24 24 * 25 25 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 53 53 static psS32 testStrSplit00(void); 54 54 static psS32 testNULLStrings(void); 55 static psS32 testStrSub(void);56 55 57 56 testDescription tests[] = { … … 75 74 {testStrSplit00,15, "Test String Splitting", 0, false}, 76 75 {testNULLStrings,666, "Test NULL String Error Handling", 0, false}, 77 {testStrSub,16, "Test String Substitute", 0, false},78 76 {NULL} 79 77 }; … … 711 709 return 0; 712 710 } 713 714 static psS32 testStrSub(void)715 {716 psString input = NULL;717 char str[35];718 strncpy(str, "This is, a, test case, to check.", 35);719 720 //Return str for NULL key721 input = psStringSubstitute(str, ",", NULL);722 if (input != NULL) {723 psError(PS_ERR_BAD_PARAMETER_NULL, true,724 "psStringSubstitute failed to return unchanged str for NULL key.\n");725 psFree(input);726 return 1;727 }728 //Return NULL for empty key729 input = psStringSubstitute(str, ",", "");730 if (input != NULL) {731 psError(PS_ERR_BAD_PARAMETER_NULL, true,732 "psStringSubstitute failed to return unchanged str for empty key.\n");733 psFree(input);734 return 2;735 }736 //Return NULL for NULL replace737 input = psStringSubstitute(str, NULL, ",");738 if (input != NULL) {739 psError(PS_ERR_BAD_PARAMETER_NULL, true,740 "psStringSubstitute failed to return unchanged str for NULL replace.\n");741 psFree(input);742 return 3;743 }744 //Return NULL for NULL input745 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");746 input = psStringSubstitute(NULL, "", ",");747 if (input != NULL) {748 psError(PS_ERR_BAD_PARAMETER_NULL, true,749 "psStringSubstitute failed to return NULL for NULL input.\n");750 psFree(input);751 return 4;752 }753 //Return empty string for empty input string754 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");755 input = psStringSubstitute("", "", ",");756 if (input != NULL) {757 psError(PS_ERR_BAD_PARAMETER_NULL, true,758 "psStringSubstitute failed to return empty string for empty input string.\n");759 psFree(input);760 return 5;761 }762 //Check valid test case, changing commas to exclamation points763 input = psStringSubstitute(str, "!", ",");764 if (strcmp(input, "This is! a! test case! to check.") != 0 ) {765 psError(PS_ERR_BAD_PARAMETER_VALUE, true,766 "psStringSubstitute failed to return the correct output string.\n");767 psFree(input);768 return 7;769 }770 psFree(input);771 input = NULL;772 //Check valid test case, remove exclamation points773 input = psStringSubstitute(str, "", ",");774 if (strcmp(input, "This is a test case to check.") != 0 ) {775 psError(PS_ERR_BAD_PARAMETER_VALUE, true,776 "psStringSubstitute failed to return the correct output string.\n");777 psFree(input);778 return 8;779 }780 psFree(input);781 input = NULL;782 //Check case where replacement is long. Should still work now.783 input = psStringSubstitute(str, "; This string is too long to fit in str(35 chars)", ".");784 if (strcmp(input,"This is, a, test case, to check; This string is too long to fit in str(35 chars)") != 0 ) {785 psError(PS_ERR_BAD_PARAMETER_VALUE, true,786 "psStringSubstitute failed to return the correct output string.\n");787 psFree(input);788 return 9;789 }790 psFree(input);791 792 return 0;793 } -
trunk/psLib/test/sys/verified/tst_psString.stderr
r7831 r7880 175 175 ---> TESTPOINT PASSED (psString{Test NULL String Error Handling} | tst_psString.c) 176 176 177 /***************************** TESTPOINT ******************************************\178 * TestFile: tst_psString.c *179 * TestPoint: psString{Test String Substitute} *180 * TestType: Positive *181 \**********************************************************************************/182 183 <DATE><TIME>|<HOST>|I|testStrSub184 Following should generate error message185 <DATE><TIME>|<HOST>|E|psStringSubstitute (FILE:LINENO)186 Invalid string in psStringSubstitute. Input cannot be NULL or empty.187 <DATE><TIME>|<HOST>|I|testStrSub188 Following should generate error message189 <DATE><TIME>|<HOST>|E|psStringSubstitute (FILE:LINENO)190 Invalid string in psStringSubstitute. Input cannot be NULL or empty.191 192 ---> TESTPOINT PASSED (psString{Test String Substitute} | tst_psString.c)193
Note:
See TracChangeset
for help on using the changeset viewer.
