home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 January
/
Chip_2001-01_cd1.bin
/
tema
/
mysql
/
mysql-3.23.28g-win-source.exe
/
strings
/
c_test4.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-11-16
|
1KB
|
55 lines
/* simple test if sort works correctly for sorting with my_strncoll */
#ifdef DBUG_OFF
#undef DBUG_OFF
#endif
#include <global.h>
#include <my_sys.h>
#include "m_ctype.h"
#include "m_string.h"
#define FROM 'm'
#define TO 'z'
main(int argc,char *argv[])
{
int i,j,k,l,count,loop,errors;
char a[10],b[10];
DBUG_ENTER ("main");
DBUG_PROCESS (argv[0]);
count=loop=errors=0;
for (i=FROM ; i < TO ; i++)
{
for (j=FROM ; j < TO ; j++)
{
loop++;
for (k=FROM ; k < TO ; k++)
{
for (l=FROM ; l < TO ; l++)
{
count++;
a[0]=i; a[1]=j;
b[0]=k; b[1]=l;
a[2]=(char) count; b[2]= (char) loop; /* Catch overflows */
if (my_strnncoll(a, 2, b, 2) !=
-my_strnncoll(b, 2, a, 2))
{
errors++;
printf("my_strncoll failed for: %2.2s %2.2s: %d != %d\n",
my_strnncoll(a, 2, b, 2),
-my_strnncoll(b, 2, a, 2));
if (errors++ > 10)
{
printf("aborted\n");
DBUG_RETURN(1);
}
}
}
}
}
}
DBUG_RETURN(errors != 0);
}