2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-14 00:32:11 +00:00

Cleaned up and extended internal Boost Jam strings.c module unit tests.

[SVN r79040]
This commit is contained in:
Jurko Gospodnetić
2012-06-24 00:00:35 +00:00
parent 50fdc84a85
commit 6b36cfa238

View File

@@ -188,22 +188,31 @@ char string_back( string * self )
#ifndef NDEBUG
void string_unit_test()
{
string s[ 1 ];
int i;
char buffer[ sizeof( s->opt ) * 2 + 2 ];
int limit = sizeof( buffer ) > 254 ? 254 : sizeof( buffer );
string_new( s );
for ( i = 0; i < limit; ++i )
string_push_back( s, (char)( i + 1 ) );
for ( i = 0; i < limit; ++i )
{
assert( i < s->size );
assert( s->value[ i ] == (char)( i + 1 ) );
string s[ 1 ];
int i;
int const limit = sizeof( s->opt ) * 2 + 2;
string_new( s );
assert( s->value == s->opt );
for ( i = 0; i < limit; ++i )
{
string_push_back( s, (char)( i + 1 ) );
assert( s->size == i + 1 );
}
assert( s->size == limit );
assert( s->value != s->opt );
for ( i = 0; i < limit; ++i )
assert( s->value[ i ] == (char)( i + 1 ) );
string_free( s );
}
string_free( s );
{
char * const original = " \n\t\v Foo \r\n\v \tBar\n\n\r\r\t\n\v\t \t";
string copy[ 1 ];
string_copy( copy, original );
assert( !strcmp( copy->value, original ) );
assert( copy->size == strlen( original ) );
string_free( copy );
}
}
#endif