You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
723 B
43 lines
723 B
2 years ago
|
#include <stdlib.h>
|
||
|
#include "crtlib.h"
|
||
|
|
||
|
int Test_Strcpycatcmp( void )
|
||
|
{
|
||
|
char buf[] = "meowmeowmeow", buf2[] = "barkbark";
|
||
|
char dst[64];
|
||
|
|
||
|
if( Q_strncpy( dst, buf, sizeof( dst )) != sizeof( buf ) - 1 )
|
||
|
return 1;
|
||
|
|
||
|
if( Q_strcmp( dst, buf ))
|
||
|
return 2;
|
||
|
|
||
|
if( Q_strcpy( dst, buf ) != sizeof( buf ) - 1 )
|
||
|
return 3;
|
||
|
|
||
|
if( Q_strcmp( dst, buf ))
|
||
|
return 4;
|
||
|
|
||
|
if( !Q_strcmp( dst, buf2 ))
|
||
|
return 5;
|
||
|
|
||
|
if( Q_strncat( dst, buf2, sizeof( dst )) != sizeof( buf ) + sizeof( buf2 ) - 2 )
|
||
|
return 6;
|
||
|
|
||
|
if( Q_strcmp( dst, "meowmeowmeowbarkbark" ))
|
||
|
return 7;
|
||
|
|
||
|
if( Q_strncmp( dst, buf, sizeof( buf ) - 1 ))
|
||
|
return 8;
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int main( void )
|
||
|
{
|
||
|
if( Test_Strcpycatcmp( ))
|
||
|
return EXIT_FAILURE;
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|