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) {
321 info->name =
"string_field_aggregate_test";
322 info->category =
"/main/utils/";
323 info->summary =
"Test stringfield aggregate operations";
325 "This tests the structure comparison and copy macros of the stringfield API";
395 ast_string_field_set(inst3, string2,
"baz 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890");
414 ast_string_field_set(inst4, string2,
"baz 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890");
#define ast_string_field_init_extended(x, field)
Initialize an extended string field.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk main include file. File version handling, generic pbx functions.
struct ast_string_field_pool * embedded_pool
#define AST_TEST_REGISTER(cb)
#define ast_calloc_with_stringfields(n, type, size)
Allocate a structure with embedded stringfields in a single allocation.
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.
AST_TEST_DEFINE(string_field_test)
#define ast_string_fields_cmp(instance1, instance2)
Compare the string fields in two instances of the same structure.
#define ast_string_fields_copy(copy, orig)
Copy all string fields from one instance to another of the same structure.
static int unload_module(void)
struct ast_string_field_mgr __field_mgr
#define AST_TEST_UNREGISTER(cb)
#define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data)
struct ast_string_field_pool * __field_mgr_pool
Standard Command Line Interface.
static int load_module(void)
struct ast_string_field_pool * prev
const ast_string_field string1
int error(const char *format,...)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#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.