version 1.1.1.1, 2011/06/08 07:09:12
|
version 1.1.1.2, 2012/02/17 12:50:02
|
Line 2105 axl_bool test_22 (axlError ** error)
|
Line 2105 axl_bool test_22 (axlError ** error)
|
axl_error_new (-1, "Expected to find 11 attributes", NULL, error); |
axl_error_new (-1, "Expected to find 11 attributes", NULL, error); |
return axl_false; |
return axl_false; |
} |
} |
|
|
|
printf ("Test 22: removing attribute 1, current attributes are %d\n", axl_node_num_attributes (node)); |
axl_node_remove_attribute (node, "attribute1"); |
axl_node_remove_attribute (node, "attribute1"); |
|
printf ("Test 22: after removing attribute 1, current attributes are %d\n", axl_node_num_attributes (node)); |
|
|
if (axl_node_num_attributes (node) != 10) { |
if (axl_node_num_attributes (node) != 10) { |
axl_error_new (-1, "Expected to find 10 attributes", NULL, error); | axl_error_report (error, -1, "Expected to find 10 attributes, but found: %d", axl_node_num_attributes (node)); |
return axl_false; |
return axl_false; |
} |
} |
|
|
Line 5257 axl_bool test_01e (axlError ** error)
|
Line 5260 axl_bool test_01e (axlError ** error)
|
{ |
{ |
axlDoc * doc; |
axlDoc * doc; |
axlNode * node; |
axlNode * node; |
const char * content; |
|
int size; |
int size; |
|
|
/* parse document */ |
/* parse document */ |
Line 5267 axl_bool test_01e (axlError ** error)
|
Line 5269 axl_bool test_01e (axlError ** error)
|
|
|
/* get root node */ |
/* get root node */ |
node = axl_doc_get_root (doc); |
node = axl_doc_get_root (doc); |
content = axl_node_get_content (node, &size); | if (! axl_node_get_content (node, &size)) |
| return axl_false; |
|
|
/* free document */ |
/* free document */ |
axl_doc_free (doc); |
axl_doc_free (doc); |
Line 5348 axl_bool test_01f (axlError ** error)
|
Line 5351 axl_bool test_01f (axlError ** error)
|
* |
* |
* @return axl_true if it works properly or axl_false if not. |
* @return axl_true if it works properly or axl_false if not. |
*/ |
*/ |
axl_bool test_01_01 () | axl_bool test_01_01 (void) |
{ |
{ |
axlList * list; |
axlList * list; |
int value; | int value; |
|
|
axlPointer ptr1; |
axlPointer ptr1; |
axlPointer ptr2; |
axlPointer ptr2; |
Line 5690 axl_bool test_01_01 ()
|
Line 5693 axl_bool test_01_01 ()
|
|
|
/* get the integer value */ |
/* get the integer value */ |
value = PTR_TO_INT (axl_list_get_first (list)); |
value = PTR_TO_INT (axl_list_get_first (list)); |
|
|
|
if (! (value > 0)) { |
|
printf ("Expected to not find any item under 0..\n"); |
|
return axl_false; |
|
} |
|
|
/* remove */ |
/* remove */ |
axl_list_unlink_first (list); |
axl_list_unlink_first (list); |
Line 5912 axl_bool test_01_02_foreach (axlPointer stack_data,
|
Line 5920 axl_bool test_01_02_foreach (axlPointer stack_data,
|
* @return axl_true if the stack works properly, otherwise axl_false |
* @return axl_true if the stack works properly, otherwise axl_false |
* is returned. |
* is returned. |
*/ |
*/ |
axl_bool test_01_02 () | axl_bool test_01_02 (void) |
{ |
{ |
axlStack * stack; |
axlStack * stack; |
char * value; |
char * value; |
Line 5999 axl_bool test_01_03_vargs (const char * format, ...)
|
Line 6007 axl_bool test_01_03_vargs (const char * format, ...)
|
return axl_true; |
return axl_true; |
} |
} |
|
|
|
axl_bool test_01_03_replace_check (const char * _source, const char * string, const char * replacement, int check_size, const char * result_string) |
|
{ |
|
char * source; |
|
int res; |
|
|
|
printf ("Test 01-03: Checking %s (%s -> %s)\n", _source, string, replacement); |
|
|
|
source = axl_strdup (_source); |
|
res = axl_stream_replace (&source, -1, string, -1, replacement, -1); |
|
if (res != check_size) { |
|
printf ("ERROR: expected to find %d bytes but found %d at the replacement\n", check_size, res); |
|
return axl_false; |
|
} |
|
/* check replacement */ |
|
if (! axl_cmp (source, result_string)) { |
|
printf ("ERROR: expected to find '%s' but found '%s'\n", result_string, source); |
|
return axl_false; |
|
} |
|
axl_free (source); |
|
|
|
return axl_true; |
|
} |
|
|
/** |
/** |
* |
* |
* @brief Checks some internal functions that the library provides to |
* @brief Checks some internal functions that the library provides to |
Line 6007 axl_bool test_01_03_vargs (const char * format, ...)
|
Line 6038 axl_bool test_01_03_vargs (const char * format, ...)
|
* @return The function must return axl_true if everything is |
* @return The function must return axl_true if everything is |
* ok. Otherwise axl_false is returned. |
* ok. Otherwise axl_false is returned. |
*/ |
*/ |
axl_bool test_01_03 () | axl_bool test_01_03 (void) |
{ |
{ |
char * string; |
char * string; |
char ** result; |
char ** result; |
Line 6334 axl_bool test_01_03 ()
|
Line 6365 axl_bool test_01_03 ()
|
return axl_false; |
return axl_false; |
} |
} |
|
|
res = axl_stream_printf_len ("%lu", (unsigned long int) 182); | res = axl_stream_printf_len ("%lu", (unsigned long) 182); |
if ( res != 4) { |
if ( res != 4) { |
printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res); |
printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res); |
return axl_false; |
return axl_false; |
Line 6725 axl_bool test_01_03 ()
|
Line 6756 axl_bool test_01_03 ()
|
axl_free (string); |
axl_free (string); |
|
|
|
|
|
/* check replacement */ |
|
if (! test_01_03_replace_check ("1) This is a test", "test", "prueba", 19, "1) This is a prueba")) |
|
return axl_false; |
|
|
|
/* source, string, replace, check_size, result */ |
|
if (! test_01_03_replace_check ("test", "test", "prueba", 6, "prueba")) |
|
return axl_false; |
|
|
|
if (! test_01_03_replace_check ("3) We are going to replace o o this is a test", "o", "####", 57, "3) We are g####ing t#### replace #### #### this is a test")) |
|
return axl_false; |
|
|
|
if (! test_01_03_replace_check ("4) We are g####ing t#### replace #### #### this is a test", "####", "o", 45, "4) We are going to replace o o this is a test")) |
|
return axl_false; |
|
|
|
if (! test_01_03_replace_check ("oooo", "o", "i", 4, "iiii")) |
|
return axl_false; |
|
|
|
if (! test_01_03_replace_check ("oooo", "o", "ii", 8, "iiiiiiii")) |
|
return axl_false; |
|
|
|
if (! test_01_03_replace_check (" tes", "test", "asdfsdf", 4, " tes")) |
|
return axl_false; |
|
|
return axl_true; |
return axl_true; |
} |
} |
|
|
/** |
/** |
* @brief Intensive axl list implementation. |
* @brief Intensive axl list implementation. |
*/ |
*/ |
axl_bool test_01_04 () { | axl_bool test_01_04 (void) { |
int iterator = 0; |
int iterator = 0; |
int value; |
int value; |
axlList * list; |
axlList * list; |
Line 6823 axl_bool test_01_04 () {
|
Line 6877 axl_bool test_01_04 () {
|
/** |
/** |
* @brief Check axl list remove at API. |
* @brief Check axl list remove at API. |
*/ |
*/ |
axl_bool test_01_04_a () { | axl_bool test_01_04_a (void) { |
axlList * list; |
axlList * list; |
char * value; |
char * value; |
char * value2; |
char * value2; |
Line 6957 axl_bool test_01_04_a () {
|
Line 7011 axl_bool test_01_04_a () {
|
* |
* |
* @return \ref axl_true if ok, \ref axl_false on rainy days. |
* @return \ref axl_true if ok, \ref axl_false on rainy days. |
*/ |
*/ |
axl_bool test_01_05 () | axl_bool test_01_05 (void) |
{ |
{ |
axlError * error = NULL; |
axlError * error = NULL; |
|
|
Line 6999 void test_02_02_check_key (axlHash * hash, char * key)
|
Line 7053 void test_02_02_check_key (axlHash * hash, char * key)
|
* |
* |
* @return axl_true if it works properly or axl_false if not. |
* @return axl_true if it works properly or axl_false if not. |
*/ |
*/ |
axl_bool test_02_02 () | axl_bool test_02_02 (void) |
{ |
{ |
axlHash * hash; |
axlHash * hash; |
int iterator; |
int iterator; |
Line 7997 axlPointer test_02_01_copy_value (axlPointer key, axlD
|
Line 8051 axlPointer test_02_01_copy_value (axlPointer key, axlD
|
* |
* |
* @return \ref axl_true if it was ok. |
* @return \ref axl_true if it was ok. |
*/ |
*/ |
axl_bool test_02_01 () | axl_bool test_02_01 (void) |
{ |
{ |
axlHash * hash; |
axlHash * hash; |
axlHash * hash2; |
axlHash * hash2; |
Line 8055 axl_bool test_02_01 ()
|
Line 8109 axl_bool test_02_01 ()
|
* |
* |
* @return axl_true if it works properly or axl_false if not. |
* @return axl_true if it works properly or axl_false if not. |
*/ |
*/ |
axl_bool test_02_03 () | axl_bool test_02_03 (void) |
{ |
{ |
axlHash * hash; |
axlHash * hash; |
|
|
Line 8087 axl_bool test_02_03 ()
|
Line 8141 axl_bool test_02_03 ()
|
return axl_true; |
return axl_true; |
} |
} |
|
|
axl_bool test_02_03a () | axl_bool test_02_03a (void) |
{ |
{ |
axlHash * hash; |
axlHash * hash; |
|
|
Line 8157 void show_item_test_02_04 (axlPointer key, axlPointer
|
Line 8211 void show_item_test_02_04 (axlPointer key, axlPointer
|
__axl_log ("hash-test", AXL_LEVEL_DEBUG, " %s -> %s", (char *) key, (char *) data); |
__axl_log ("hash-test", AXL_LEVEL_DEBUG, " %s -> %s", (char *) key, (char *) data); |
} |
} |
|
|
axl_bool test_02_04 () | axl_bool test_02_04 (void) |
{ |
{ |
axlHash * hash; |
axlHash * hash; |
|
|
Line 8211 axl_bool test_02_04 ()
|
Line 8265 axl_bool test_02_04 ()
|
|
|
} |
} |
|
|
axl_bool test_02_04_1 () | axl_bool test_02_04_1 (void) |
{ |
{ |
axlHash * hash; |
axlHash * hash; |
int iterator; |
int iterator; |
Line 8427 axl_bool test_02_04_1 ()
|
Line 8481 axl_bool test_02_04_1 ()
|
return axl_true; |
return axl_true; |
} |
} |
|
|
axl_bool test_02_05 () | axl_bool test_02_05 (void) |
{ |
{ |
axlHash * hash; |
axlHash * hash; |
axlHashCursor * cursor; |
axlHashCursor * cursor; |
Line 8638 axl_bool test_02_05 ()
|
Line 8692 axl_bool test_02_05 ()
|
* |
* |
* @return axl_true if tests are ok. |
* @return axl_true if tests are ok. |
*/ |
*/ |
axl_bool test_02_06 () | axl_bool test_02_06 (void) |
{ |
{ |
axl_bool value; |
axl_bool value; |
axlBinaryStack * bstack; |
axlBinaryStack * bstack; |
Line 8772 int main (int argc, char ** argv)
|
Line 8826 int main (int argc, char ** argv)
|
printf ("** Report bugs to:\n**\n"); |
printf ("** Report bugs to:\n**\n"); |
printf ("** <axl@lists.aspl.es> Axl mailing list\n**\n"); |
printf ("** <axl@lists.aspl.es> Axl mailing list\n**\n"); |
|
|
| |
/* initialize axl library */ |
/* initialize axl library */ |
if (! axl_init ()) { |
if (! axl_init ()) { |
printf ("Unable to initialize Axl library\n"); |
printf ("Unable to initialize Axl library\n"); |