43 const char *address_holder;
47 static const char LONG_STRING[] =
"A professional panoramic photograph of the majestic elephant bathing itself and its young by the shores of the raging Mississippi River";
66 info->name =
"string_field_test";
67 info->category =
"/main/utils/";
68 info->summary =
"Test stringfield operations";
70 "This tests the stringfield API";
205 ast_test_status_update(
test,
"All right, now we're going to expand string 2. It should stay in place since it was the last string allocated in this pool\n");
210 if (strcmp(
test_struct.string2,
"hippopotamus face")) {
232 ast_test_status_update(
test,
"Now we're going to set string1 to a very long string so that a new string field pool must be allocated\n");
252 ast_test_status_update(
test,
"The string field allocation for string1 indicates a length of %hu instead of the expected %lu\n",
260 ast_test_status_update(
test,
"Now using a totally separate area of memory we're going to test a basic pool freeing scenario\n");
269 ast_string_field_set(&test_struct2, string1,
"Expanded first string to create new pool-----------------------------------------------------------------------------------------------------------------------------------------------------------------------");
271 ast_string_field_set(&test_struct2, string2,
"Expanded second string to create new pool----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
273 field_pool3 = test_struct2.__field_mgr_pool;
274 field_pool2 = test_struct2.__field_mgr_pool->
prev;
275 field_pool1 = test_struct2.__field_mgr_pool->
prev->
prev;
277 if(field_pool3->
prev != field_pool2 || field_pool2->
prev != field_pool1) {
#define ast_string_field_init_extended(x, field)
Initialize an extended string field.
const char * __ast_string_field_empty
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD_ALLOCATION(x)
Macro to provide access to the allocation field that lives immediately in front of a string field...
#define AST_STRING_FIELD_EXTENDED(name)
Declare an extended string field.
#define ast_test_status_update(a, b, c...)
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define AST_STRING_FIELD(name)
Declare a string field.
struct ast_string_field_pool * prev
const ast_string_field string1
int error(const char *format,...)
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.