int StrCmp( const char des, const char src)
… {
int c;
if (des == NULL || src == NULL)
throw “ NULL point “ ;
int len1 = strlen(des);
int len2 = strlen(src);
if (len1 != len2)
… {
return len1 - len2; }
while ( des != ‘ /0 ‘ )
… {
if ((c = ( des ++ - * src ++ )) != 0 )
… {
return c; }
}
return c; }
测试用例:
1.字符串为AscII串,并且src和des不为空,测试中以src和des长度分类
2.字符串为高AscII串…..
3.字符串为DBCS串
4.字符串中包含DBCS和ASCII
5.src或者des为NULL
6.src和des为””