Converted some of the test routines to use the new epicsUnitTest facility.

This commit is contained in:
Andrew Johnson
2006-03-30 20:13:25 +00:00
parent 97a5aa16a0
commit 4d67f3596a
10 changed files with 357 additions and 396 deletions

View File

@@ -7,46 +7,42 @@
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* epicsStdioTest.c
/* $Id$
*
* Author Marty Kraimer
*/
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include "epicsUnitTest.h"
#include "epicsString.h"
int epicsStringTest()
{
if(epicsStrnCaseCmp("","",0)!=0) printf("case 1 failed\n");
if(epicsStrnCaseCmp("","",1)!=0) printf("case 2 failed\n");
if(epicsStrnCaseCmp(" ","",1)!=-1) printf("case 3 failed\n");
if(epicsStrnCaseCmp(""," ",1)!=1) printf("case 4 failed\n");
if(epicsStrnCaseCmp("a","A",1)!=0) printf("case 5 failed\n");
if(epicsStrnCaseCmp("a","A",2)!=0) printf("case 6 failed\n");
if(epicsStrnCaseCmp("abcd","ABCD",2)!=0) printf("case 7 failed\n");
if(epicsStrnCaseCmp("abcd","ABCD",4)!=0) printf("case 8 failed\n");
if(epicsStrnCaseCmp("abcd","ABCD",1000)!=0) printf("case 9 failed\n");
if(epicsStrnCaseCmp("abcd","ABCDE",2)!=0) printf("case 10 failed\n");
if(epicsStrnCaseCmp("abcd","ABCDE",4)!=0) printf("case 11 failed\n");
if(epicsStrnCaseCmp("abcd","ABCDE",1000)!=1) printf("case 12 failed\n");
if(epicsStrnCaseCmp("abcde","ABCD",2)!=0) printf("case 13 failed\n");
if(epicsStrnCaseCmp("abcde","ABCD",4)!=0) printf("case 14 failed\n");
if(epicsStrnCaseCmp("abcde","ABCD",1000)!=-1) printf("case 15 failed\n");
testPlan(21);
testOk1(epicsStrnCaseCmp("","",0)==0);
testOk1(epicsStrnCaseCmp("","",1)==0);
testOk1(epicsStrnCaseCmp(" ","",1)<0);
testOk1(epicsStrnCaseCmp(""," ",1)>0);
testOk1(epicsStrnCaseCmp("a","A",1)==0);
testOk1(epicsStrnCaseCmp("a","A",2)==0);
testOk1(epicsStrnCaseCmp("abcd","ABCD",2)==0);
testOk1(epicsStrnCaseCmp("abcd","ABCD",4)==0);
testOk1(epicsStrnCaseCmp("abcd","ABCD",1000)==0);
testOk1(epicsStrnCaseCmp("abcd","ABCDE",2)==0);
testOk1(epicsStrnCaseCmp("abcd","ABCDE",4)==0);
testOk1(epicsStrnCaseCmp("abcd","ABCDE",1000)>0);
testOk1(epicsStrnCaseCmp("abcde","ABCD",2)==0);
testOk1(epicsStrnCaseCmp("abcde","ABCD",4)==0);
testOk1(epicsStrnCaseCmp("abcde","ABCD",1000)<0);
if(epicsStrCaseCmp("","")!=0) printf("case 16 failed\n");
if(epicsStrCaseCmp("a","A")!=0) printf("case 17 failed\n");
if(epicsStrCaseCmp("abcd","ABCD")!=0) printf("case 18 failed\n");
if(epicsStrCaseCmp("abcd","ABCDE")==0) printf("case 19 failed\n");
if(epicsStrCaseCmp("abcde","ABCD")==0) printf("case 20 failed\n");
if(epicsStrCaseCmp("abcde","ABCDF")==0) printf("case 21 failed\n");
testOk1(epicsStrCaseCmp("","")==0);
testOk1(epicsStrCaseCmp("a","A")==0);
testOk1(epicsStrCaseCmp("abcd","ABCD")==0);
testOk1(epicsStrCaseCmp("abcd","ABCDE")!=0);
testOk1(epicsStrCaseCmp("abcde","ABCD")!=0);
testOk1(epicsStrCaseCmp("abcde","ABCDF")!=0);
printf("String comparison tests completed.\n");
return(0);
return testDone();
}