MCPcopy Create free account
hub / github.com/boostorg/build / string_unit_test

Function string_unit_test

src/engine/strings.c:194–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192
193#ifndef NDEBUG
194void string_unit_test()
195{
196 {
197 string s[ 1 ];
198 int i;
199 int const limit = sizeof( s->opt ) * 2 + 2;
200 string_new( s );
201 assert( s->value == s->opt );
202 for ( i = 0; i < limit; ++i )
203 {
204 string_push_back( s, (char)( i + 1 ) );
205 assert( s->size == i + 1 );
206 }
207 assert( s->size == limit );
208 assert( s->value != s->opt );
209 for ( i = 0; i < limit; ++i )
210 assert( s->value[ i ] == (char)( i + 1 ) );
211 string_free( s );
212 }
213
214 {
215 char * const original = " \n\t\v Foo \r\n\v \tBar\n\n\r\r\t\n\v\t \t";
216 string copy[ 1 ];
217 string_copy( copy, original );
218 assert( !strcmp( copy->value, original ) );
219 assert( copy->size == strlen( original ) );
220 string_free( copy );
221 }
222}
223#endif

Callers 1

run_unit_testsFunction · 0.85

Calls 4

string_newFunction · 0.85
string_push_backFunction · 0.85
string_freeFunction · 0.85
string_copyFunction · 0.85

Tested by

no test coverage detected