public: add test case for COM_FixSlashes

This commit is contained in:
Alibek Omarov 2024-07-04 06:42:35 +03:00
parent 59b9b31604
commit 58bfa247a4

View file

@ -57,6 +57,30 @@ static int Test_Colorstr( void )
return 0; return 0;
} }
static int Test_FixSlashes( void )
{
string s = "path\\with\\back\\slashes";
string s2 = "path/with/fwd/slashes";
string s3 = "path\\with/mixed\\slashes";
COM_FixSlashes( s );
if( Q_strcmp( s, "path/with/back/slashes" ))
return 1;
COM_FixSlashes( s2 );
if( Q_strcmp( s2, "path/with/fwd/slashes" ))
return 2;
COM_FixSlashes( s3 );
if( Q_strcmp( s3, "path/with/mixed/slashes" ))
return 3;
return 0;
}
int main( void ) int main( void )
{ {
int ret = Test_Strcpycatcmp(); int ret = Test_Strcpycatcmp();
@ -74,5 +98,10 @@ int main( void )
if( ret > 0 ) if( ret > 0 )
return ret + 32; return ret + 32;
ret = Test_FixSlashes();
if( ret > 0 )
return ret + 48;
return 0; return 0;
} }