File:  [ELWIX - Embedded LightWeight unIX -] / gpl / axl / test / test_01.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Fri Feb 17 12:50:02 2012 UTC (12 years, 8 months ago) by misho
Branches: axl, MAIN
CVS tags: HEAD, AXL0_6_7
version 0.6.7

    1: /**
    2:  *  LibAxl:  Another XML library (regression test)
    3:  *  Copyright (C) 2006 Advanced Software Production Line, S.L.
    4:  */
    5: #include <axl.h>
    6: #include <axl_ns.h>
    7: #include <axl_babel.h>
    8: 
    9: #define test_41_iso_8859_1_value "!\"#$%'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
   10: 
   11: #define test_41_iso_8859_2_value "!\"#$%'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ"
   12: 
   13: #define test_41_iso_8859_3_value "!\"#$%'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~Ħ˘£¤Ĥ§¨İŞĞĴ­Ż°ħ²³´µĥ·¸ışğĵ½żÀÁÂÄĊĈÇÈÉÊËÌÍÎÏÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâäċĉçèéêëìíîïñòóôġö÷ĝùúûüŭŝ˙"
   14: 
   15: #define test_41_iso_8859_4_value "#$%'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ĄĸŖ¤ĨĻ§¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩļˇ¸šēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖ×ØŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙"
   16: 
   17: #define test_41_iso_8859_5_value "#$%'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ"
   18: 
   19: #define test_41_iso_8859_6_value "!\"#$%&'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~¤،­؛؟ءآأؤإئابةتثجحخدذرزسشصضطظعغـفقكلمنهوىيًٌٍَُِّْ"
   20: 
   21: #define test_41_iso_8859_7_value "!\"#$%'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~‘’£€₯¦§¨©ͺ«¬­―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ"
   22: 
   23: #define test_41_iso_8859_8_value "!\"#$%'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¤¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾‗אבגדהוזחטיךכלםמןנסעףפץצקרשת"
   24: 
   25: #define test_41_iso_8859_9_value "!\"#$%'()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ"
   26: 
   27: #define test_41_iso_8859_15_value "Esto es una prueba: camión, españa, y la tabla de caráteres!\"#$%()*+,-./0123456789:;=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
   28: 
   29: /** 
   30:  * @brief Check that xml node attributes can't be added twice
   31:  */
   32: axl_bool test_45 (axlError ** error)
   33: {
   34: 	axlAttrCursor * cursor;
   35: 	axlDoc        * doc;
   36: 	axlNode       * node;
   37: 	int             count;
   38: 
   39: 	doc = axl_doc_parse ("<root value='test1' />", 24, NULL);
   40: 	if (doc == NULL) {
   41: 		printf ("Expected to find proper document parsing but found NULL\n");
   42: 		return axl_false;
   43: 	} /* end if */
   44: 
   45: 	/* get root node */
   46: 	node = axl_doc_get_root (doc);
   47: 
   48: 	/* get attribute value */
   49: 	if (! HAS_ATTR (node, "value")) {
   50: 		printf ("Expected to find attribute value but not found..\n");
   51: 		return axl_false;
   52: 	} /* end if */
   53: 
   54: 	/* set new attribute */
   55: 	axl_node_set_attribute (node, "value", "test2");
   56: 	
   57: 	/* check now many attributes we have */
   58: 	cursor = axl_node_attr_cursor_new (node);
   59: 	count  = 0;
   60: 	while (axl_node_attr_cursor_has_item (cursor)) {
   61: 
   62: 		count++;
   63: 
   64: 		/* next attribute */
   65: 		axl_node_attr_cursor_next (cursor);
   66: 	}
   67: 	axl_node_attr_cursor_free (cursor);
   68: 
   69: 	/* check count here */
   70: 	if (count != 1) {
   71: 		printf ("Error, expected to find 1 attribute but found: %d\n", count);
   72: 		return axl_false;
   73: 	}
   74: 
   75: 	if (! HAS_ATTR_VALUE (node, "value", "test1")) {
   76: 		printf ("Error, expected to find updated value=test1 but found %s..\n", ATTR_VALUE (node, "value"));
   77: 		return axl_false;
   78: 	}
   79: 
   80: 	axl_doc_free (doc);
   81: 
   82: 	return axl_true;
   83: }
   84: 
   85: /** 
   86:  * @brief Check and fix DTD bug
   87:  */
   88: axl_bool test_44 (axlError ** error)
   89: {
   90: 
   91: 	axlDoc * doc;
   92: 	axlDtd  * dtd;
   93: 
   94: 	/* parse the document found */
   95: 	doc = axl_doc_parse_from_file ("test_44.xml", error);
   96: 	if (doc == NULL)
   97: 		return axl_false;
   98: 
   99: 	
  100: 	dtd = axl_dtd_parse_from_file ("test_44.dtd", error);
  101: 	if (dtd == NULL)
  102: 		return axl_false;
  103: 
  104: 	/* now validate the document */
  105: 	if (! axl_dtd_validate (doc, dtd, error)) {
  106: 		return axl_false;
  107: 	}
  108: 
  109: 	/* release memory used by the parser */
  110: 	axl_doc_free (doc);
  111: 
  112: 	/* parse the document found */
  113: 	doc = axl_doc_parse_from_file ("test_44_b.xml", error);
  114: 	if (doc == NULL)
  115: 		return axl_false;
  116: 
  117: 	/* now validate the document */
  118: 	if (! axl_dtd_validate (doc, dtd, error)) {
  119: 		return axl_false;
  120: 	}
  121: 	
  122: 	/* release memory used by the DTD element */
  123: 	axl_dtd_free (dtd);
  124: 
  125: 	/* release memory used by the parser */
  126: 	axl_doc_free (doc);
  127: 
  128: 	return axl_true;
  129: 	
  130: }
  131: 
  132: 
  133: /** 
  134:  * @brief Check a memory leak while operating with root nodes.
  135:  */
  136: axl_bool test_43 (axlError ** error)
  137: {
  138: 	axlDoc  * doc  = axl_doc_parse("<example />", -1, NULL);
  139: 	axlNode * root = axl_doc_get_root(doc);
  140: 
  141: 	axl_node_set_name (root, "my_name");
  142: 
  143: 	axl_doc_free(doc);
  144: 	return axl_true;
  145: }
  146: 
  147: /** 
  148:  * @brief Storing arbitrary binary content inside CDATA declaration
  149:  * including ']]>'.
  150:  * 
  151:  * @param error The optional axlError to be used to report erros.
  152:  * 
  153:  * @return axl_true tests are ok, otherwise axl_false is returned.
  154:  */
  155: axl_bool test_42 (axlError ** error)
  156: {
  157: 	axlDoc  * doc;
  158: 	axlNode * node;
  159: 	char    * content;
  160: 	int       size;
  161: 
  162: 	/* parse example */
  163: 	doc = axl_doc_parse_from_file ("test_42.xml", error);
  164: 	if (doc == NULL) 
  165: 		return axl_false;	
  166: 
  167: 	node    = axl_doc_get_root (doc);
  168: 	content = axl_node_get_content_trans (node, NULL);
  169: 
  170: 	/* check content */
  171: 	if (! axl_cmp ("this is an example ]]> more content", content)) {
  172: 		printf ("Expected to find: '%s' but found '%s'\n",
  173: 			"this is an example ]]> more content", content);
  174: 		axl_error_report (error, -1, "Expected to find a particular content but different value was found (1)");
  175: 		return axl_false;
  176: 	}
  177: 
  178: 	axl_free (content);
  179: 
  180: 	/* free document */
  181: 	axl_doc_free (doc);
  182: 
  183: 	/* parse example */
  184: 	doc = axl_doc_parse_from_file ("test_42a.xml", error);
  185: 	if (doc == NULL) 
  186: 		return axl_false;	
  187: 
  188: 	node    = axl_doc_get_root (doc);
  189: 	content = axl_node_get_content_trans (node, NULL);
  190: 
  191: 	/* check content */
  192: 	if (! axl_cmp ("this is an example ]]> more content ]]> second piece", content)) {
  193: 		printf ("Expected to find: '%s' but found '%s'\n",
  194: 			"this is an example ]]> more content ]]> second piece", content);
  195: 		axl_error_report (error, -1, "Expected to find a particular content but different value was found (2)");
  196: 		return axl_false;
  197: 	}
  198: 
  199: 	axl_free (content);
  200: 
  201: 	/* free document */
  202: 	axl_doc_free (doc);
  203: 	
  204: 	doc  = axl_doc_parse ("<body />", 8, NULL);
  205: 	node = axl_doc_get_root (doc);
  206: 
  207: 	/* set CDATA content */
  208: 	axl_node_set_cdata_content (node, "This is a test ]]> with not valid content <![CDATA[..]]>", 56);
  209: 	
  210: 	/* dump content */
  211: 	if (! axl_doc_dump (doc, &content, &size)) {
  212: 		axl_error_report (error, -1, "Failed to perform dump operation after CDATA content configuration..");
  213: 		return axl_false;
  214: 	}
  215: 
  216: 	/* check dumped content */
  217: 	if (! axl_cmp ("<?xml version='1.0' encoding='utf-8' ?><body><![CDATA[This is a test ]]>]]&gt;<![CDATA[ with not valid content &lt;![CDATA[..]]>]]&gt;<![CDATA[]]></body>",
  218: 		       content)) {
  219: 		printf ("Content found:    '%s'\n", content);
  220: 		printf ("Content expected: '%s'\n", 
  221: 			"<?xml version='1.0' ?><body><![CDATA[This is a test ]]>]]&gt;<![CDATA[ with not valid content &lt;![CDATA[..]]>]]&gt;<![CDATA[]]></body>");
  222: 		axl_error_report (error, -1, "Expected to find a different value for xml dump content");
  223: 		return axl_false;
  224: 	} /* end if */
  225: 
  226: 	/* free content */
  227: 	axl_free (content);
  228: 
  229: 	/* now dump the content into a document */
  230: 	if (! axl_doc_dump_to_file (doc, "test_42c.xml")) {
  231: 		axl_error_report (error, -1, "Expected proper dump operation to file but it failed");
  232: 		return axl_false;
  233: 	} /* end if */
  234: 
  235: 	/* free doc */
  236: 	axl_doc_free (doc);
  237: 
  238: 	/* open the document */
  239: 	doc = axl_doc_parse_from_file ("test_42c.xml", error);
  240: 	if (doc == NULL) {
  241: 		printf ("Expected to open dumped document for CDATA check..\n");
  242: 		return axl_false;
  243: 	}
  244: 	
  245: 	/* get document root */
  246: 	node    = axl_doc_get_root (doc);
  247: 	content = axl_node_get_content_trans (node, &size);
  248: 
  249: 	if (! axl_cmp ("This is a test ]]> with not valid content <![CDATA[..]]>", content)) {
  250: 		printf ("Content found:    '%s'\n", content);
  251: 		printf ("Content expected: '%s'\n", "This is a test ]]> with not valid content <![CDATA[..]]>");
  252: 		axl_error_report (error, -1, "Expected to find different content in node found inside document dumped..");
  253: 		return axl_false;
  254: 	} /* end if */
  255: 
  256: 	/* free content */
  257: 	axl_free (content);
  258: 
  259: 	/* free doc reference */
  260: 	axl_doc_free (doc);
  261: 
  262: 	doc = axl_doc_parse_from_file ("test_42d.xml", error);
  263: 	if (doc == NULL) {
  264: 		printf ("Expected to properly open test document test_42d.xml..\n");
  265: 		return axl_false;
  266: 	} /* end if */
  267: 
  268: 	/* dump document */
  269: 	if (! axl_doc_dump (doc, &content, &size)) {
  270: 		printf ("Failed to dump document test_42d.xml..\n");
  271: 		return axl_false;
  272: 	} /* end if */
  273: 
  274: 	/* free document */
  275: 	axl_doc_free (doc);
  276: 
  277: 	/* now create a document holding the content dumped */
  278: 	doc = axl_doc_parse ("<body />", 8, error);
  279: 	if (doc == NULL) {
  280: 		printf ("Expected to find proper document parsing for <body />..\n");
  281: 		return axl_false;
  282: 	}
  283: 
  284: 	/* set content */
  285: 	node = axl_doc_get_root (doc);
  286: 	axl_node_set_cdata_content (node, content, size);
  287: 
  288: 	/* free content */
  289: 	axl_free (content);
  290: 
  291: 	/* now dump content created */
  292: 	if (! axl_doc_dump (doc, &content, &size)) {
  293: 		printf ("Failed to dump document test_42d.xml..\n");
  294: 		return axl_false;
  295: 	} /* end if */
  296: 
  297: 	/* check content */
  298: 	if (! axl_cmp (content, 
  299: 		       "<?xml version='1.0' encoding='utf-8' ?><body><![CDATA[&lt;?xml version=&apos;1.0&apos; encoding=&apos;utf-8&apos; ?&gt;&lt;content&gt;&lt;full-name&gt;&lt;![CDATA[some data]]>]]&gt;<![CDATA[&lt;/full-name&gt;&lt;nick&gt;&lt;![CDATA[some data]]>]]&gt;<![CDATA[&lt;/nick&gt;&lt;value&gt;&lt;![CDATA[some data]]>]]&gt;<![CDATA[&lt;/value&gt;&lt;/content&gt;]]></body>")) {
  300: 		axl_error_report (error, -1, "Expected to find different value after dump operation..\n");
  301: 		return axl_false;
  302: 	}
  303: 
  304: 	axl_free (content);
  305: 	axl_doc_free (doc);
  306: 
  307: 
  308: 	return axl_true;
  309: }
  310: 
  311: /** 
  312:  * @brief Extended encoding support.
  313:  * 
  314:  * @param error The optional axlError to be used to report erros.
  315:  * 
  316:  * @return axl_true tests are ok, otherwise axl_false is returned.
  317:  */
  318: axl_bool test_41 (axlError ** error)
  319: {
  320: 	axlDoc  * doc;
  321: 	axlNode * node;
  322: 	int       index;
  323: 
  324: 	/* configure babel translate functions */
  325: 	printf ("Test 41: init babel..\n");
  326: 	if (! axl_babel_init (error)) 
  327: 		return axl_false;
  328: 
  329: 	/* check utf 8 */
  330: 	printf ("Test 41: checking utf-8 engine..\n");
  331: 	if (! axl_babel_check_utf8_content (test_41_iso_8859_15_value, strlen (test_41_iso_8859_15_value), &index)) {
  332: 		printf ("ERROR: utf-8 content error found at index=%d..\n", index);
  333: 		axl_error_new (-1, "Expected to find proper utf-8 content but it wasn't found", NULL, error);
  334: 		return axl_false;
  335: 	}
  336: 
  337: 	/*** UTF-8 support */
  338: 	/* test utf-8 encoding */
  339: 	printf ("Test 41: test utf-8 support..\n");
  340: 	doc = axl_doc_parse_from_file ("test_41.utf-8.xml", error);
  341: 	if (doc == NULL) 
  342: 		return axl_false;
  343: 
  344: 	/* find info node */
  345: 	node = axl_doc_get_root (doc);
  346: 	if (! NODE_CMP_NAME (node, "encodings")) {
  347: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  348: 		return axl_false;
  349: 	}
  350: 
  351: 	axl_doc_free (doc);
  352: 
  353: 	/* check unicode file without xml header */
  354: 	printf ("Test 41: test utf-8 content without xml header..\n");
  355: 	doc = axl_doc_parse_from_file ("test_41.utf-8.withoutheader.xml", error);
  356: 	if (doc == NULL) 
  357: 		return axl_false;
  358: 
  359: 	if (! axl_cmp (axl_doc_get_encoding (doc), "utf-8")) {
  360: 		axl_error_new (-1, "Expected to find utf-8 content declaration but it wasn't found", NULL, error);
  361: 		return axl_false;
  362: 	}
  363: 	axl_doc_free (doc);
  364: 
  365: 	/* check unicode file without xml header */
  366: 	printf ("Test 41: test wrong xml utf-8 content without xml header..\n");
  367: 	doc = axl_doc_parse_from_file ("test_41.utf-8.wrongwithoutheader.xml", NULL);
  368: 	if (doc != NULL) 
  369: 		return axl_false;
  370: 	
  371: 	/* test utf-8 encoding (wrong test) */
  372: 	printf ("Test 41: test wrong utf-8 content..\n");
  373: 	doc = axl_doc_parse_from_file ("test_41.utf-8.wrong.xml", error);
  374: 	if (doc != NULL) 
  375: 		return axl_false;
  376: 
  377: 	/* check unicode file without declaration */
  378: 	printf ("Test 41: test utf-8 content without decleration..\n");
  379: 	doc = axl_doc_parse_from_file ("test_41.utf-8.withoutencoding.xml", error);
  380: 	if (doc == NULL) 
  381: 		return axl_false;
  382: 
  383: 	if (! axl_cmp (axl_doc_get_encoding (doc), "utf-8")) {
  384: 		axl_error_new (-1, "Expected to find utf-8 content declaration but it wasn't found", NULL, error);
  385: 		return axl_false;
  386: 	}
  387: 	axl_doc_free (doc);
  388: 
  389: 	/* check large unicode file without declearation */
  390: 	printf ("Test 41: test large utf-8 content without decleration..\n");
  391: 	doc = axl_doc_parse_from_file ("large.xml", error);
  392: 	if (doc == NULL) 
  393: 		return axl_false;
  394: 
  395: 	if (! axl_cmp (axl_doc_get_encoding (doc), "utf-8")) {
  396: 		axl_error_new (-1, "Expected to find utf-8 content declaration but it wasn't found", NULL, error);
  397: 		return axl_false;
  398: 	}
  399: 	axl_doc_free (doc);
  400: 
  401: 	/*** ISO-8859-15 SUPPORT ***/
  402: 	/* test iso-8859-15 encoding */
  403: 	printf ("Test 41: test iso-8859-15..\n");
  404: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-15.xml", error);
  405: 	if (doc == NULL) 
  406: 		return axl_false;
  407: 
  408: 	/* find info node */
  409: 	node = axl_doc_get_root (doc);
  410: 	if (! NODE_CMP_NAME (node, "info")) {
  411: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  412: 		return axl_false;
  413: 	}
  414: 
  415: 	/* check node content */
  416: 	if (! axl_cmp (test_41_iso_8859_15_value, 
  417: 		       axl_node_get_content (node, NULL))) {
  418: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  419: 			(int) strlen (test_41_iso_8859_15_value), test_41_iso_8859_15_value,
  420: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  421: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  422: 		return axl_false;
  423: 	}
  424: 
  425: 	/* free document */
  426: 	axl_doc_free (doc);
  427: 
  428: 	/*** ISO-8859-15 LARGE FILE ***/
  429: 	printf ("Test 41: test iso-8859-15 large..\n");
  430: 	/* now parse a large document that would require
  431: 	 * prebuffering */
  432: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-15.2.xml", error);
  433: 	if (doc == NULL) 
  434: 		return axl_false;
  435: 
  436: 	/* find info node */
  437: 	node = axl_doc_get_root (doc);
  438: 	if (! NODE_CMP_NAME (node, "info")) {
  439: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  440: 		return axl_false;
  441: 	}
  442: 
  443: 	/* check utf-8 format */
  444: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  445: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  446: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  447: 		return axl_false;
  448: 	}
  449: 
  450: 	if (strlen (axl_node_get_content (node, NULL)) != 26642) {
  451: 		printf ("ERROR: expected content lenght %d but found %d\n",
  452: 			(int) strlen (axl_node_get_content (node, NULL)), 26642);
  453: 	}
  454: 
  455: 	/* free document */
  456: 	axl_doc_free (doc);
  457: 
  458: 	/*** ISO-8859-1 support ***/
  459: 	printf ("Test 41: test iso-8859-1..\n");
  460: 	/* now parse a large document that would require
  461: 	 * prebuffering */
  462: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-1.xml", error);
  463: 	if (doc == NULL) 
  464: 		return axl_false;
  465: 
  466: 	/* find info node */
  467: 	node = axl_doc_get_root (doc);
  468: 	if (! NODE_CMP_NAME (node, "info")) {
  469: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  470: 		return axl_false;
  471: 	}
  472: 
  473: 	/* check utf-8 format */
  474: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  475: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  476: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  477: 		return axl_false;
  478: 	}
  479: 
  480: 	if (! axl_cmp (test_41_iso_8859_1_value, 
  481: 		       axl_node_get_content (node, NULL))) {
  482: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  483: 			(int) strlen (test_41_iso_8859_1_value), test_41_iso_8859_1_value,
  484: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  485: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  486: 		return axl_false;
  487: 	}
  488: 
  489: 	/* free document */
  490: 	axl_doc_free (doc);
  491: 
  492: 	/*** ISO-8859-2 support ***/
  493: 	printf ("Test 41: test iso-8859-2..\n");
  494: 	/* now parse a large document that would require
  495: 	 * prebuffering */
  496: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-2.xml", error);
  497: 	if (doc == NULL) 
  498: 		return axl_false;
  499: 
  500: 	/* find info node */
  501: 	node = axl_doc_get_root (doc);
  502: 	if (! NODE_CMP_NAME (node, "info")) {
  503: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  504: 		return axl_false;
  505: 	}
  506: 
  507: 	/* check utf-8 format */
  508: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  509: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  510: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  511: 		return axl_false;
  512: 	}
  513: 
  514: 	if (! axl_cmp (test_41_iso_8859_2_value, 
  515: 		       axl_node_get_content (node, NULL))) {
  516: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  517: 			(int) strlen (test_41_iso_8859_2_value), test_41_iso_8859_2_value,
  518: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  519: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  520: 		return axl_false;
  521: 	}
  522: 
  523: 	/* free document */
  524: 	axl_doc_free (doc);
  525: 
  526: 	/*** ISO-8859-3 support ***/
  527: 	printf ("Test 41: test iso-8859-3..\n");
  528: 	/* now parse a large document that would require
  529: 	 * prebuffering */
  530: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-3.xml", error);
  531: 	if (doc == NULL) 
  532: 		return axl_false;
  533: 
  534: 	/* find info node */
  535: 	node = axl_doc_get_root (doc);
  536: 	if (! NODE_CMP_NAME (node, "info")) {
  537: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  538: 		return axl_false;
  539: 	}
  540: 
  541: 	/* check utf-8 format */
  542: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  543: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  544: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  545: 		return axl_false;
  546: 	}
  547: 
  548: 	if (! axl_cmp (test_41_iso_8859_3_value, 
  549: 		       axl_node_get_content (node, NULL))) {
  550: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  551: 			(int) strlen (test_41_iso_8859_3_value), test_41_iso_8859_3_value,
  552: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  553: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  554: 		return axl_false;
  555: 	}
  556: 
  557: 	/* free document */
  558: 	axl_doc_free (doc);
  559: 
  560: 	/*** ISO-8859-4 support ***/
  561: 	printf ("Test 41: test iso-8859-4..\n");
  562: 	/* now parse a large document that would require
  563: 	 * prebuffering */
  564: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-4.xml", error);
  565: 	if (doc == NULL) 
  566: 		return axl_false;
  567: 
  568: 	/* find info node */
  569: 	node = axl_doc_get_root (doc);
  570: 	if (! NODE_CMP_NAME (node, "info")) {
  571: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  572: 		return axl_false;
  573: 	}
  574: 
  575: 	/* check utf-8 format */
  576: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  577: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  578: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  579: 		return axl_false;
  580: 	}
  581: 
  582: 	if (! axl_cmp (test_41_iso_8859_4_value, 
  583: 		       axl_node_get_content (node, NULL))) {
  584: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  585: 			(int) strlen (test_41_iso_8859_4_value), test_41_iso_8859_4_value,
  586: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  587: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  588: 		return axl_false;
  589: 	}
  590: 
  591: 	/* free document */
  592: 	axl_doc_free (doc);
  593: 
  594: 	/*** ISO-8859-5 support ***/
  595: 	printf ("Test 41: test iso-8859-5..\n");
  596: 	/* now parse a large document that would require
  597: 	 * prebuffering */
  598: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-5.xml", error);
  599: 	if (doc == NULL) 
  600: 		return axl_false;
  601: 
  602: 	/* find info node */
  603: 	node = axl_doc_get_root (doc);
  604: 	if (! NODE_CMP_NAME (node, "info")) {
  605: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  606: 		return axl_false;
  607: 	}
  608: 
  609: 	/* check utf-8 format */
  610: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  611: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  612: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  613: 		return axl_false;
  614: 	}
  615: 
  616: 	if (! axl_cmp (test_41_iso_8859_5_value, 
  617: 		       axl_node_get_content (node, NULL))) {
  618: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  619: 			(int) strlen (test_41_iso_8859_5_value), test_41_iso_8859_5_value,
  620: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  621: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  622: 		return axl_false;
  623: 	}
  624: 
  625: 	/* free document */
  626: 	axl_doc_free (doc);
  627: 
  628: 	/*** ISO-8859-6 support ***/
  629: 	printf ("Test 41: test iso-8859-6..\n");
  630: 	/* now parse a large document that would require
  631: 	 * prebuffering */
  632: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-6.xml", error);
  633: 	if (doc == NULL) 
  634: 		return axl_false;
  635: 
  636: 	/* find info node */
  637: 	node = axl_doc_get_root (doc);
  638: 	if (! NODE_CMP_NAME (node, "info")) {
  639: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  640: 		return axl_false;
  641: 	}
  642: 
  643: 	/* check utf-8 format */
  644: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  645: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  646: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  647: 		return axl_false;
  648: 	}
  649: 
  650: 	if (! axl_cmp (test_41_iso_8859_6_value, 
  651: 		       axl_node_get_content (node, NULL))) {
  652: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  653: 			(int) strlen (test_41_iso_8859_6_value), test_41_iso_8859_6_value,
  654: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  655: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  656: 		return axl_false;
  657: 	}
  658: 
  659: 	/* free document */
  660: 	axl_doc_free (doc);
  661: 
  662: 	/*** ISO-8859-7 support ***/
  663: 	printf ("Test 41: test iso-8859-7..\n");
  664: 	/* now parse a large document that would require
  665: 	 * prebuffering */
  666: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-7.xml", error);
  667: 	if (doc == NULL) 
  668: 		return axl_false;
  669: 
  670: 	/* find info node */
  671: 	node = axl_doc_get_root (doc);
  672: 	if (! NODE_CMP_NAME (node, "info")) {
  673: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  674: 		return axl_false;
  675: 	}
  676: 
  677: 	/* check utf-8 format */
  678: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  679: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  680: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  681: 		return axl_false;
  682: 	}
  683: 
  684: 	if (! axl_cmp (test_41_iso_8859_7_value, 
  685: 		       axl_node_get_content (node, NULL))) {
  686: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  687: 			(int) strlen (test_41_iso_8859_7_value), test_41_iso_8859_7_value,
  688: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  689: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  690: 		return axl_false;
  691: 	}
  692: 
  693: 	/* free document */
  694: 	axl_doc_free (doc);
  695: 
  696: 	/*** ISO-8859-8 support ***/
  697: 	printf ("Test 41: test iso-8859-8..\n");
  698: 	/* now parse a large document that would require
  699: 	 * prebuffering */
  700: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-8.xml", error);
  701: 	if (doc == NULL) 
  702: 		return axl_false;
  703: 
  704: 	/* find info node */
  705: 	node = axl_doc_get_root (doc);
  706: 	if (! NODE_CMP_NAME (node, "info")) {
  707: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  708: 		return axl_false;
  709: 	}
  710: 
  711: 	/* check utf-8 format */
  712: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  713: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  714: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  715: 		return axl_false;
  716: 	}
  717: 
  718: 	if (! axl_cmp (test_41_iso_8859_8_value, 
  719: 		       axl_node_get_content (node, NULL))) {
  720: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  721: 			(int) strlen (test_41_iso_8859_8_value), test_41_iso_8859_8_value,
  722: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  723: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  724: 		return axl_false;
  725: 	}
  726: 
  727: 	/* free document */
  728: 	axl_doc_free (doc);
  729: 
  730: 	/*** ISO-8859-9 support ***/
  731: 	printf ("Test 41: test iso-8859-9..\n");
  732: 	/* now parse a large document that would require
  733: 	 * prebuffering */
  734: 	doc = axl_doc_parse_from_file ("test_41.iso-8859-9.xml", error);
  735: 	if (doc == NULL) 
  736: 		return axl_false;
  737: 
  738: 	/* find info node */
  739: 	node = axl_doc_get_root (doc);
  740: 	if (! NODE_CMP_NAME (node, "info")) {
  741: 		axl_error_new (-1, "Expected to find root node called <info> but it wasn't found", NULL, error);
  742: 		return axl_false;
  743: 	}
  744: 
  745: 	/* check utf-8 format */
  746: 	if (! axl_babel_check_utf8_content (axl_node_get_content (node, NULL), -1, &index)) {
  747: 		printf ("ERROR: found utf-8 content error at index=%d..\n", index);
  748: 		axl_error_new (-1, "Expected to find proper utf-8 content but a failure was found", NULL, error);
  749: 		return axl_false;
  750: 	}
  751: 
  752: 	if (! axl_cmp (test_41_iso_8859_9_value, 
  753: 		       axl_node_get_content (node, NULL))) {
  754: 		printf ("Found diferences at node content: (size: %d)'%s' != (size: %d) '%s'..\n",
  755: 			(int) strlen (test_41_iso_8859_9_value), test_41_iso_8859_9_value,
  756: 			(int) strlen (axl_node_get_content (node, NULL)), axl_node_get_content (node, NULL));
  757: 		axl_error_new (-1, "Found diferences at node content..\n", NULL, error);
  758: 		return axl_false;
  759: 	}
  760: 
  761: 	/* free document */
  762: 	axl_doc_free (doc);
  763: 	return axl_true;
  764: 
  765: 
  766: 
  767: 	/* test utf-16 encoding */
  768: 	doc = axl_doc_parse_from_file ("test_41.utf-16.xml", error);
  769: 	if (doc == NULL) 
  770: 		return axl_false;
  771: 
  772: 	/* check document content to ensure values */
  773: 
  774: 	/* free document */
  775: 	axl_free (doc);
  776: 
  777: 	/* finish babel */
  778: 	axl_babel_finish ();
  779: 
  780: 	return axl_true;
  781: }
  782: 
  783: /** 
  784:  * @brief Avoid including recursively white spaces content into dumped
  785:  * documents.
  786:  * 
  787:  * @param error The optional axlError to be used to report erros.
  788:  * 
  789:  * @return axl_true tests are ok, otherwise axl_false is returned.
  790:  */
  791: axl_bool test_40 (axlError ** error)
  792: {
  793: 	axlDoc  * doc = axl_doc_parse_from_file ("test_40.xml", error);
  794: 	axlDoc  * doc2;
  795: 	axlNode * node;
  796: 	axlItem * item;
  797: 	char    * content;
  798: 	char    * content2;
  799: 
  800: 	if (doc == NULL)
  801: 		return axl_false;
  802: 	
  803: 	/* now dump the document */
  804: 	if (! axl_doc_dump_pretty_to_file (doc, "test_40.xml.test", 8))
  805: 		return axl_false;
  806: 
  807: 	/* now parse dumped document */
  808: 	doc2 = axl_doc_parse_from_file ("test_40.xml.test", error);
  809: 	if (doc2 == NULL)
  810: 		return axl_false;
  811: 
  812: 	/* check comment content */
  813: 	node     = axl_doc_get_root (doc2);
  814: 	
  815: 	item     = axl_item_get_first_child (node);
  816: 	
  817: 	content  = axl_item_get_content (item, NULL);
  818: 	if (content == NULL) {
  819: 		axl_error_new (-1, "Expected to find content defined for first axl item found inside test_40.xml", NULL, error);
  820: 		return axl_false;
  821: 	}
  822: 
  823: 	node     = axl_doc_get_root (doc);
  824: 	item     = axl_item_get_first_child (node);
  825: 	content2 = axl_item_get_content (item, NULL);
  826: 	if (content2 == NULL) {
  827: 		axl_error_new (-1, "Expected to find content defined for first axl item found inside test_40.xml.test", NULL, error);
  828: 		return axl_false;
  829: 	}
  830: 
  831: 
  832: 	/* check content */
  833: 	if (! axl_cmp (content, content2)) {
  834: 		printf ("Failed, expected equal content, but found differences: (%d)'%s' != (%d)'%s'\n",
  835: 			(int) strlen (content), content, (int) strlen (content2), content2);
  836: 		axl_error_new (-1, "Failed, expected equal content, but found differences", NULL, error);
  837: 		return axl_false;
  838: 	}
  839: 
  840: 	axl_doc_free (doc);
  841: 	axl_doc_free (doc2);
  842: 
  843: 	return axl_true;
  844: }
  845: 
  846: /* include inline dtd definition (test_39) */
  847: #include <channel.dtd.h>
  848: #include <fact.dtd.h>
  849: #include <xml-rpc.dtd.h>
  850: #include <tls.dtd.h>
  851: 
  852: /** 
  853:  * @brief Check DTD validation error found.
  854:  * 
  855:  * @param error The optional axlError to be used to report erros.
  856:  * 
  857:  * @return axl_true if the validity test is passed, otherwise axl_false is
  858:  * returned.
  859:  */
  860: axl_bool test_39 (axlError ** error)
  861: {
  862: 	axlDtd          * dtd;
  863: 	axlDtd          * dtd2;
  864: 
  865: 	/* check channel.dtd */
  866: 	dtd = axl_dtd_parse (CHANNEL_DTD, -1, error);
  867: 	if (dtd == NULL) {
  868: 		return axl_false;
  869: 	}
  870: 
  871: 	dtd2 = axl_dtd_parse_from_file ("channel.dtd", error);
  872: 	if (dtd2 == NULL)
  873: 		return axl_false;
  874: 	
  875: 	/* check if both dtds are equal */
  876: 	if (! axl_dtd_are_equal (dtd, dtd2)) {
  877: 		axl_error_new (-1, "Expected to find equal dtd definitions, but axl_dtd_are_equal failed", NULL, error);
  878: 		return axl_false;
  879: 	}
  880: 
  881: 	/* free dtd and doc */
  882: 	axl_dtd_free (dtd);
  883: 	axl_dtd_free (dtd2);
  884: 
  885: 	/* check channel.dtd */
  886: 	dtd = axl_dtd_parse (FACT_DTD, -1, error);
  887: 	if (dtd == NULL) {
  888: 		return axl_false;
  889: 	}
  890: 
  891: 	dtd2 = axl_dtd_parse_from_file ("fact.dtd", error);
  892: 	if (dtd2 == NULL)
  893: 		return axl_false;
  894: 	
  895: 	/* check if both dtds are equal */
  896: 	if (! axl_dtd_are_equal (dtd, dtd2)) {
  897: 		axl_error_new (-1, "Expected to find equal dtd definitions, but axl_dtd_are_equal failed", NULL, error);
  898: 		return axl_false;
  899: 	}
  900: 
  901: 	/* free dtd and doc */
  902: 	axl_dtd_free (dtd);
  903: 	axl_dtd_free (dtd2);
  904: 
  905: 	/* check channel.dtd */
  906: 	dtd = axl_dtd_parse (XML_RPC_DTD, -1, error);
  907: 	if (dtd == NULL) {
  908: 		return axl_false;
  909: 	}
  910: 
  911: 	dtd2 = axl_dtd_parse_from_file ("xml-rpc.dtd", error);
  912: 	if (dtd2 == NULL)
  913: 		return axl_false;
  914: 	
  915: 	/* check if both dtds are equal */
  916: 	if (! axl_dtd_are_equal (dtd, dtd2)) {
  917: 		axl_error_new (-1, "Expected to find equal dtd definitions, but axl_dtd_are_equal failed", NULL, error);
  918: 		return axl_false;
  919: 	}
  920: 
  921: 	/* free dtd and doc */
  922: 	axl_dtd_free (dtd);
  923: 	axl_dtd_free (dtd2);
  924: 
  925: 	/* check channel.dtd */
  926: 	dtd = axl_dtd_parse (TLS_DTD, -1, error);
  927: 	if (dtd == NULL) {
  928: 		return axl_false;
  929: 	}
  930: 
  931: 	dtd2 = axl_dtd_parse_from_file ("tls.dtd", error);
  932: 	if (dtd2 == NULL)
  933: 		return axl_false;
  934: 	
  935: 	/* check if both dtds are equal */
  936: 	if (! axl_dtd_are_equal (dtd, dtd2)) {
  937: 		axl_error_new (-1, "Expected to find equal dtd definitions, but axl_dtd_are_equal failed", NULL, error);
  938: 		return axl_false;
  939: 	}
  940: 
  941: 	/* free dtd and doc */
  942: 	axl_dtd_free (dtd);
  943: 	axl_dtd_free (dtd2);
  944: 
  945: 	return axl_true;
  946: }
  947: 
  948: 
  949: /** 
  950:  * @brief Check DTD validation error found.
  951:  * 
  952:  * @param error The optional axlError to be used to report erros.
  953:  * 
  954:  * @return axl_true if the validity test is passed, otherwise axl_false is
  955:  * returned.
  956:  */
  957: axl_bool test_38 (axlError ** error)
  958: {
  959: 	axlDtd          * dtd;
  960: 	axlDoc          * doc;
  961: 
  962: 	dtd = axl_dtd_parse_from_file ("test_38.dtd", error);
  963: 	if (dtd == NULL)
  964: 		return axl_false;
  965: 
  966: 	doc = axl_doc_parse_from_file ("test_38.xml", error);
  967: 	if (doc == NULL)
  968: 		return axl_false;
  969: 
  970: 	/* validate */
  971: 	if (! axl_dtd_validate (doc, dtd, error)) {
  972: 		axl_error_new (-1, "Expected to find proper a validation for the test (IDREF references)", NULL, error);
  973: 		return axl_false;
  974: 	}
  975: 	
  976: 	/* free dtd and doc */
  977: 	axl_dtd_free (dtd);
  978: 	axl_doc_free (doc);
  979: 
  980: 	return axl_true;
  981: }
  982: 
  983: /** 
  984:  * @brief Check if it is possible to dettach the root node.
  985:  * 
  986:  * @param error The optional axlError to be used to report erros.
  987:  * 
  988:  * @return axl_true if the validity test is passed, otherwise axl_false is
  989:  * returned.
  990:  */
  991: axl_bool test_37 (axlError ** error)
  992: {
  993: 	
  994: 	axlDoc  * doc;
  995: 	axlDoc  * doc2;
  996: 	axlNode * root;
  997: 
  998: 	/* parse file */
  999: 	doc  = axl_doc_parse ("<child> This is content, more content </child>", -1, error);
 1000: 	if (doc == NULL)
 1001: 		return axl_false;
 1002: 
 1003: 	doc2 = axl_doc_parse ("<child />", -1, error);
 1004: 	if (doc2 == NULL)
 1005: 		return axl_false;
 1006: 
 1007: 	/* clear content */
 1008: 	root = axl_doc_get_root (doc);
 1009: 	axl_node_set_is_empty (root, axl_true);
 1010: 
 1011: 	if (! axl_doc_are_equal (doc, doc2)) {
 1012: 		axl_error_new (-1, "Expected equal documents, not found", NULL, error);
 1013: 		return axl_false;
 1014: 	}
 1015: 
 1016: 	axl_doc_free (doc);
 1017: 	axl_doc_free (doc2);
 1018: 
 1019: 	return axl_true;
 1020: }
 1021: 
 1022: /** 
 1023:  * @brief Check if it is possible to dettach the root node.
 1024:  * 
 1025:  * @param error The optional axlError to be used to report erros.
 1026:  * 
 1027:  * @return axl_true if the validity test is passed, otherwise axl_false is
 1028:  * returned.
 1029:  */
 1030: axl_bool test_36 (axlError ** error)
 1031: {
 1032: 	/* parse the document */
 1033: 	axlDoc  * doc = axl_doc_parse_from_file ("test_35.xml", error);
 1034: 	axlNode * root;
 1035: 
 1036: 	/* check returned document */
 1037: 	if (doc == NULL)
 1038: 		return axl_false;
 1039: 
 1040: 	/* now get the root node and detach it */
 1041: 	root = axl_doc_get_root (doc);
 1042: 	axl_node_deattach (root);
 1043: 
 1044: 	/* free the node */
 1045: 	axl_node_free (root);
 1046: 	
 1047: 	/* free the document */
 1048: 	axl_doc_free (doc);
 1049: 
 1050: 	root = axl_node_parse_strings (error, 
 1051: 				       "<child>",
 1052: 				       "  <widget class=\"GtkLabel\" id=\"label4\">",
 1053: 				       "    <property name=\"visible\">True</property>",
 1054: 				       "    <property name=\"label\" translatable=\"yes\">&lt;b&gt;1. Seleccione el sistema:&lt;/b&gt;</property>",
 1055: 				       "    <property name=\"use_underline\">False</property>",
 1056: 				       "    <property name=\"use_markup\">True</property>",
 1057: 				       "    <property name=\"justify\">GTK_JUSTIFY_LEFT</property>",
 1058: 				       "    <property name=\"wrap\">False</property>",
 1059: 				       "    <property name=\"selectable\">False</property>",
 1060: 				       "    <property name=\"xalign\">0</property>",
 1061: 				       "    <property name=\"yalign\">0.5</property>",
 1062: 				       "    <property name=\"xpad\">0</property>",
 1063: 				       "    <property name=\"ypad\">0</property>",
 1064: 				       "    <property name=\"ellipsize\">PANGO_ELLIPSIZE_NONE</property>",
 1065: 				       "    <property name=\"width_chars\">-1</property>",
 1066: 				       "    <property name=\"single_line_mode\">False</property>",
 1067: 				       "    <property name=\"angle\">0</property>",
 1068: 				       "  </widget>",
 1069: 				       "  <packing>",
 1070: 				       "     <property name=\"padding\">0</property>",
 1071: 				       "     <property name=\"expand\">False</property>",
 1072: 				       "     <property name=\"fill\">False</property>",
 1073: 				       "  </packing>",
 1074: 				       "</child>",
 1075: 				       NULL);
 1076: 	if (root == NULL) {
 1077: 		printf ("Error: unable to parse content..\n");
 1078: 		return axl_false;
 1079: 	}
 1080: 
 1081: 	axl_node_free (root);
 1082: 
 1083: 	/* create the node using the parse api */
 1084: 	root = axl_node_parse (error, "<child><widget class=\"GtkLabel\" id=\"label4\"/></child>");
 1085: 	if (root == NULL) {
 1086: 		printf ("Error: unable to parse content..\n");
 1087: 		return axl_false;
 1088: 	}
 1089: 
 1090: 	axl_node_free (root);
 1091: 	
 1092: 
 1093: 	return axl_true;
 1094: 
 1095: }
 1096: 
 1097: /** 
 1098:  * @brief Checks a bug while opening a document.
 1099:  * 
 1100:  * @param error The optional axlError to be used to report erros.
 1101:  * 
 1102:  * @return axl_true if the validity test is passed, otherwise axl_false is
 1103:  * returned.
 1104:  */
 1105: axl_bool test_35 (axlError ** error)
 1106: {
 1107: 	/* parse the document */
 1108: 	axlDoc * doc = axl_doc_parse_from_file ("test_35.xml", error);
 1109: 
 1110: 	if (doc == NULL)
 1111: 		return axl_false;
 1112: 
 1113: 	/* free the document */
 1114: 	axl_doc_free (doc);
 1115: 
 1116: 	return axl_true;
 1117: 	
 1118: }
 1119: 
 1120: /** 
 1121:  * @brief Checks a bug while triming strings.
 1122:  * 
 1123:  * @param error The optional axlError to be used to report erros.
 1124:  * 
 1125:  * @return axl_true if the validity test is passed, otherwise axl_false is
 1126:  * returned.
 1127:  */
 1128: axl_bool test_34 (axlError ** error)
 1129: {
 1130: 	char  * string = axl_strdup (" ");
 1131: 
 1132: 	axl_stream_trim (string);
 1133: 	if (strlen (string) != 0) {
 1134: 		axl_error_new (-1, "Expected to find empty string after trim operation, but not found", NULL, error);
 1135: 		return axl_false;
 1136: 	}
 1137: 
 1138: 	axl_free (string);
 1139: 
 1140: 	/* more length */
 1141: 	string = axl_strdup ("       ");
 1142: 
 1143: 	axl_stream_trim (string);
 1144: 	if (strlen (string) != 0) {
 1145: 		axl_error_new (-1, "Expected to find empty string after trim operation, but not found", NULL, error);
 1146: 		return axl_false;
 1147: 	}
 1148: 
 1149: 	axl_free (string);
 1150: 
 1151: 	/* more length with one byte */
 1152: 	string = axl_strdup ("  a     ");
 1153: 
 1154: 	axl_stream_trim (string);
 1155: 	if (strlen (string) != 1) {
 1156: 		axl_error_new (-1, "Expected to find one byte length string after trim operation, but not found", NULL, error);
 1157: 		return axl_false;
 1158: 	}
 1159: 
 1160: 	axl_free (string);
 1161: 
 1162: 	return axl_true;
 1163: }
 1164: 
 1165: /** 
 1166:  * @brief Checks a recursive root node configuration.
 1167:  * 
 1168:  * @param error The optional axlError to be used to report erros.
 1169:  * 
 1170:  * @return axl_true if the validity test is passed, otherwise axl_false is
 1171:  * returned.
 1172:  */
 1173: axl_bool test_33 (axlError ** error)
 1174: {
 1175: 	axlDoc          * doc;
 1176: 	axlNode         * node;
 1177: 	axlNode         * temp;
 1178: 	int               iterator;
 1179: 
 1180: 	/* create an empty document */
 1181: 	doc       = axl_doc_create (NULL, NULL, axl_true);
 1182: 	
 1183: 	/* set the root node */
 1184: 	node      = axl_node_create ("test");
 1185: 	axl_doc_set_root (doc, node);
 1186: 
 1187: 	/* create a root node */
 1188: 	iterator = 0;
 1189: 	while (iterator < 2) {
 1190: 		/* get current root */
 1191: 		temp = axl_doc_get_root (doc);
 1192: 
 1193: 		/* create a new root */
 1194: 		node = axl_node_create ("test");
 1195: 		
 1196: 		/* configure the new root */
 1197: 		axl_doc_set_root (doc, node);
 1198: 
 1199: 		/* configure the child */
 1200: 		axl_node_set_child (node, temp);
 1201: 		
 1202: 		/* next iterator */
 1203: 		iterator++;
 1204: 	}
 1205: 
 1206: 	/* free */
 1207: 	axl_doc_free (doc);
 1208: 
 1209: 	return axl_true;
 1210: }
 1211: 
 1212: /** 
 1213:  * @brief Test DTD attribute declaration support <!ATTLIST > using IDREF
 1214:  * declarations.
 1215:  * 
 1216:  * @param error The optional axlError to be used to report errors.
 1217:  * 
 1218:  * @return axl_true if the validity test is passed, axl_false if not.
 1219:  */
 1220: axl_bool test_32 (axlError ** error) {
 1221: 	
 1222: 	axlDtd          * dtd;
 1223: 	axlDoc          * doc;
 1224: 
 1225: 	dtd = axl_dtd_parse_from_file ("test_32.dtd", error);
 1226: 	if (dtd == NULL)
 1227: 		return axl_false;
 1228: 
 1229: 	doc = axl_doc_parse_from_file ("test_32.xml", error);
 1230: 	if (doc == NULL)
 1231: 		return axl_false;
 1232: 
 1233: 	/* validate */
 1234: 	if (! axl_dtd_validate (doc, dtd, error)) {
 1235: 		axl_error_new (-1, "Expected to find a validation error for the test (IDREF references)", NULL, error);
 1236: 		return axl_false;
 1237: 	}
 1238: 	
 1239: 	/* free dtd and doc */
 1240: 	axl_dtd_free (dtd);
 1241: 	axl_doc_free (doc);
 1242: 
 1243: 	return axl_true;
 1244: }
 1245: 
 1246: /** 
 1247:  * @brief Test DTD attribute declaration support <!ATTLIST > using ID
 1248:  * declarations.
 1249:  * 
 1250:  * @param error The optional axlError to be used to report errors.
 1251:  * 
 1252:  * @return axl_true if the validity test is passed, axl_false if not.
 1253:  */
 1254: axl_bool test_31 (axlError ** error) {
 1255: 	
 1256: 	axlDtd          * dtd;
 1257: 	axlDoc          * doc;
 1258: 
 1259: 	dtd = axl_dtd_parse_from_file ("test_31.dtd", error);
 1260: 	if (dtd == NULL)
 1261: 		return axl_false;
 1262: 
 1263: 	doc = axl_doc_parse_from_file ("test_31.xml", error);
 1264: 	if (doc == NULL)
 1265: 		return axl_false;
 1266: 
 1267: 	/* validate */
 1268: 	if (! axl_dtd_validate (doc, dtd, error)) {
 1269: 		axl_error_new (-1, "Expected to find a validation error for the test (unique ID)", NULL, error);
 1270: 		return axl_false;
 1271: 	}
 1272: 	
 1273: 	/* free dtd and doc */
 1274: 	axl_dtd_free (dtd);
 1275: 	axl_doc_free (doc);
 1276: 
 1277: 	dtd = axl_dtd_parse_from_file ("test_31a.dtd", error);
 1278: 	if (dtd != NULL) {
 1279: 		axl_error_new (-1, "Expected to find a error due to double declaration for an ID attribute, but DTD was loaded ok", NULL, error);
 1280: 		axl_dtd_free (dtd);
 1281: 		return axl_false;
 1282: 	}
 1283: 	axl_error_free (*error);
 1284: 	*error = NULL;
 1285: 
 1286: 	return axl_true;
 1287: }
 1288: 
 1289: 
 1290: /** 
 1291:  * @brief Test DTD attribute declaration support <!ATTLIST >
 1292:  * 
 1293:  * @param error The optional axlError to be used to report errors.
 1294:  * 
 1295:  * @return axl_true if the validity test is passed, axl_false if not.
 1296:  */
 1297: axl_bool test_30 (axlError ** error) {
 1298: 	
 1299: 	axlDtd          * dtd;
 1300: 	axlDtdAttribute * attr;
 1301: 	axlDoc          * doc;
 1302: 
 1303: 	dtd = axl_dtd_parse_from_file ("test_30.dtd", error);
 1304: 	if (dtd == NULL)
 1305: 		return axl_false;
 1306: 
 1307: 	/* get the declarations found */
 1308: 	attr = axl_dtd_get_attr (dtd, "node");
 1309: 	if (attr == NULL) {
 1310: 		axl_error_new (-1, "expected to find attribute declaration, but not found", NULL, error);
 1311: 		return axl_false;
 1312: 	} /* end if */
 1313: 
 1314: 	/* get the declarations found */
 1315: 	attr = axl_dtd_get_attr (dtd, "node1");
 1316: 	if (attr != NULL) {
 1317: 		axl_error_new (-1, "expected to NOT find attribute declaration, but not found", NULL, error);
 1318: 		return axl_false;
 1319: 	} /* end if */
 1320: 
 1321: 	/* check the number of contraints */
 1322: 	if (axl_dtd_get_attr_contraints (dtd, "node") != 3) {
 1323: 		axl_error_new (-1, "expected to find 2 contraints for the <node>, but not found", NULL, error);
 1324: 		return axl_false;
 1325: 	} /* end if */
 1326: 
 1327: 	doc = axl_doc_parse_from_file ("test_30.xml", error);
 1328: 	if (doc == NULL) {
 1329: 		axl_error_new (-1, "unable to parse file to check attribute validation", NULL, error);
 1330: 		return axl_false;
 1331: 	}
 1332: 
 1333: 	/* validate */
 1334: 	if (! axl_dtd_validate (doc, dtd, error))
 1335: 		return axl_false;
 1336: 
 1337: 	axl_doc_free (doc);
 1338: 
 1339: 	doc = axl_doc_parse_from_file ("test_30a.xml", error);
 1340: 	if (doc == NULL) {
 1341: 		axl_error_new (-1, "unable to parse file to check attribute validation", NULL, error);
 1342: 		return axl_false;
 1343: 	}
 1344: 
 1345: 	/* validate */
 1346: 	if (axl_dtd_validate (doc, dtd, error)) {
 1347: 		axl_error_new (-1, "Expected to find non-proper validation for enum value (2), inside attlist declaration", NULL, error);
 1348: 		return axl_false;
 1349: 	}
 1350: 	axl_error_free (*error);
 1351: 
 1352: 	axl_dtd_free (dtd);
 1353: 
 1354: 	dtd = axl_dtd_parse_from_file ("test_30b.dtd", error);
 1355: 	if (dtd == NULL)
 1356: 		return axl_false;
 1357: 
 1358: 	
 1359: 	/* validate */
 1360: 	if (axl_dtd_validate (doc, dtd, error)) {
 1361: 		axl_error_new (-1, "Expected to  find non-proper validation for required value, inside attlist declaration", NULL, error);
 1362: 		return axl_false;
 1363: 	}
 1364: 	axl_error_free (*error);
 1365: 	
 1366: 	axl_doc_free (doc);
 1367: 
 1368: 	doc = axl_doc_parse_from_file ("test_30b.xml", error);
 1369: 	if (doc == NULL) {
 1370: 		axl_error_new (-1, "unable to parse file to check attribute validation", NULL, error);
 1371: 		return axl_false;
 1372: 	}
 1373: 
 1374: 	/* validate */
 1375: 	if (! axl_dtd_validate (doc, dtd, error)) {
 1376: 		axl_error_new (-1, "Expected to FIND proper validation for required value, inside attlist declaration", NULL, error);
 1377: 		return axl_false;
 1378: 	}
 1379: 
 1380: 	axl_doc_free (doc);
 1381: 	axl_dtd_free (dtd);
 1382: 	return axl_true;
 1383: }
 1384: 
 1385: #ifdef AXL_NS_SUPPORT
 1386: 
 1387: #define HTML_NS "http://www.w3.org/1999/xhtml"
 1388: #define BOOK_NS "urn:loc.gov:books"
 1389: #define ISBN_NS "urn:ISBN:0-395-36341-6"
 1390: 
 1391: /** 
 1392:  * @brief Test namespace defaulting support from axl ns library.
 1393:  * 
 1394:  * @param error The optional axlError to be used to report errors.
 1395:  * 
 1396:  * @return axl_true if the validity test is passed, axl_false if not.
 1397:  */
 1398: axl_bool test_29 (axlError ** error)
 1399: {
 1400: 	axlDoc  * doc;
 1401: 	axlNode * node;
 1402: 
 1403: 	/* parse namespace file */
 1404: 	doc = axl_doc_parse_from_file ("test_29.xml", error);
 1405: 	if (doc == NULL)
 1406: 		return axl_false;
 1407: 
 1408: 	/* call to validate namespace */
 1409: 	if (! axl_ns_doc_validate (doc, error))
 1410: 		return axl_false;
 1411: 
 1412: 	/* get root document */
 1413: 	node = axl_doc_get_root (doc);
 1414: 
 1415: 	/* find number inside isbn namespace */
 1416: 	node = axl_ns_node_find_called (node, HTML_NS, "p");
 1417: 	if (node == NULL || ! axl_ns_node_cmp (node, HTML_NS, "p")) {
 1418: 		axl_error_new (-1, "Expected to find xhtml p node, but it wasn't found", NULL, error);
 1419: 		return axl_false;
 1420: 	} /* end if */
 1421: 
 1422: 	/* get root document */
 1423: 	node = axl_doc_get_root (doc);
 1424: 
 1425: 	/* find number inside isbn namespace */
 1426: 	node = axl_ns_node_get_child_called (node, ISBN_NS, "number");
 1427: 	if (node == NULL || ! axl_ns_node_cmp (node, ISBN_NS, "number")) {
 1428: 		axl_error_new (-1, "Expected to find isbn number node, but it wasn't found", NULL, error);
 1429: 		return axl_false;
 1430: 	} /* end if */
 1431: 
 1432: 	/* find number inside isbn namespace */
 1433: 	node = axl_ns_node_get_next_called (node, ISBN_NS, "test");
 1434: 	if (node == NULL || ! axl_ns_node_cmp (node, ISBN_NS, "test")) {
 1435: 		axl_error_new (-1, "Expected to find isbn test node, but it wasn't found", NULL, error);
 1436: 		return axl_false;
 1437: 	} /* end if */
 1438: 
 1439: 	
 1440: 	/* free document */
 1441: 	axl_doc_free (doc);
 1442: 
 1443: 	return axl_true;
 1444: }
 1445: 
 1446: /** 
 1447:  * @brief Test namespace defaulting support from axl ns library.
 1448:  * 
 1449:  * @param error The optional axlError to be used to report errors.
 1450:  * 
 1451:  * @return axl_true if the validity test is passed, axl_false if not.
 1452:  */
 1453: axl_bool test_28 (axlError ** error)
 1454: {
 1455: 	axlDoc  * doc;
 1456: 	axlNode * node;
 1457: 
 1458: 	/* parse namespace file */
 1459: 	doc = axl_doc_parse_from_file ("test_28.xml", error);
 1460: 	if (doc == NULL)
 1461: 		return axl_false;
 1462: 
 1463: 	/* call to validate namespace */
 1464: 	if (! axl_ns_doc_validate (doc, error))
 1465: 		return axl_false;
 1466: 
 1467: 	/* get root document */
 1468: 	node = axl_doc_get_root (doc);
 1469: 
 1470: 	/* get following node */
 1471: 	node = axl_node_get_first_child (node);
 1472: 
 1473: 	/* check default namespace */
 1474: 	if (! axl_ns_node_cmp (node, HTML_NS, "table")) {
 1475: 		axl_error_new (-1, "expected to find a valid ns-node-cmp, but it wasn't found", NULL, error);
 1476: 		return axl_false;
 1477: 	}
 1478: 
 1479: 	/* get the following */
 1480: 	node = axl_node_get_first_child (node);
 1481: 
 1482: 	/* check default namespace */
 1483: 	if (! axl_ns_node_cmp (node, HTML_NS, "th")) {
 1484: 		axl_error_new (-1, "expected to find a valid ns-node-cmp, but it wasn't found", NULL, error);
 1485: 		return axl_false;
 1486: 	}
 1487: 
 1488: 	axl_doc_free (doc);
 1489: 
 1490: 	return axl_true;
 1491: }
 1492: 
 1493: /** 
 1494:  * @brief Test namespace support from axl ns library.
 1495:  * 
 1496:  * @param error The optional axlError to be used to report errors.
 1497:  * 
 1498:  * @return axl_true if the validity test is passed, axl_false if not.
 1499:  */
 1500: axl_bool test_27 (axlError ** error)
 1501: {
 1502: 	axlDoc  * doc;
 1503: 	axlNode * node;
 1504: 
 1505: 	/* parse namespace file */
 1506: 	doc = axl_doc_parse_from_file ("test_27.xml", error);
 1507: 	if (doc == NULL)
 1508: 		return axl_false;
 1509: 
 1510: 	/* call to validate namespace */
 1511: 	if (! axl_ns_doc_validate (doc, error))
 1512: 		return axl_false;
 1513: 
 1514: 	/* get root document */
 1515: 	node = axl_doc_get_root (doc);
 1516: 
 1517: 	if (! axl_ns_node_cmp (node, BOOK_NS, "book")) {
 1518: 		axl_error_new (-1, "expected to find a valid ns-node-cmp, but it wasn't found", NULL, error);
 1519: 		return axl_false;
 1520: 	}
 1521: 
 1522: 	/* get first child */
 1523: 	node = axl_node_get_first_child (node);
 1524: 
 1525: 	if (! axl_ns_node_cmp (node, BOOK_NS, "title")) {
 1526: 		axl_error_new (-1, "expected to find a failure validating with ns-node-cmp, but it wasn't found", NULL, error);
 1527: 		return axl_false;
 1528: 	}
 1529: 
 1530: 	node = axl_node_get_next (node);
 1531: 	if (axl_ns_node_cmp (node, BOOK_NS, "number")) {
 1532: 		axl_error_new (-1, "expected to find a failure validating with ns-node-cmp, but it wasn't found", NULL, error);
 1533: 		return axl_false;
 1534: 	}
 1535: 
 1536: 	/* get next */
 1537: 	if (! axl_ns_node_cmp (node, ISBN_NS, "number")) {
 1538: 		axl_error_new (-1, "expected to find a valid ns-node-cmp, but it wasn't found", NULL, error);
 1539: 		return axl_false;
 1540: 	}
 1541: 
 1542: 	axl_doc_free (doc);
 1543: 
 1544: 	return axl_true;
 1545: }
 1546: 
 1547: 
 1548: /** 
 1549:  * @brief Test namespace support from axl ns library.
 1550:  * 
 1551:  * @param error The optional axlError to be used to report errors.
 1552:  * 
 1553:  * @return axl_true if the validity test is passed, axl_false if not.
 1554:  */
 1555: axl_bool test_26 (axlError ** error)
 1556: {
 1557: 	axlDoc * doc;
 1558: 
 1559: 	/* parse namespace file */
 1560: 	doc = axl_doc_parse_from_file ("test_26.xml", error);
 1561: 	if (doc == NULL)
 1562: 		return axl_false;
 1563: 
 1564: 	/* call to validate namespace */
 1565: 	if (! axl_ns_doc_validate (doc, error))
 1566: 		return axl_false;
 1567: 
 1568: 	axl_doc_free (doc);
 1569: 
 1570: 	/* parse a namespace file that do not follow rules (node) */
 1571: 	doc = axl_doc_parse_from_file ("test_26b.xml", error);
 1572: 	if (doc == NULL)
 1573: 		return axl_false;
 1574: 
 1575: 	/* call to validate namespace */
 1576: 	if (axl_ns_doc_validate (doc, error)) {
 1577: 		axl_error_new (-1, "Expected to find ns validation error, but not found (test_26b)", NULL, error);
 1578: 		return axl_false;
 1579: 	}
 1580: 	axl_error_free (*error);
 1581: 
 1582: 	axl_doc_free (doc);
 1583: 
 1584: 	/* parse a namespace file that do not follow rules (attribute) */
 1585: 	doc = axl_doc_parse_from_file ("test_26c.xml", error);
 1586: 	if (doc == NULL)
 1587: 		return axl_false;
 1588: 
 1589: 	/* call to validate namespace */
 1590: 	if (axl_ns_doc_validate (doc, error)) {
 1591: 		axl_error_new (-1, "Expected to find ns validation error, but not found (test_26c)", NULL, error);
 1592: 		return axl_false;
 1593: 	}
 1594: 	axl_error_free (*error);
 1595: 
 1596: 	axl_doc_free (doc);
 1597: 
 1598: 	return axl_true;
 1599: }
 1600: 
 1601: #endif /* end #ifdef AXL_NS_SUPPORT */
 1602: 
 1603: /** 
 1604:  * @brief Test Axl Item API while performing lookups.
 1605:  * 
 1606:  * @param error The optional axlError to be used to report errors.
 1607:  * 
 1608:  * @return axl_true if the validity test is passed, axl_false if not.
 1609:  */
 1610: axl_bool test_25 (axlError ** error) {
 1611: 	
 1612: 	axlDoc  * doc;
 1613: 	axlNode * root;
 1614: 	axlNode * node;
 1615: 
 1616: 	/* load the document */
 1617: 	doc = axl_doc_parse_from_file ("test_23.xml", error);
 1618: 	if (doc == NULL)
 1619: 		return axl_false;	
 1620: 
 1621: 	/* get root node */
 1622: 	root = axl_doc_get_root (doc);
 1623: 
 1624: 	/* lookup a node */
 1625: 	node = axl_node_find_called (root, "child3");
 1626: 
 1627: 	if (! NODE_CMP_NAME (node, "child3")) {
 1628: 		axl_error_new (-1, "Expected to find <child3> node but it wasn't found", NULL, error);
 1629: 		return axl_false;
 1630: 	} 
 1631: 
 1632: 	/* lookup a node */
 1633: 	node = axl_node_find_called (root, "strong");
 1634: 
 1635: 	if (! NODE_CMP_NAME (node, "strong")) {
 1636: 		axl_error_new (-1, "Expected to find <strong> node but it wasn't found", NULL, error);
 1637: 		return axl_false;
 1638: 	} 
 1639: 
 1640: 	if (! axl_cmp (axl_node_get_content (node, NULL), "this content goes\n  bold")) {
 1641: 		axl_error_new (-1, "Expected to find <strong> node content, but it wasn't found", NULL, error);
 1642: 		return axl_false;
 1643: 	}
 1644: 
 1645: 	/* lookup a node */
 1646: 	node = axl_node_find_called (root, "strong1");
 1647: 	if (node != NULL) {
 1648: 		axl_error_new (-1, "Expected to not find node content, but it wasn't found", NULL, error);
 1649: 		return axl_false;
 1650: 	}
 1651: 
 1652: 	/* free the document */
 1653: 	axl_doc_free (doc);
 1654: 	
 1655: 	return axl_true;
 1656: }
 1657: 
 1658: 
 1659: /** 
 1660:  * @brief Test Axl Item API while replacing nodes and adding content
 1661:  * on a particular position.
 1662:  * 
 1663:  * @param error The optional axlError to be used to report errors.
 1664:  * 
 1665:  * @return axl_true if the validity test is passed, axl_false if not.
 1666:  */
 1667: axl_bool test_24 (axlError ** error) {
 1668: 	if (! axl_node_has_invalid_chars ("MEDIR PIEZAS S/MUESTREO EN MAQUINA DE VISION SIN CONTACTO\n\
 1669: \n\
 1670: LOTES<10 UDS.                  100%PIEZAS\n\
 1671: 10 UDS.<LOTES<20 UDS.  10+20% (SOBRE 10 PIEZAS)\n\
 1672: LOTES>20  UDS                  12+10% (SOBRE 20 PIEZAS)                    \n\
 1673:  \n\
 1674: ¡ATENCION!!!!\n\
 1675: MANIPULAR PIEZAS CON GUANTES DE LATEX EVITANDO CONTAMINAR LAS PIEZAS", -1, NULL)) {
 1676: 		axl_error_new (-1, "Expected to find invalid characters, but it wasn't found", NULL, error);
 1677: 		return axl_false;
 1678: 	}
 1679: 
 1680: 	if (axl_node_has_invalid_chars ("MEDIR PIEZAS S/MUESTREO EN MAQUINA DE VISION SIN CONTACTO\n\
 1681: \n\
 1682: LOTES 10 UDS.               100%PIEZAS\n\
 1683: 10 UDS. LOTES 20 UDS.  10+20% (SOBRE 10 PIEZAS)\n\
 1684: LOTES20  UDS                  12+10% (SOBRE 20 PIEZAS)                    \n\
 1685:  \n\
 1686: ¡ATENCION!!!!\n\
 1687: MANIPULAR PIEZAS CON GUANTES DE LATEX EVITANDO CONTAMINAR LAS PIEZAS", -1, NULL)) {
 1688: 		axl_error_new (-1, "Expected to find valid characters, but it wasn't found", NULL, error);
 1689: 		return axl_false;
 1690: 	}
 1691: 
 1692: 	return axl_true;
 1693: }
 1694: 
 1695: /** 
 1696:  * @brief Test Axl Item API while replacing nodes and adding content
 1697:  * on a particular position.
 1698:  * 
 1699:  * @param error The optional axlError to be used to report errors.
 1700:  * 
 1701:  * @return axl_true if the validity test is passed, axl_false if not.
 1702:  */
 1703: axl_bool test_23 (axlError ** error)
 1704: {
 1705: 	axlDoc  * doc;
 1706: 	axlDoc  * doc2;
 1707: 	axlNode * node;
 1708: 	axlItem * item;
 1709: 
 1710: 	/* load the document */
 1711: 	doc = axl_doc_parse_from_file ("test_23.xml", error);
 1712: 	if (doc == NULL)
 1713: 		return axl_false;
 1714: 
 1715: 	/* get the child1 node */
 1716: 	node = axl_doc_get (doc, "/document/childs/child3a");
 1717: 	if (node == NULL) {
 1718: 		axl_error_new (-1, "Unable to get child3a node under /document/child3a", NULL, error);
 1719: 		return axl_false;
 1720: 	}
 1721: 
 1722: 	if (! NODE_CMP_NAME (node, "child3a")) {
 1723: 		axl_error_new (-1, "Found node that wasn't expected", NULL, error);
 1724: 		return axl_false;
 1725: 	}
 1726: 
 1727: 	if (! axl_node_is_empty (node)) {
 1728: 		axl_error_new (-1, "Expected to find child3a node to be empty, but it wasn't found", NULL, error);
 1729: 		return axl_false;
 1730: 	}
 1731: 	
 1732: 	/* get the child1 node */
 1733: 	node = axl_doc_get (doc, "/document/childs/child1");
 1734: 	if (node == NULL) {
 1735: 		axl_error_new (-1, "Unable to get child1 node under /document/childs", NULL, error);
 1736: 		return axl_false;
 1737: 	}
 1738: 
 1739: 	if (! NODE_CMP_NAME (node, "child1")) {
 1740: 		axl_error_new (-1, "Found node that wasn't expected", NULL, error);
 1741: 		return axl_false;
 1742: 	}
 1743: 
 1744: 	/* create content */
 1745: 	item = axl_item_new (ITEM_CONTENT, "This is a test");
 1746: 
 1747: 	/* replace the node */
 1748: 	axl_item_replace (axl_item_node_holder (node), item, axl_true);
 1749: 
 1750: 	/* now parse the reference xml document */
 1751: 	doc2 = axl_doc_parse_from_file ("test_23b.xml", error);
 1752: 	if (doc2 == NULL)
 1753: 		return axl_false;
 1754: 	
 1755: 	/* check that both documents are equal */
 1756: 	if (! axl_doc_are_equal_trimmed (doc, doc2)) {
 1757: 		axl_error_new (-1, "Expected to find equal documents, but it wasn't found", NULL, error);
 1758: 		return axl_false;
 1759: 	}
 1760: 	
 1761: 	/* free the document */
 1762: 	axl_doc_free (doc);
 1763: 
 1764: 	/* load the document */
 1765: 	doc = axl_doc_parse_from_file ("test_23.xml", error);
 1766: 	if (doc == NULL)
 1767: 		return axl_false;
 1768: 
 1769: 	/* check that both documents aren't equal using strict comparation */
 1770: 	if (axl_doc_are_equal (doc, doc2)) {
 1771: 		axl_error_new (-1, "Expected to find documents not equal, but it wasn't found", NULL, error);
 1772: 		return axl_false;
 1773: 	}
 1774: 
 1775: 	/* free the document */
 1776: 	axl_doc_free (doc);
 1777: 	axl_doc_free (doc2);
 1778: 
 1779: 	/* test ok */
 1780: 	return axl_true;
 1781: }
 1782: 
 1783: /** 
 1784:  * @brief Test xml attribute support.
 1785:  * 
 1786:  * @param error The optional axlError to be used to report errors.
 1787:  * 
 1788:  * @return axl_true if the validity test is passed, axl_false if not.
 1789:  */
 1790: axl_bool test_22 (axlError ** error)
 1791: {
 1792: 	axlDoc        * doc;
 1793: 	axlNode       * node;
 1794: 	const   char  * value;
 1795: 	axlAttrCursor * cursor;
 1796: 
 1797: 	
 1798: 	/* create a document */
 1799: 	doc  = axl_doc_create (NULL, NULL, axl_false);
 1800: 
 1801: 	node = axl_node_create ("root-node");
 1802: 	axl_doc_set_root (doc, node);
 1803: 
 1804: 	/* check for attributes */
 1805: 	if (axl_node_has_attribute (node, "attribute-not-found")) {
 1806: 		axl_error_new (-1, "Found an attribute requested, which doesn't exists", NULL, error);
 1807: 		return axl_false;
 1808: 	}
 1809: 
 1810: 	/* get attribute */
 1811: 	value = axl_node_get_attribute_value (node, "attribute-not-found");
 1812: 	if (value != NULL) {
 1813: 		axl_error_new (-1, "Found an attribute requested, which doesn't exists", NULL, error);
 1814: 		return axl_false;
 1815: 	}
 1816: 
 1817: 	/* store an attriburte */
 1818: 	axl_node_set_attribute (node, "attribute1", "value1");
 1819: 
 1820: 	/* check for attributes */
 1821: 	if (! axl_node_has_attribute (node, "attribute1")) {
 1822: 		axl_error_new (-1, "Not found an attribute requested, which should exists", NULL, error);
 1823: 		return axl_false;
 1824: 	}
 1825: 
 1826: 	/* get attribute */
 1827: 	value = axl_node_get_attribute_value (node, "attribute1");
 1828: 	if (! axl_cmp (value, "value1")) {
 1829: 		axl_error_new (-1, "Not found an attribute requested, which should exists", NULL, error);
 1830: 		return axl_false;
 1831: 	}
 1832: 
 1833: 	/* store more attributes to check function with hashes */
 1834: 	axl_node_set_attribute (node, "attribute2", "value2");
 1835: 	axl_node_set_attribute (node, "attribute3", "value3");
 1836: 	axl_node_set_attribute (node, "attribute4", "value4");
 1837: 	axl_node_set_attribute (node, "attribute5", "value5");
 1838: 	axl_node_set_attribute (node, "attribute6", "value6");
 1839: 
 1840: 	/* check axl attribute iteration API */
 1841: 	cursor = axl_node_attr_cursor_new (node);
 1842: 	while (axl_node_attr_cursor_has_item (cursor)) {
 1843: 		
 1844: 		if (axl_cmp ("attribute2", axl_node_attr_cursor_get_key (cursor)) &&
 1845: 		    ! axl_cmp ("value2", axl_node_attr_cursor_get_value (cursor))) {
 1846: 			axl_error_new (-1, "Found that the value associated to 'attribute2' isn't 'value2'", NULL, error);
 1847: 			return axl_false;
 1848: 		} /* end if */
 1849: 
 1850: 		if (axl_cmp ("attribute3", axl_node_attr_cursor_get_key (cursor)) &&
 1851: 		    ! axl_cmp ("value3", axl_node_attr_cursor_get_value (cursor))) {
 1852: 			axl_error_new (-1, "Found that the value associated to 'attribute3' isn't 'value3'", NULL, error);
 1853: 			return axl_false;
 1854: 		} /* end if */
 1855: 
 1856: 		if (axl_cmp ("attribute4", axl_node_attr_cursor_get_key (cursor)) &&
 1857: 		    ! axl_cmp ("value4", axl_node_attr_cursor_get_value (cursor))) {
 1858: 			axl_error_new (-1, "Found that the value associated to 'attribute4' isn't 'value4'", NULL, error);
 1859: 			return axl_false;
 1860: 		} /* end if */
 1861: 			     
 1862: 		if (axl_cmp ("attribute5", axl_node_attr_cursor_get_key (cursor)) &&
 1863: 		    ! axl_cmp ("value5", axl_node_attr_cursor_get_value (cursor))) {
 1864: 			axl_error_new (-1, "Found that the value associated to 'attribute5' isn't 'value5'", NULL, error);
 1865: 			return axl_false;
 1866: 		} /* end if */
 1867: 
 1868: 		if (axl_cmp ("attribute6", axl_node_attr_cursor_get_key (cursor)) &&
 1869: 		    ! axl_cmp ("value6", axl_node_attr_cursor_get_value (cursor))) {
 1870: 			axl_error_new (-1, "Found that the value associated to 'attribute6' isn't 'value6'", NULL, error);
 1871: 			return axl_false;
 1872: 		} /* end if */
 1873: 
 1874: 		/* go next */
 1875: 		axl_node_attr_cursor_next (cursor);
 1876: 
 1877: 	} /* end if */
 1878: 
 1879: 	axl_node_attr_cursor_free (cursor);
 1880: 
 1881: 
 1882: 	axl_node_set_attribute (node, "attribute7", "value7");
 1883: 	axl_node_set_attribute (node, "attribute8", "value8");
 1884: 	axl_node_set_attribute (node, "attribute9", "value9");
 1885: 	axl_node_set_attribute (node, "attribute10", "value10");
 1886: 	axl_node_set_attribute (node, "attribute11", "value11");
 1887: 	
 1888: 	/* check that an attribute doesn't exists */
 1889: 	if (axl_node_has_attribute (node, "attribute-not-found")) {
 1890: 		axl_error_new (-1, "Found an attribute requested, which doesn't exists", NULL, error);
 1891: 		return axl_false;
 1892: 	}
 1893: 
 1894: 	/* get attribute */
 1895: 	value = axl_node_get_attribute_value (node, "attribute-not-found");
 1896: 	if (value != NULL) {
 1897: 		axl_error_new (-1, "Found an attribute requested, which doesn't exists", NULL, error);
 1898: 		return axl_false;
 1899: 	}
 1900: 
 1901: 	/* check for attributes */
 1902: 	if (! axl_node_has_attribute (node, "attribute2")) {
 1903: 		axl_error_new (-1, "Not found an attribute requested, which should exists(2)", NULL, error);
 1904: 		return axl_false;
 1905: 	}
 1906: 
 1907: 	/* get attribute */
 1908: 	value = axl_node_get_attribute_value (node, "attribute2");
 1909: 	if (! axl_cmp (value, "value2")) {
 1910: 		printf ("value2 != %s\n", value);
 1911: 		axl_error_new (-1, "Not found an attribute requested, which should exists(value2)", NULL, error);
 1912: 		return axl_false;
 1913: 	}
 1914: 
 1915: 	/* check for attributes */
 1916: 	if (! axl_node_has_attribute (node, "attribute3")) {
 1917: 		axl_error_new (-1, "Not found an attribute requested, which should exists(3)", NULL, error);
 1918: 		return axl_false;
 1919: 	}
 1920: 
 1921: 	/* get attribute */
 1922: 	value = axl_node_get_attribute_value (node, "attribute3");
 1923: 	if (! axl_cmp (value, "value3")) {
 1924: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value3)", NULL, error);
 1925: 		return axl_false;
 1926: 	}
 1927: 
 1928: 	/* check for attributes */
 1929: 	if (! axl_node_has_attribute (node, "attribute4")) {
 1930: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value4)", NULL, error);
 1931: 		return axl_false;
 1932: 	}
 1933: 
 1934: 	/* get attribute */
 1935: 	value = axl_node_get_attribute_value (node, "attribute4");
 1936: 	if (! axl_cmp (value, "value4")) {
 1937: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value4)", NULL, error);
 1938: 		return axl_false;
 1939: 	}
 1940: 
 1941: 	/* check for attributes */
 1942: 	if (! axl_node_has_attribute (node, "attribute5")) {
 1943: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value5)", NULL, error);
 1944: 		return axl_false;
 1945: 	}
 1946: 
 1947: 	/* get attribute */
 1948: 	value = axl_node_get_attribute_value (node, "attribute5");
 1949: 	if (! axl_cmp (value, "value5")) {
 1950: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value5)", NULL, error);
 1951: 		return axl_false;
 1952: 	}
 1953: 
 1954: 	/* check for attributes */
 1955: 	if (! axl_node_has_attribute (node, "attribute6")) {
 1956: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value6)", NULL, error);
 1957: 		return axl_false;
 1958: 	}
 1959: 
 1960: 	/* get attribute */
 1961: 	value = axl_node_get_attribute_value (node, "attribute6");
 1962: 	if (! axl_cmp (value, "value6")) {
 1963: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value6)", NULL, error);
 1964: 		return axl_false;
 1965: 	}
 1966: 
 1967: 	/* check for attributes */
 1968: 	if (! axl_node_has_attribute (node, "attribute7")) {
 1969: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value7)", NULL, error);
 1970: 		return axl_false;
 1971: 	}
 1972: 
 1973: 	/* get attribute */
 1974: 	value = axl_node_get_attribute_value (node, "attribute7");
 1975: 	if (! axl_cmp (value, "value7")) {
 1976: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value7)", NULL, error);
 1977: 		return axl_false;
 1978: 	}
 1979: 
 1980: 	/* check for attributes */
 1981: 	if (! axl_node_has_attribute (node, "attribute8")) {
 1982: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value8)", NULL, error);
 1983: 		return axl_false;
 1984: 	}
 1985: 
 1986: 	/* get attribute */
 1987: 	value = axl_node_get_attribute_value (node, "attribute8");
 1988: 	if (! axl_cmp (value, "value8")) {
 1989: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value8)", NULL, error);
 1990: 		return axl_false;
 1991: 	}
 1992: 
 1993: 	/* check for attributes */
 1994: 	if (! axl_node_has_attribute (node, "attribute9")) {
 1995: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value9)", NULL, error);
 1996: 		return axl_false;
 1997: 	}
 1998: 
 1999: 	/* get attribute */
 2000: 	value = axl_node_get_attribute_value (node, "attribute9");
 2001: 	if (! axl_cmp (value, "value9")) {
 2002: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value9)", NULL, error);
 2003: 		return axl_false;
 2004: 	}
 2005: 
 2006: 	/* check for attributes */
 2007: 	if (! axl_node_has_attribute (node, "attribute10")) {
 2008: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value10)", NULL, error);
 2009: 		return axl_false;
 2010: 	}
 2011: 
 2012: 	/* get attribute */
 2013: 	value = axl_node_get_attribute_value (node, "attribute10");
 2014: 	if (! axl_cmp (value, "value10")) {
 2015: 		axl_error_new (-1, "Not found an attribute value requested, which should exists (value10)", NULL, error);
 2016: 		return axl_false;
 2017: 	}
 2018: 
 2019: 	/* check for attributes */
 2020: 	if (! axl_node_has_attribute (node, "attribute11")) {
 2021: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value11)", NULL, error);
 2022: 		return axl_false;
 2023: 	}
 2024: 
 2025: 	/* get attribute */
 2026: 	value = axl_node_get_attribute_value (node, "attribute11");
 2027: 	if (! axl_cmp (value, "value11")) {
 2028: 		axl_error_new (-1, "Not found an attribute requested, which should exists (value11)", NULL, error);
 2029: 		return axl_false;
 2030: 	}
 2031: 
 2032: 	/* check axl attribute iteration API */
 2033: 	cursor = axl_node_attr_cursor_new (node);
 2034: 	while (axl_node_attr_cursor_has_item (cursor)) {
 2035: 		
 2036: 		if (axl_cmp ("attribute2", axl_node_attr_cursor_get_key (cursor)) &&
 2037: 		    ! axl_cmp ("value2", axl_node_attr_cursor_get_value (cursor))) {
 2038: 			axl_error_new (-1, "Found that the value associated to 'attribute2' isn't 'value2'", NULL, error);
 2039: 			return axl_false;
 2040: 		} /* end if */
 2041: 
 2042: 		if (axl_cmp ("attribute3", axl_node_attr_cursor_get_key (cursor)) &&
 2043: 		    ! axl_cmp ("value3", axl_node_attr_cursor_get_value (cursor))) {
 2044: 			axl_error_new (-1, "Found that the value associated to 'attribute3' isn't 'value3'", NULL, error);
 2045: 			return axl_false;
 2046: 		} /* end if */
 2047: 
 2048: 		if (axl_cmp ("attribute4", axl_node_attr_cursor_get_key (cursor)) &&
 2049: 		    ! axl_cmp ("value4", axl_node_attr_cursor_get_value (cursor))) {
 2050: 			axl_error_new (-1, "Found that the value associated to 'attribute4' isn't 'value4'", NULL, error);
 2051: 			return axl_false;
 2052: 		} /* end if */
 2053: 			     
 2054: 		if (axl_cmp ("attribute5", axl_node_attr_cursor_get_key (cursor)) &&
 2055: 		    ! axl_cmp ("value5", axl_node_attr_cursor_get_value (cursor))) {
 2056: 			axl_error_new (-1, "Found that the value associated to 'attribute5' isn't 'value5'", NULL, error);
 2057: 			return axl_false;
 2058: 		} /* end if */
 2059: 
 2060: 		if (axl_cmp ("attribute6", axl_node_attr_cursor_get_key (cursor)) &&
 2061: 		    ! axl_cmp ("value6", axl_node_attr_cursor_get_value (cursor))) {
 2062: 			axl_error_new (-1, "Found that the value associated to 'attribute6' isn't 'value6'", NULL, error);
 2063: 			return axl_false;
 2064: 		} /* end if */
 2065: 
 2066: 		if (axl_cmp ("attribute7", axl_node_attr_cursor_get_key (cursor)) &&
 2067: 		    ! axl_cmp ("value7", axl_node_attr_cursor_get_value (cursor))) {
 2068: 			axl_error_new (-1, "Found that the value associated to 'attribute7' isn't 'value7'", NULL, error);
 2069: 			return axl_false;
 2070: 		} /* end if */
 2071: 
 2072: 		if (axl_cmp ("attribute8", axl_node_attr_cursor_get_key (cursor)) &&
 2073: 		    ! axl_cmp ("value8", axl_node_attr_cursor_get_value (cursor))) {
 2074: 			axl_error_new (-1, "Found that the value associated to 'attribute8' isn't 'value8'", NULL, error);
 2075: 			return axl_false;
 2076: 		} /* end if */
 2077: 
 2078: 		if (axl_cmp ("attribute9", axl_node_attr_cursor_get_key (cursor)) &&
 2079: 		    ! axl_cmp ("value9", axl_node_attr_cursor_get_value (cursor))) {
 2080: 			axl_error_new (-1, "Found that the value associated to 'attribute9' isn't 'value9'", NULL, error);
 2081: 			return axl_false;
 2082: 		} /* end if */
 2083: 
 2084: 		if (axl_cmp ("attribute10", axl_node_attr_cursor_get_key (cursor)) &&
 2085: 		    ! axl_cmp ("value10", axl_node_attr_cursor_get_value (cursor))) {
 2086: 			axl_error_new (-1, "Found that the value associated to 'attribute10' isn't 'value10'", NULL, error);
 2087: 			return axl_false;
 2088: 		} /* end if */
 2089: 
 2090: 		if (axl_cmp ("attribute11", axl_node_attr_cursor_get_key (cursor)) &&
 2091: 		    ! axl_cmp ("value11", axl_node_attr_cursor_get_value (cursor))) {
 2092: 			axl_error_new (-1, "Found that the value associated to 'attribute11' isn't 'value11'", NULL, error);
 2093: 			return axl_false;
 2094: 		} /* end if */
 2095: 
 2096: 		/* go next */
 2097: 		axl_node_attr_cursor_next (cursor);
 2098: 
 2099: 	} /* end if */
 2100: 
 2101: 	axl_node_attr_cursor_free (cursor);
 2102: 
 2103: 	/* remove attributes */
 2104: 	if (axl_node_num_attributes (node) != 11) {
 2105: 		axl_error_new (-1, "Expected to find 11 attributes", NULL, error);
 2106: 		return axl_false;
 2107: 	}
 2108: 	
 2109: 	printf ("Test 22: removing attribute 1, current attributes are %d\n", axl_node_num_attributes (node));
 2110: 	axl_node_remove_attribute (node, "attribute1");
 2111: 	printf ("Test 22: after removing attribute 1, current attributes are %d\n", axl_node_num_attributes (node));
 2112: 
 2113: 	if (axl_node_num_attributes (node) != 10) {
 2114: 		axl_error_report (error, -1, "Expected to find 10 attributes, but found: %d", axl_node_num_attributes (node));
 2115: 		return axl_false;
 2116: 	}
 2117: 	
 2118: 	if (axl_node_has_attribute (node, "attribute1")) {
 2119: 		axl_error_new (-1, "Found that attribute1 should not appear, but it was found", NULL, error);
 2120: 		return axl_false;
 2121: 	} /* end if */
 2122: 
 2123: 	node = axl_node_create ("test");
 2124: 	axl_node_set_attribute (node, "test", "test");
 2125: 	
 2126: 	if (axl_node_num_attributes (node) != 1) {
 2127: 		axl_error_new (-1, "Expected to find 1 attributes", NULL, error);
 2128: 		return axl_false;
 2129: 	}
 2130: 
 2131: 	axl_node_remove_attribute (node, "test");
 2132: 
 2133: 	if (axl_node_num_attributes (node) != 0) {
 2134: 		axl_error_new (-1, "Expected to find 1 attributes", NULL, error);
 2135: 		return axl_false;
 2136: 	}
 2137: 
 2138: 	axl_node_set_attribute (node, "test1", "test");
 2139: 	axl_node_set_attribute (node, "test2", "test");
 2140: 	axl_node_set_attribute (node, "test3", "test");
 2141: 
 2142: 	if (axl_node_num_attributes (node) != 3) {
 2143: 		axl_error_new (-1, "Expected to find 3 attributes", NULL, error);
 2144: 		return axl_false;
 2145: 	}
 2146: 
 2147: 	axl_node_remove_attribute (node, "test1");
 2148: 	axl_node_remove_attribute (node, "test2");
 2149: 	axl_node_remove_attribute (node, "test3");
 2150: 
 2151: 	if (axl_node_num_attributes (node) != 0) {
 2152: 		axl_error_new (-1, "Expected to find 0 attributes", NULL, error);
 2153: 		return axl_false;
 2154: 	}
 2155: 
 2156: 	axl_node_free (node);
 2157: 	
 2158: 	/* free document */
 2159: 	axl_doc_free (doc);
 2160: 
 2161: 	/* check to parse a document with */
 2162: 	doc = axl_doc_parse_from_file ("test_22.xml", NULL);
 2163: 	if (doc != NULL) {
 2164: 		axl_error_report (error, -1, "Expected to find a failure while reading an xml document with duplicated attributes");
 2165: 		return axl_false;
 2166: 	} /* end if */
 2167: 
 2168: 	
 2169: 	/* check for empty attributes ( ='value') */
 2170: 	doc = axl_doc_parse_from_file ("test_22b.xml", NULL);
 2171: 	if (doc != NULL) {
 2172: 		axl_error_report (error, -1, "Expected to find a failure while loading a document with empty attributes");
 2173: 		return axl_false;
 2174: 	}
 2175: 
 2176: 	/* check for empty values associated to
 2177: 	 * attributes ( value=' this value ' ) */
 2178: 	doc = axl_doc_parse_from_file ("test_22c.xml", NULL);
 2179: 	if (doc != NULL) {
 2180: 		axl_error_report (error, -1, "Expected to find a failure while loading a document with empty attributes values");
 2181: 		return axl_false;
 2182: 	} /* end if */
 2183: 
 2184: 	doc = axl_doc_create (NULL, NULL, axl_true);
 2185: 	node = axl_node_create ("test");
 2186: 	axl_doc_set_root (doc, node);
 2187: 
 2188: 	/* configure attributes */
 2189: 	axl_node_set_attribute (node, "", "a value");
 2190: 
 2191: 	/* configure attribute */
 2192: 	axl_node_set_attribute (node, "", "");
 2193: 
 2194: 	/* configure attribute */
 2195: 	axl_node_set_attribute (node, "", "another value");
 2196: 
 2197: 	if (! axl_doc_dump_pretty_to_file (doc, "test_22-test.xml", 4)) {
 2198: 		axl_error_report (error, -1, "Expected to find proper dump after wrong attribute configuration..");
 2199: 		return axl_false;
 2200: 	} /* end if */
 2201: 
 2202: 	axl_doc_free (doc);
 2203: 
 2204: 	/* check for empty values associated to
 2205: 	 * attributes ( value=' this value ' ) */
 2206: 	doc = axl_doc_parse_from_file ("test_22-test.xml", NULL);
 2207: 	if (doc == NULL) {
 2208: 		axl_error_report (error, -1, "Expected to find proper document loading after wrong attribute configuration.");
 2209: 		return axl_false;
 2210: 	} /* end if */
 2211: 
 2212: 	/* free documnent */
 2213: 	axl_doc_free (doc);
 2214: 
 2215: 	return axl_true;
 2216: }
 2217: 
 2218: /** 
 2219:  * @brief Test mixed content documents support (TEST NOT FINISHED).
 2220:  * 
 2221:  * @param error The optional axlError to be used to report errors.
 2222:  * 
 2223:  * @return axl_true if the validity test is passed, axl_false if not.
 2224:  */
 2225: axl_bool test_21 (axlError ** error)
 2226: {
 2227: 	axlDoc  * doc;
 2228: 	axlNode * node;
 2229: 	axlItem * item;
 2230: 	char    * content;
 2231: 	int       content_size;
 2232: 
 2233: 	/* load the document */
 2234: 	doc = axl_doc_parse_from_file ("test_21.xml", error);
 2235: 	if (doc == NULL)
 2236: 		return axl_false;
 2237: 
 2238: 	/* get the root node */
 2239: 	node = axl_doc_get_root (doc);
 2240: 
 2241: 	/* check document content */
 2242: 	if (! NODE_CMP_NAME (node, "document")) {
 2243: 		axl_error_new (-1, "Expected to find root node=<document> but it wasn't found", NULL, error);
 2244: 		return axl_false;
 2245: 	}
 2246: 
 2247: 	/* iterate root childs */
 2248: 	item = axl_item_get_first_child (node);
 2249: 
 2250: 	if (axl_item_get_type (item) != ITEM_CONTENT) {
 2251: 		axl_error_new (-1, "Expected to find content but it wasn't found", NULL, error);
 2252: 		return axl_false;
 2253: 	}	
 2254: 
 2255: 	/* get the content */
 2256: 	content = axl_item_get_content (item, &content_size);
 2257: 	if (! axl_cmp (content, "\n  Some content inside the document ")) {
 2258: 		axl_error_new (-1, "Expected to find content but it wasn't found", NULL, error);
 2259: 		return axl_false;
 2260: 	}
 2261: 
 2262: 	/* get tne the item */
 2263: 	item = axl_item_get_next (item);
 2264: 	if (axl_item_get_type (item) != ITEM_NODE) {
 2265: 		axl_error_new (-1, "Expected to find a node but it wasn't found", NULL, error);
 2266: 		return axl_false;
 2267: 	}
 2268: 
 2269: 	/* get the node */
 2270: 	node = axl_item_get_data (item);
 2271: 
 2272: 	/* check document content */
 2273: 	if (! NODE_CMP_NAME (node, "strong")) {
 2274: 		axl_error_new (-1, "Expected to find root node=<strong> but it wasn't found", NULL, error);
 2275: 		return axl_false;
 2276: 	}
 2277: 
 2278: 	/* get the first child of <strong> */
 2279: 	item = axl_item_get_first_child (node);
 2280: 
 2281: 	if (axl_item_get_type (item) != ITEM_CONTENT) {
 2282: 		axl_error_new (-1, "Expected to find content inside strong but it wasn't found", NULL, error);
 2283: 		return axl_false;
 2284: 	}	
 2285: 
 2286: 	/* get the content */
 2287: 	content = axl_item_get_content (item, &content_size);
 2288: 	if (! axl_cmp (content, "this content goes\n  bold")) {
 2289: 		axl_error_new (-1, "Expected to find content but it wasn't found", NULL, error);
 2290: 		return axl_false;
 2291: 	}
 2292: 
 2293: 	/* now get the next item following the <strong> node */
 2294: 	item = axl_item_node_next (node);
 2295: 
 2296: 	if (item == NULL) {
 2297: 		axl_error_new (-1, "Expected to find content following <strong> but a null item reference was found", NULL, error);
 2298: 		return axl_false;
 2299: 	}
 2300: 
 2301: 	/* check to be it a content */
 2302: 	if (axl_item_get_type (item) != ITEM_CONTENT) {
 2303: 		axl_error_new (-1, "Expected to find content following <strong> node but it wasn't found", NULL, error);
 2304: 		return axl_false;
 2305: 	}	
 2306: 
 2307: 	/* get the content */
 2308: 	content = axl_item_get_content (item, &content_size);
 2309: 	if (! axl_cmp (content, " more data stored directly inside the document node.\n\n ")) {
 2310: 		axl_error_new (-1, "Expected to find content but it wasn't found", NULL, error);
 2311: 		return axl_false;
 2312: 	}
 2313: 
 2314: 	/* get the next item */
 2315: 	item = axl_item_get_next (item);
 2316: 	if (axl_item_get_type (item) != ITEM_NODE) {
 2317: 		axl_error_new (-1, "Expected to find a node but it wasn't found", NULL, error);
 2318: 		return axl_false;
 2319: 	}
 2320: 
 2321: 	/* get the node */
 2322: 	node = axl_item_get_data (item);
 2323: 
 2324: 	/* check document content */
 2325: 	if (! NODE_CMP_NAME (node, "childs")) {
 2326: 		axl_error_new (-1, "Expected to find root node=<strong> but it wasn't found", NULL, error);
 2327: 		return axl_false;
 2328: 	}
 2329: 
 2330: 	/* get the first item */
 2331: 	item = axl_item_get_first_child (node);
 2332: 	if (axl_item_get_type (item) != ITEM_COMMENT) {
 2333: 		axl_error_new (-1, "Expected to find content inside strong but it wasn't found", NULL, error);
 2334: 		return axl_false;
 2335: 	}	
 2336: 
 2337: 	/* get the content */
 2338: 	content = axl_item_get_content (item, &content_size);
 2339: 	if (! axl_cmp (content, " here goes a comment before text block ")) {
 2340: 		axl_error_new (-1, "Expected to find a comment, child of <childs>, but it wasn't found", NULL, error);
 2341: 		return axl_false;
 2342: 	}	
 2343: 
 2344: 	/* get next item */
 2345: 	item = axl_item_get_next (item);
 2346: 
 2347: 	/* check to be it a content */
 2348: 	if (axl_item_get_type (item) != ITEM_CONTENT) {
 2349: 		axl_error_new (-1, "Expected to find content following <childs> node comment but it wasn't found", NULL, error);
 2350: 		return axl_false;
 2351: 	}	
 2352: 
 2353: 	/* get the content */
 2354: 	content = axl_item_get_content (item, &content_size);
 2355: 	if (! axl_cmp (content, "More text after child declaration.\n   ")) {
 2356: 		axl_error_new (-1, "Expected to find a content inside <childs> node, but it wasn't found", NULL, error);
 2357: 		return axl_false;
 2358: 	}	
 2359: 
 2360: 	/* get next item */
 2361: 	item = axl_item_get_next (item);
 2362: 
 2363: 	/* get the node */
 2364: 	node = axl_item_get_data (item);
 2365: 
 2366: 	/* check document content */
 2367: 	if (! NODE_CMP_NAME (node, "child1")) {
 2368: 		axl_error_new (-1, "Expected to find root node=<strong> but it wasn't found", NULL, error);
 2369: 		return axl_false;
 2370: 	}
 2371: 
 2372: 
 2373: 	/* free axl document */
 2374: 	axl_doc_free (doc);
 2375: 
 2376: 	return axl_true;
 2377: }
 2378: 
 2379: /** 
 2380:  * @brief Test entity support (basic entity support).
 2381:  * 
 2382:  * @param error The optional axlError to be used to report errors.
 2383:  * 
 2384:  * @return axl_true if the validity test is passed, axl_false if not.
 2385:  */
 2386: axl_bool test_20b (axlError ** error)
 2387: {
 2388: 	axlNode * node;
 2389: 
 2390: 	axlNode * aux;
 2391: 	axlNode * aux2;
 2392: 
 2393: 	axlNode * child1;
 2394: 	axlNode * root;
 2395: 
 2396: 	axlDoc  * doc;
 2397: 	axlDoc  * doc2;
 2398: 	axlDoc  * doc3;
 2399: 
 2400: 
 2401: 	int       iterator = 0;
 2402: 	int       sum = 0;
 2403: 
 2404: 	/* load the document */
 2405: 	doc = axl_doc_parse_from_file ("test_20.xml", error);
 2406: 	if (doc == NULL)
 2407: 		return axl_false;
 2408: 
 2409: 	/* load reference */
 2410: 	doc2 = axl_doc_parse_from_file ("test_20a.xml", error);
 2411: 	if (doc2 == NULL)
 2412: 		return axl_false;
 2413: 
 2414: 	while (iterator < 10) {
 2415: 
 2416: 		/* get document root */
 2417: 		root = axl_doc_get_root (doc);
 2418: 	
 2419: 		/* copy and release */
 2420: 		node = axl_node_copy (root, axl_true, axl_true);
 2421: 
 2422: 		/* get the child1 reference */
 2423: 		child1 = axl_node_get_first_child (node);
 2424: 		
 2425: 		/* get child2 refrence */
 2426: 		aux    = axl_node_get_first_child (child1);
 2427: 		while (aux != NULL) {
 2428: 			
 2429: 			sum = axl_node_get_child_num (child1);
 2430: 			
 2431: 			/* get the next child before deattaching the
 2432: 			 * node */
 2433: 			aux2 = axl_node_get_next (aux);
 2434: 
 2435: 			/* dettach the node from the <child1> parent
 2436: 			 * and attach it to the document */
 2437: 			axl_node_deattach (aux);
 2438: 
 2439: 			if ((sum - 1) != (axl_node_get_child_num (child1))) {
 2440: 				/* after doing the deattach process,
 2441: 				 * the copy node doesn't have the
 2442: 				 * expected child number */
 2443: 				axl_error_new (-1, "After doing the deattach process, the copy node doesn't have the expected child number", NULL, error);
 2444: 				return axl_false;
 2445: 			}
 2446: 
 2447: 			/* set the node to the document root */
 2448: 			axl_node_set_child (node, aux);
 2449: 
 2450: 			if (! NODE_CMP_NAME (axl_node_get_parent (aux), "document")) {
 2451: 				
 2452: 				axl_error_new (-1, "Expected to find a parent not found", NULL, error);
 2453: 				return axl_false;
 2454: 			}
 2455: 
 2456: 			/* get the next child */
 2457: 			aux = aux2;
 2458: 			
 2459: 		} /* end while */
 2460: 
 2461: 		/* remove the child1 node */
 2462: 		aux = axl_node_get_first_child (node);
 2463: 		axl_node_remove (aux, axl_true);
 2464: 
 2465: 		/* create the document holding the result */
 2466: 		doc3 = axl_doc_create (NULL, NULL, axl_false);
 2467: 		axl_doc_set_root (doc3, node);
 2468: 
 2469: 		/* compare the document */
 2470: 		if (!axl_doc_are_equal (doc2, doc3)) {
 2471: 			axl_error_new (-1, "Expected to find equal documents but (modified doc2 != doc3), they wasn't found", NULL, error);
 2472: 			return axl_false;
 2473: 		}
 2474: 
 2475: 		/* free the document */
 2476: 		axl_doc_free (doc3);
 2477: 
 2478: 		/* update iterator */
 2479: 		iterator++;
 2480: 
 2481: 	} /* end while */
 2482: 
 2483: 	/* free the document 2 */
 2484: 	axl_doc_free (doc2);
 2485: 
 2486: 	/* free the document */
 2487: 	axl_doc_free (doc);
 2488: 
 2489: 	return axl_true;
 2490: 
 2491: }
 2492: 
 2493: 
 2494: /** 
 2495:  * @brief Test entity support (basic entity support).
 2496:  * 
 2497:  * @param error The optional axlError to be used to report errors.
 2498:  * 
 2499:  * @return axl_true if the validity test is passed, axl_false if not.
 2500:  */
 2501: axl_bool test_20 (axlError ** error)
 2502: {
 2503: 	axlNode * node;
 2504: 	axlNode * root;
 2505: 	axlDoc  * doc;
 2506: 	axlDoc  * doc2;
 2507: 	char    * data;
 2508: 	
 2509: 
 2510: 	/* load the document */
 2511: 	doc = axl_doc_parse_from_file ("test_20.xml", error);
 2512: 	if (doc == NULL)
 2513: 		return axl_false;
 2514: 
 2515: 	/* get document root */
 2516: 	root = axl_doc_get_root (doc);
 2517: 	node = axl_node_copy (root, axl_true, axl_true);
 2518: 
 2519: 	/* check if both nodes are equal */
 2520: 	if (! axl_node_are_equal (root, node)) {
 2521: 		axl_error_new (-1, "Expected to find equal nodes but they weren't", NULL, error);
 2522: 		return axl_false;
 2523: 	}
 2524: 	
 2525: 	/* create a new document */
 2526: 	doc2 = axl_doc_create (NULL, NULL, axl_false);
 2527: 	axl_doc_set_root (doc2, node);
 2528: 
 2529: 	if (! axl_doc_are_equal (doc, doc2)) {
 2530: 		axl_error_new (-1, "Expected to find equal documents but they weren't", NULL, error);
 2531: 		return axl_false;
 2532: 	}
 2533: 
 2534: 	/* free document */
 2535: 	axl_doc_free (doc2);
 2536: 
 2537: 	/* configure some anotation data */
 2538: 	axl_node_annotate_data (root, "key", "value");
 2539: 	
 2540: 	/* get child1 */
 2541: 	node = axl_node_get_first_child (root);
 2542: 
 2543: 	/* get child2 */
 2544: 	node = axl_node_get_first_child (node);
 2545: 
 2546: 	/* anotate data */
 2547: 	axl_node_annotate_data (node, "key1", "value1");
 2548: 
 2549: 	/* perform searches */
 2550: 	data = axl_node_annotate_get (node, "key", axl_false);
 2551: 	if (data != NULL) {
 2552: 		axl_error_new (-1, "Expected to find nothing while looking for 'key'(1)", NULL, error);
 2553: 		return axl_false;
 2554: 	}
 2555: 
 2556: 	data = axl_node_annotate_get (node, "key", axl_true);
 2557: 	if (data == NULL || !axl_cmp (data, "value")) {
 2558: 		axl_error_new (-1, "Expected to find data while looking for 'key' at parents (2)", NULL, error);
 2559: 		return axl_false;
 2560: 	}
 2561: 
 2562: 	/* perform searches inside the node */
 2563: 	data = axl_node_annotate_get (node, "key1", axl_false);
 2564: 	if (data == NULL || !axl_cmp (data, "value1")) {
 2565: 		axl_error_new (-1, "Expected to find nothing while looking for 'key1'(3)", NULL, error);
 2566: 		return axl_false;
 2567: 	}
 2568: 
 2569: 	/* perform more anotation but with native data */
 2570: 	axl_node_annotate_int (root, "int-value", 14);
 2571: 	
 2572: 	if (axl_node_annotate_get_int (root, "int-value", axl_false) != 14) {
 2573: 		axl_error_new (-1, "Expected to find an integer value (14), but it wasn't found", NULL, error);
 2574: 		return axl_false;
 2575: 	}
 2576: 
 2577: 	axl_node_annotate_double (root, "double-value", 58.20);
 2578: 
 2579: 	if (axl_node_annotate_get_double (root, "double-value", axl_false) != 58.20) {
 2580: 		axl_error_new (-1, "Expected to find an double value (58.20), but it wasn't found", NULL, error);
 2581: 		return axl_false;
 2582: 	}
 2583: 
 2584: 	axl_node_annotate_string (root, "string-value", "this is a test string");
 2585: 
 2586: 	if (! axl_cmp (axl_node_annotate_get_string (root, "string-value", axl_false), "this is a test string")) {
 2587: 		axl_error_new (-1, "Expected to find a string value (\"this is a test string\"), but it wasn't found", NULL, error);
 2588: 		return axl_false;
 2589: 	}
 2590: 
 2591: 	if (axl_node_annotate_get_string (root, "string-not-found", axl_false) != NULL) {
 2592: 		axl_error_new (-1, "Expected to find empty value for an anotated element which isn't installed", NULL, error);
 2593: 		return axl_false;
 2594: 	}
 2595: 
 2596: 	/* free document created */
 2597: 	axl_doc_free (doc);
 2598: 
 2599: 	return axl_true;
 2600: 
 2601: }
 2602: 
 2603: /** 
 2604:  * @brief Test entity support (basic entity support).
 2605:  * 
 2606:  * @param error The optional axlError to be used to report errors.
 2607:  * 
 2608:  * @return axl_true if the validity test is passed, axl_false if not.
 2609:  */
 2610: axl_bool test_19 (axlError ** error)
 2611: {
 2612: 	axlDoc  * doc;
 2613: 	axlDoc  * reference;
 2614: 	axlNode * node;
 2615: 	axlNode * replace;
 2616: 
 2617: 	/* create replace node */
 2618: 	replace = axl_node_create ("replace");
 2619: 	axl_node_set_content (replace, "test", -1);
 2620: 
 2621: 	doc = axl_doc_parse_from_file ("test_19.xml", error);
 2622: 	if (doc == NULL)
 2623: 		return axl_false;
 2624: 	
 2625: 	/* document */
 2626: 	node = axl_doc_get_root (doc);
 2627: 
 2628: 	/* child1 */
 2629: 	node = axl_node_get_first_child (node);
 2630: 
 2631: 	/* child2 */
 2632: 	node = axl_node_get_first_child (node);
 2633: 
 2634: 	/* replace */
 2635: 	axl_node_replace (node, replace, axl_false);
 2636: 
 2637: 	reference = axl_doc_parse_from_file ("test_19a.xml", error);
 2638: 	if (reference == NULL)
 2639: 		return axl_false;
 2640: 
 2641: 	/* check both documents to be equal */
 2642: 	if (! axl_doc_are_equal (doc, reference)) {
 2643: 		axl_error_new (-1, "Expected to find equal documents, but not found on first child replace", NULL, error);
 2644: 		return axl_false;
 2645: 	}
 2646: 
 2647: 	/* free reference */
 2648: 	axl_doc_free (reference);
 2649: 
 2650: 	/* restore */
 2651: 	axl_node_replace (replace, node, axl_false);
 2652: 
 2653: 	/* get child2 */
 2654: 	node = axl_node_get_next (node);
 2655: 	
 2656: 	/* replace */
 2657: 	axl_node_replace (node, replace, axl_false);
 2658: 
 2659: 
 2660: 	reference = axl_doc_parse_from_file ("test_19b.xml", error);
 2661: 	if (reference == NULL)
 2662: 		return axl_false;
 2663: 
 2664: 	/* check both documents to be equal */
 2665: 	if (! axl_doc_are_equal (doc, reference)) {
 2666: 		axl_error_new (-1, "Expected to find equal documents, but not found on first child replace", NULL, error);
 2667: 		return axl_false;
 2668: 	}
 2669: 
 2670: 	/* free reference */
 2671: 	axl_doc_free (reference);	
 2672: 
 2673: 	/* restore */
 2674: 	axl_node_replace (replace, node, axl_false);
 2675: 
 2676: 	/* get child2 */
 2677: 	node = axl_node_get_next (node);
 2678: 	/* get child2 */
 2679: 	node = axl_node_get_next (node);
 2680: 	
 2681: 	/* replace */
 2682: 	axl_node_replace (node, replace, axl_true);
 2683: 
 2684: 	reference = axl_doc_parse_from_file ("test_19c.xml", error);
 2685: 	if (reference == NULL)
 2686: 		return axl_false;
 2687: 
 2688: 	/* check both documents to be equal */
 2689: 	if (! axl_doc_are_equal (doc, reference)) {
 2690: 		axl_error_new (-1, "Expected to find equal documents, but not found on first child replace", NULL, error);
 2691: 		return axl_false;
 2692: 	}
 2693: 
 2694: 	/* free reference */
 2695: 	axl_doc_free (reference);	
 2696: 
 2697: 	node = axl_node_create ("child5");
 2698: 	axl_node_set_content (node, "test", -1);
 2699: 
 2700: 	/* replace */
 2701: 	axl_node_replace (replace, node, axl_true);
 2702: 
 2703: 	/* document */
 2704: 	node = axl_doc_get_root (doc);
 2705: 	/* child1 */
 2706: 	node = axl_node_get_first_child (node);
 2707: 	/* child2 */
 2708: 	node = axl_node_get_first_child (node);	
 2709: 
 2710: 	/* remove child2 */
 2711: 	axl_node_remove (node, axl_true);
 2712: 
 2713: 	reference = axl_doc_parse_from_file ("test_19d.xml", error);
 2714: 	if (reference == NULL)
 2715: 		return axl_false;
 2716: 
 2717: 	/* check both documents to be equal */
 2718: 	if (! axl_doc_are_equal (doc, reference)) {
 2719: 		axl_error_new (-1, "Expected to find equal documents, but not found on first child remove", NULL, error);
 2720: 		return axl_false;
 2721: 	}
 2722: 
 2723: 	/* free reference */
 2724: 	axl_doc_free (reference);	
 2725: 
 2726: 	/* document */
 2727: 	node = axl_doc_get_root (doc);
 2728: 	/* child1 */
 2729: 	node = axl_node_get_first_child (node);
 2730: 	/* child3 */
 2731: 	node = axl_node_get_first_child (node);	
 2732: 
 2733: 	/* remove child3 */
 2734: 	axl_node_remove (node, axl_true);
 2735: 
 2736: 	reference = axl_doc_parse_from_file ("test_19e.xml", error);
 2737: 	if (reference == NULL)
 2738: 		return axl_false;
 2739: 
 2740: 	/* check both documents to be equal */
 2741: 	if (! axl_doc_are_equal (doc, reference)) {
 2742: 		axl_error_new (-1, "Expected to find equal documents, but not found on first child remove", NULL, error);
 2743: 		return axl_false;
 2744: 	}
 2745: 
 2746: 	/* free reference */
 2747: 	axl_doc_free (reference);	
 2748: 
 2749: 	/* document */
 2750: 	node = axl_doc_get_root (doc);
 2751: 	/* child1 */
 2752: 	node = axl_node_get_first_child (node);
 2753: 	/* child4 */
 2754: 	node = axl_node_get_first_child (node);	
 2755: 
 2756: 	/* remove child4 */
 2757: 	axl_node_remove (node, axl_true);
 2758: 
 2759: 	reference = axl_doc_parse_from_file ("test_19f.xml", error);
 2760: 	if (reference == NULL)
 2761: 		return axl_false;
 2762: 
 2763: 	/* check both documents to be equal */
 2764: 	if (! axl_doc_are_equal (doc, reference)) {
 2765: 		axl_error_new (-1, "Expected to find equal documents, but not found on first child remove", NULL, error);
 2766: 		return axl_false;
 2767: 	}
 2768: 
 2769: 	/* free reference */
 2770: 	axl_doc_free (reference);	
 2771: 
 2772: 	/* document */
 2773: 	node = axl_doc_get_root (doc);
 2774: 	/* child1 */
 2775: 	node = axl_node_get_first_child (node);
 2776: 	/* child5 */
 2777: 	node = axl_node_get_first_child (node);	
 2778: 
 2779: 	/* remove child5 */
 2780: 	axl_node_remove (node, axl_true);
 2781: 
 2782: 	reference = axl_doc_parse_from_file ("test_19g.xml", error);
 2783: 	if (reference == NULL)
 2784: 		return axl_false;
 2785: 
 2786: 	/* check both documents to be equal */
 2787: 	if (! axl_doc_are_equal (doc, reference)) {
 2788: 		axl_error_new (-1, "Expected to find equal documents, but not found on first child remove", NULL, error);
 2789: 		return axl_false;
 2790: 	}
 2791: 
 2792: 	/* free reference */
 2793: 	axl_doc_free (reference);	
 2794: 	
 2795: 	/* free document */
 2796: 	axl_doc_free (doc);
 2797: 
 2798: 	/* free reference */
 2799: 	return axl_true;
 2800: }
 2801: 
 2802: /** 
 2803:  * @brief Test entity support (basic entity support).
 2804:  * 
 2805:  * @param error The optional axlError to be used to report errors.
 2806:  * 
 2807:  * @return axl_true if the validity test is passed, axl_false if not.
 2808:  */
 2809: axl_bool test_18 (axlError ** error)
 2810: {
 2811: 	axlDtd * dtd = NULL;
 2812: 	char   * content;
 2813: 
 2814: 	/* parse af-arch DTD */
 2815: 	dtd = axl_dtd_parse_from_file ("channel.dtd", error);
 2816: 	if (dtd == NULL)
 2817: 		return axl_false;
 2818: 
 2819: 	/* lookup for entity definitions */
 2820: 	if (axl_dtd_entity_exists (dtd, "TEST", GENERAL_ENTITY)) {
 2821: 		axl_error_new (-1, "Expected to not find an entity value which was found (TEST)..", NULL, error);
 2822: 		return axl_false;
 2823: 	}
 2824: 	
 2825: 	if (axl_dtd_entity_exists (dtd, "URI", GENERAL_ENTITY)) {
 2826: 		axl_error_new (-1, "Expected to not find an entity value which was found (URI)..", NULL, error);
 2827: 		return axl_false;
 2828: 	}
 2829: 	
 2830: 	/* lookup for entity definitions that are expected to be found */
 2831: 	if (! axl_dtd_entity_exists (dtd, "URI", PARAMETER_ENTITY)) {
 2832: 		axl_error_new (-1, "Expected to find an entity value which wasn't found (% URI)..", NULL, error);
 2833: 		return axl_false;
 2834: 	}
 2835: 
 2836: 	if (! axl_dtd_entity_exists (dtd, "LOCS", PARAMETER_ENTITY)) {
 2837: 		axl_error_new (-1, "Expected to find an entity value which wasn' found (% LOCS)..", NULL, error);
 2838: 		return axl_false;
 2839: 	}
 2840: 
 2841: 	/* now get the content inside */
 2842: 	content = axl_dtd_entity_value (dtd, "CHAN", PARAMETER_ENTITY);
 2843: 	if (content == NULL) {
 2844: 		axl_error_new (-1, "Expected to find parameter entity content for (% CHAN) but it wasn't found", NULL, error);
 2845: 		return axl_false;
 2846: 	}
 2847: 	
 2848: 	if (! axl_cmp (content, "CDATA")) {
 2849: 		axl_error_new (-1, "Expected to find parameter entity content for (% CHAN) it doesn't match", NULL, error);
 2850: 		return axl_false;	
 2851: 	}
 2852: 
 2853: 	/* free the dtd */
 2854: 	axl_dtd_free (dtd);
 2855: 
 2856: 	return axl_true;
 2857: }
 2858: 
 2859: /** 
 2860:  * @brief A more complex DTD parsing example
 2861:  * 
 2862:  * @param error The optional axlError to be used to report errors.
 2863:  * 
 2864:  * @return axl_true if the validity test is passed, axl_false if not.
 2865:  */
 2866: axl_bool test_17 (axlError ** error) 
 2867: {
 2868: 	axlDoc  * doc  = NULL;
 2869: 	axlDtd  * dtd  = NULL;
 2870: 
 2871: 	/* parse common DTD file */
 2872: 	dtd = axl_dtd_parse_from_file ("xml-rpc.dtd", error);
 2873: 	if (dtd == NULL)
 2874: 		return axl_false;
 2875: 
 2876: 	/* parse a file that must not be valid */
 2877: 	doc = axl_doc_parse_from_file ("test17.xdl", error);
 2878: 	if (doc == NULL)
 2879: 		return axl_false;
 2880: 
 2881: 	/* the following validation must fail */
 2882: 	if (axl_dtd_validate (doc, dtd, error)) {
 2883: 		axl_error_new (-1, "A validation was produced when expected a failure", NULL, error);
 2884: 		return axl_false;
 2885: 	}
 2886: 
 2887: 	/* because a failure was expected, release memory allocated by
 2888: 	 * axl_error_new */
 2889: 	axl_error_free (*error);
 2890: 
 2891: 	/* free the document */
 2892: 	axl_doc_free (doc);
 2893: 
 2894: 	/* release DTD reference */
 2895: 	axl_dtd_free (dtd);
 2896: 
 2897: 	return axl_true;
 2898: }
 2899: 
 2900: /** 
 2901:  * @brief A more complex DTD parsing example
 2902:  * 
 2903:  * @param error The optional axlError to be used to report errors.
 2904:  * 
 2905:  * @return axl_true if the validity test is passed, axl_false if not.
 2906:  */
 2907: axl_bool test_16 (axlError ** error) 
 2908: {
 2909: 	axlDoc  * doc  = NULL;
 2910: 	axlDtd  * dtd  = NULL;
 2911: 
 2912: 	/* parse common DTD file */
 2913: 	dtd = axl_dtd_parse_from_file ("xml-rpc.dtd", error);
 2914: 	if (dtd == NULL)
 2915: 		return axl_false;
 2916: 
 2917: 	/* parse a file that must not be valid */
 2918: 	doc = axl_doc_parse_from_file ("test03.xdl", error);
 2919: 	if (doc == NULL)
 2920: 		return axl_false;
 2921: 
 2922: 	/* the following validation must fail */
 2923: 	if (axl_dtd_validate (doc, dtd, error)) {
 2924: 		axl_error_new (-1, "A validation was produced when expected a failure", NULL, error);
 2925: 		return axl_false;
 2926: 	}
 2927: 
 2928: 	/* because a failure was expected, release memory allocated by
 2929: 	 * axl_error_new */
 2930: 	axl_error_free (*error);
 2931: 
 2932: 	/* free the document */
 2933: 	axl_doc_free (doc);
 2934: 
 2935: 	/* parse the next file that must be valid */
 2936: 	doc = axl_doc_parse_from_file ("test04.xdl", error);
 2937: 	if (doc == NULL)
 2938: 		return axl_false;
 2939: 
 2940: 	/* the following validation should successed */
 2941: 	if (! axl_dtd_validate (doc, dtd, error))
 2942: 		return axl_false;
 2943: 
 2944: 	/* release the document */
 2945: 	axl_doc_free (doc);
 2946: 	
 2947: 	/* release DTD reference */
 2948: 	axl_dtd_free (dtd);
 2949: 
 2950: 	return axl_true;
 2951: }
 2952: 
 2953: /** 
 2954:  * @brief A more complex DTD parsing example
 2955:  * 
 2956:  * @param error The optional axlError to be used to report errors.
 2957:  * 
 2958:  * @return axl_true if the validity test is passed, axl_false if not.
 2959:  */
 2960: axl_bool test_15 (axlError ** error) 
 2961: {
 2962: 	axlDoc  * doc  = NULL;
 2963: 	axlDtd  * dtd  = NULL;
 2964: 
 2965: 	/* parse common DTD file */
 2966: 	dtd = axl_dtd_parse_from_file ("xml-rpc.dtd", error);
 2967: 	if (dtd == NULL)
 2968: 		return axl_false;
 2969: 
 2970: 	/* parse a file that must not be valid */
 2971: 	doc = axl_doc_parse_from_file ("test01.xdl", error);
 2972: 	if (doc == NULL)
 2973: 		return axl_false;
 2974: 
 2975: 	/* the following validation must fail */
 2976: 	if (axl_dtd_validate (doc, dtd, error)) {
 2977: 		axl_error_new (-1, "A validation was produced when expected a failure", NULL, error);
 2978: 		return axl_false;
 2979: 	}
 2980: 
 2981: 	/* because a failure was expected, release memory allocated by
 2982: 	 * axl_error_new */
 2983: 	axl_error_free (*error);
 2984: 
 2985: 	/* free the document */
 2986: 	axl_doc_free (doc);
 2987: 
 2988: 	/* parse the next file that must be valid */
 2989: 	doc = axl_doc_parse_from_file ("test02.xdl", error);
 2990: 	if (doc == NULL)
 2991: 		return axl_false;
 2992: 
 2993: 	/* the following validation should successed */
 2994: 	if (! axl_dtd_validate (doc, dtd, error))
 2995: 		return axl_false;
 2996: 
 2997: 	/* release the document */
 2998: 	axl_doc_free (doc);
 2999: 	
 3000: 	/* release DTD reference */
 3001: 	axl_dtd_free (dtd);
 3002: 
 3003: 	return axl_true;
 3004: }
 3005: 
 3006: /** 
 3007:  * @brief A more complex DTD parsing example
 3008:  * 
 3009:  * @param error The optional axlError to be used to report errors.
 3010:  * 
 3011:  * @return axl_true if the validity test is passed, axl_false if not.
 3012:  */
 3013: axl_bool test_14 (axlError ** error) 
 3014: {
 3015: 	axlDoc  * doc  = NULL;
 3016: 	axlNode * node = NULL;
 3017: 	
 3018: 	char    * xml_document;
 3019: 	char    * value;
 3020: 	int       size = 0;
 3021: 	int       document_size;
 3022: 	
 3023: 
 3024: 	/* create an emtpy document */
 3025: 	doc = axl_doc_create ("1.0", NULL, axl_false);
 3026: 
 3027: 	/* create the root node */
 3028: 	node = axl_node_create ("test");
 3029: 	axl_node_set_content (node, "This is a test (') (\") (>) (<) (&), more data###", -1);
 3030: 	
 3031: 	axl_doc_set_root (doc, node);
 3032: 
 3033: 	/* dump the document */
 3034: 	axl_doc_dump (doc, &xml_document, &document_size);
 3035: 	
 3036: 	if (!axl_cmp ("<?xml version='1.0' ?><test>This is a test (&apos;) (&quot;) (&gt;) (&lt;) (&amp;), more data###</test>",
 3037: 		      xml_document)) {
 3038: 		axl_error_new (-1, "Found dump mismatch that shows entities are not handled properly", NULL, error);
 3039: 		return axl_false;
 3040: 	}
 3041: 
 3042: 	/* free memory dump */
 3043: 	axl_free (xml_document);
 3044: 
 3045: 	/* get the content translated */
 3046: 	value = axl_node_get_content_copy (node, &size);
 3047: 
 3048: 	if (size != 68) {
 3049: 		axl_error_new (-1, "Found a document size mismatch while dumping entity content", NULL, error);
 3050: 		return axl_false;
 3051: 	}
 3052: 	
 3053: 	/* free the content received */
 3054: 	axl_free (value);
 3055: 
 3056: 	/* get the content translated */
 3057: 	value = axl_node_get_content_trans (node, &size);
 3058: 
 3059: 	if (size != 48) {
 3060: 		axl_error_new (-1, "Found a document size mismatch while dumping entity content (already translated)", NULL, error);
 3061: 		return axl_false;
 3062: 	}
 3063: 
 3064: 	/* check node content returned */
 3065: 	if (!axl_cmp (value, "This is a test (\') (\") (>) (<) (&), more data###")) {
 3066: 		axl_error_new (-1, "Found an string mismatch while checking a node content which was translated", NULL, error);
 3067: 		return axl_false;
 3068: 	}
 3069: 
 3070: 	/* free the content translated */
 3071: 	axl_free (value);
 3072: 
 3073: 	/* free document */
 3074: 	axl_doc_free (doc);
 3075: 
 3076: 	doc = axl_doc_parse ("<?xml version='1.0' ?><test></test>", 37, error);
 3077: 	if (doc == NULL) {
 3078: 		printf ("Expected to parse a document but it fails, error was: %s\n", axl_error_get (*error));
 3079: 		return axl_false;
 3080: 	}
 3081: 
 3082: 	/* get the content */
 3083: 	node = axl_doc_get (doc, "/test");
 3084: 	if (node == NULL) {
 3085: 		axl_error_new (-1, "Expected to find a node reference not found (/test)\n", NULL, error);
 3086: 		return axl_false;		
 3087: 	}
 3088: 
 3089: 	/* get the content */
 3090: 	size  = 11;
 3091: 	value = (char*) axl_node_get_content (node, &size);
 3092: 	if (size != 0) {
 3093: 		axl_error_new (-1, "Expected to find a node content with 0 bytes but it 11 (/test)\n", NULL, error);
 3094: 		return axl_false;
 3095: 	}
 3096: 
 3097: 	/* get the content copy */
 3098: 	size  = 13;
 3099: 	value = axl_node_get_content_copy (node, &size);
 3100: 	if (size != 0) {
 3101: 		axl_error_new (-1, "Expected to find a node content with 0 bytes but it 13 (/test)\n", NULL, error);
 3102: 		return axl_false;
 3103: 	}
 3104: 	axl_free (value);
 3105: 
 3106: 	/* get content copy trans */
 3107: 	size  = 14;
 3108: 	value = axl_node_get_content_trans (node, &size);
 3109: 	if (size != 0) {
 3110: 		axl_error_new (-1, "Expected to find a node content with 0 bytes but it 14 (/test)\n", NULL, error);
 3111: 		return axl_false;
 3112: 	}
 3113: 	axl_free (value);
 3114: 
 3115: 	/* get content trimmed */
 3116: 	size  = 15;
 3117: 	value = axl_node_get_content_trim (node, &size);
 3118: 	if (size != 0) {
 3119: 		axl_error_new (-1, "Expected to find a node content with 0 bytes but it 15 (/test)\n", NULL, error);
 3120: 		return axl_false;
 3121: 	}
 3122: 
 3123: 	/* free the document */
 3124: 	axl_doc_free (doc);
 3125: 
 3126: 	return axl_true;
 3127: }
 3128: 
 3129: /** 
 3130:  * @brief Memory dump operation checks.
 3131:  * 
 3132:  * @param error The optional axlError to be used to report errors.
 3133:  * 
 3134:  * @return axl_true if the validity test is passed, axl_false if not.
 3135:  */
 3136: axl_bool test_13 (axlError ** error) 
 3137: {
 3138: 	axlDoc  * doc  = NULL;
 3139: 	axlDoc  * doc2 = NULL;
 3140: 	axlDoc  * doc3 = NULL;
 3141: 	
 3142: 	axlNode * node = NULL;
 3143: 	char    * content;
 3144: 	int       size;
 3145: 	
 3146: 	doc = axl_doc_parse_from_file ("test13.xml", error);
 3147: 	if (doc == NULL)
 3148: 		return axl_false;
 3149: 
 3150: 	/* dump xml document */
 3151: 	axl_doc_dump (doc, &content, &size);
 3152: 
 3153: 	doc2 = axl_doc_parse (content, size, error);
 3154: 	if (doc2 == NULL)
 3155: 		return axl_false;
 3156: 
 3157: 	/* check if both documents are equals */
 3158: 	if (! axl_doc_are_equal (doc, doc2)) {
 3159: 		axl_error_new (-1, "Expected to dump an equivalent xml document, but found an error", NULL, error);
 3160: 		return axl_false;
 3161: 	}
 3162: 
 3163: 	/* free dump */
 3164: 	axl_free (content);
 3165: 	   
 3166: 	/* free axl document */
 3167: 	axl_doc_free (doc);
 3168: 
 3169: 	/* free axl document */
 3170: 	axl_doc_free (doc2);
 3171: 
 3172: 	doc = axl_doc_parse_from_file ("test_13c.xml", error);
 3173: 	if (doc == NULL)
 3174: 		return axl_false;
 3175: 
 3176: 	if (! axl_doc_dump_pretty (doc, &content, &size, 4)) {
 3177: 		axl_error_new (-1, "Failed to dump pretty print, while expected a proper execution", NULL, error);
 3178: 		return axl_false;
 3179: 	}
 3180: 
 3181: 	doc2 = axl_doc_parse (content, size, error);
 3182: 	if (doc2 == NULL)
 3183: 		return axl_false;
 3184: 
 3185: 	/* free content */
 3186: 	axl_free (content);
 3187: 
 3188: 	if (! axl_doc_are_equal (doc, doc2)) {
 3189: 		axl_error_new (-1, "Expected to find documents to be equal.", NULL, error);
 3190: 		return axl_false;
 3191: 	}
 3192: 
 3193: 	/* free both document references */
 3194: 	axl_doc_free (doc);
 3195: 	axl_doc_free (doc2);
 3196: 
 3197: 	/* check pretty printing function */
 3198: 	doc = axl_doc_parse_from_file ("test_13b.xml", error);
 3199: 	if (doc == NULL) 
 3200: 		return axl_false;
 3201: 
 3202: 	if (! axl_doc_dump_pretty (doc, &content, &size, 4)) {
 3203: 		axl_error_new (-1, "Failed to dump pretty print, while expected a proper execution", NULL, error);
 3204: 		return axl_false;
 3205: 	}
 3206: 
 3207: 	doc2 = axl_doc_parse (content, size, error);
 3208: 	if (doc2 == NULL)
 3209: 		return axl_false;
 3210: 
 3211: 	if (! axl_doc_are_equal (doc, doc2)) {
 3212: 		axl_error_new (-1, "Expected to find documents to be equal.", NULL, error);
 3213: 		return axl_false;
 3214: 	}
 3215: 
 3216: 	/* free content */
 3217: 	axl_free (content);
 3218: 
 3219: 	/* free both document references */
 3220: 	axl_doc_free (doc);
 3221: 	axl_doc_free (doc2);
 3222: 
 3223: 	/* reopen document to dump nodes */
 3224: 	doc = axl_doc_parse_from_file ("test_13c.xml", error);
 3225: 	if (doc == NULL)
 3226: 		return axl_false;
 3227: 
 3228: 	/* get a reference to the first root child node: <test> */
 3229: 	node = axl_doc_get_root (doc);
 3230: 	node = axl_node_get_first_child (node);
 3231: 	if (! NODE_CMP_NAME (node, "test")) {
 3232: 		axl_error_new (-1, "Expected to find a child node called: <test>", NULL, error);
 3233: 		return axl_false;
 3234: 	} /* end if */
 3235: 
 3236: 	/* dump the content */
 3237: 	if (! axl_node_dump (node, &content, &size)) {
 3238: 		axl_error_new (-1, "Expected to find a proper dump operation", NULL, error);
 3239: 		return axl_false;
 3240: 	} /* end if */
 3241: 
 3242: 	/* parse the content dumped, to check it is really the result
 3243: 	 * expected */
 3244: 	doc2 = axl_doc_parse (content, size, NULL);
 3245: 	if (doc2 == NULL) {
 3246: 		axl_error_new (-1, "Expected to parse properly dumped content from a node, but a failure was found", NULL, error);
 3247: 		return axl_false;
 3248: 	} /* end if */
 3249: 
 3250: 	doc3 = axl_doc_parse_from_file ("test_13d.xml", NULL);
 3251: 	if (doc3 == NULL) {
 3252: 		axl_error_new (-1, "Expected to parse properly a reference file but an error was found", NULL, error);
 3253: 		return axl_false;
 3254: 	} /* end if */
 3255: 
 3256: 	/* check result */
 3257: 	if (! axl_doc_are_equal (doc2, doc3)) {
 3258: 		axl_error_new (-1, "Expected to find equal document to reference, at node dump operations, but not found", NULL, error);
 3259: 		return axl_false;
 3260: 	} /* end if */
 3261: 
 3262: 	/* free the content */
 3263: 	axl_free (content);
 3264: 
 3265: 	/* free the document */
 3266: 	axl_doc_free (doc);
 3267: 	axl_doc_free (doc2);
 3268: 	axl_doc_free (doc3);
 3269: 
 3270: 	/* load test_13e.xml document */
 3271: 	doc = axl_doc_parse_from_file ("test_13e.xml", NULL);
 3272: 	if (doc == NULL) {
 3273: 		axl_error_new (-1, "Expected to find parseable document, but an error was found..", NULL, error);
 3274: 		return axl_false;
 3275: 	}
 3276: 
 3277: 	/* now dump the document */
 3278: 	if (!axl_doc_dump_pretty_to_file (doc, "test_13e.xml.test", 4)) {
 3279: 		axl_error_new (-1, "Expected to perform a proper dump operation but an error was found..", NULL, error);
 3280: 		return axl_false;
 3281: 	}
 3282: 
 3283: 	/* now open the content produced and check both results */
 3284: 	doc2 = axl_doc_parse_from_file ("test_13e.xml.test", NULL);
 3285: 	if (doc2 == NULL) {
 3286: 		axl_error_new (-1, "Failed to open document that was expected to be opened", NULL, error);
 3287: 		return axl_false;
 3288: 	} /* end if */
 3289: 	
 3290: 	/* check both document */
 3291: 	if (! axl_doc_are_equal (doc, doc2)) {
 3292: 		axl_error_new (-1, "Expected to find equal documents before dump operation, but it wasn't found", NULL, error);
 3293: 		return axl_false;
 3294: 	}
 3295: 
 3296: 	/* free both documents */
 3297: 	axl_doc_free (doc2);
 3298: 	axl_doc_free (doc);
 3299: 
 3300: 	/* load test_13e.xml document */
 3301: 	doc = axl_doc_parse_from_file ("test_13f.xml", NULL);
 3302: 	if (doc == NULL) {
 3303: 		axl_error_new (-1, "Expected to find parseable document, but an error was found..", NULL, error);
 3304: 		return axl_false;
 3305: 	}
 3306: 
 3307: 	/* dump to memory */
 3308: 	if (! axl_doc_dump_pretty (doc, &content, &size, 4)) {
 3309: 		axl_error_new (-1, "Expected to find proper dump operation not found", NULL, error);
 3310: 		return axl_false;
 3311: 	} /* end if */
 3312: 
 3313: 	/* now check content dumped against the predefined value */
 3314: 	if (size != 1262 || ! axl_cmp (content, "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n\
 3315: <common-unit-translate>\n\
 3316:     <!-- Translations for the module and its attributes -->\n\
 3317:     <translate module='issued_invoice' as='Facturas emitidas' norma='no'>\n\
 3318:         <translate attr='All Columns' as='Todas las columnas' norma='no'>Value1</translate>\n\
 3319:         <translate attr='invoice_number' as='Número' norma='no'>Value1</translate>\n\
 3320:         <translate attr='date' as='Fecha' norma='no'>Value1</translate>\n\
 3321:         <translate attr='amount' as='Importe' norma='no'>Value1</translate>\n\
 3322:         <translate attr='year' as='Año' norma='no'>Value1</translate>\n\
 3323:         <translate attr='tax' as='IVA' norma='no'>Value1</translate>\n\
 3324:         <translate attr='amount_with_tax' as='Total' norma='no'>Value1</translate>\n\
 3325:         <translate attr='cur_state' as='Estado' norma='no'>Value1</translate>\n\
 3326:     </translate>\n\
 3327:     <!-- Translations for enum declarations -->\n\
 3328:     <translate enum='IssuedInvoiceState' as='Estado factura' norma='no'>\n\
 3329:         <translate value='Valid' as='Valida' norma='no'>Value1</translate>\n\
 3330:         <translate value='Cancelled' as='Anulada' norma='no'>Value1</translate>\n\
 3331:         <translate value='NegativeInvoice' as='Negativa' norma='no'>Value1</translate>\n\
 3332:     </translate>\n\
 3333: </common-unit-translate>\n")) {
 3334: 	        printf ("Content lenght found: %d and size=%d..\n", (int) strlen (content), size);
 3335: 		axl_error_new (-1, "Failed to check dump content, expected different values", NULL, error);
 3336: 		return axl_false;
 3337: 	} /* end if */
 3338: 
 3339: 	axl_free (content);
 3340: 
 3341: 	/* free document */
 3342: 	axl_doc_free (doc);
 3343: 
 3344: 	
 3345: 	return axl_true;
 3346: }
 3347: 
 3348: /** 
 3349:  * @brief A more complex DTD parsing example
 3350:  * 
 3351:  * @param error The optional axlError to be used to report errors.
 3352:  * 
 3353:  * @return axl_true if the validity test is passed, axl_false if not.
 3354:  */
 3355: axl_bool test_12 (axlError ** error) 
 3356: {
 3357: 	axlDoc * doc = NULL;
 3358: 	axlDtd * dtd = NULL;
 3359: 
 3360: 	/* parse gmovil file (an af-arch xml chunk) */
 3361: 	doc = axl_doc_parse_from_file ("channel.xml", error); 
 3362: 	if (doc == NULL) 
 3363: 		return axl_false;
 3364: 
 3365: 	/* parse af-arch DTD */
 3366: 	dtd = axl_dtd_parse_from_file ("channel.dtd", error);
 3367: 	if (dtd == NULL)
 3368: 		return axl_false;
 3369: 
 3370: 	/* perform DTD validation */
 3371: 	if (! axl_dtd_validate (doc, dtd, error)) {
 3372: 		return axl_false;
 3373: 	}
 3374: 
 3375: 	/* free doc reference */
 3376: 	axl_doc_free (doc); 
 3377: 
 3378: 	/* parse gmovil file (an af-arch xml chunk) */
 3379: 	doc = axl_doc_parse_from_file ("channel2.xml", error); 
 3380: 	if (doc == NULL) 
 3381: 		return axl_false;
 3382: 
 3383: 	/* perform DTD validation */
 3384: 	if (! axl_dtd_validate (doc, dtd, error)) {
 3385: 		return axl_false;
 3386: 	}
 3387: 
 3388: 	/* free doc reference */
 3389: 	axl_doc_free (doc); 
 3390: 
 3391: 	/* parse gmovil file (an af-arch xml chunk) */
 3392: 	doc = axl_doc_parse_from_file ("channel3.xml", error); 
 3393: 	if (doc == NULL) 
 3394: 		return axl_false;
 3395: 
 3396: 	/* perform DTD validation */
 3397: 	if (! axl_dtd_validate (doc, dtd, error)) {
 3398: 		return axl_false;
 3399: 	}
 3400: 
 3401: 	/* free doc reference */
 3402: 	axl_doc_free (doc); 
 3403: 
 3404: 	/* parse gmovil file (an af-arch xml chunk) */
 3405: 	doc = axl_doc_parse_from_file ("channel4.xml", error); 
 3406: 	if (doc == NULL) 
 3407: 		return axl_false;
 3408: 
 3409: 	/* perform DTD validation */
 3410: 	if (! axl_dtd_validate (doc, dtd, error)) {
 3411: 		return axl_false;
 3412: 	}
 3413: 
 3414: 	/* free doc reference */
 3415: 	axl_doc_free (doc); 
 3416: 	
 3417: 	/* free dtd reference */
 3418: 	axl_dtd_free (dtd);
 3419: 
 3420: 	/* parse a BEEP greetins example */
 3421: 	doc = axl_doc_parse_from_file ("channel5.xml", error);
 3422: 	if (doc == NULL)
 3423: 		return axl_false;
 3424: 
 3425: 	/* parse the TLS dtd file */
 3426: 	dtd = axl_dtd_parse_from_file ("channel.dtd", error);
 3427: 	if (dtd == NULL)
 3428: 		return axl_false;
 3429: 
 3430: 	/* perform DTD validation */
 3431: 	if (! axl_dtd_validate (doc, dtd, error)) {
 3432: 		return axl_false;
 3433: 	}
 3434: 
 3435: 	/* free doc reference */
 3436: 	axl_doc_free (doc); 
 3437: 	
 3438: 	/* free dtd reference */
 3439: 	axl_dtd_free (dtd);
 3440: 	
 3441: 
 3442: 	/* test end */
 3443: 	return axl_true;
 3444: }
 3445: 
 3446: /** 
 3447:  * @brief A more complex DTD parsing example
 3448:  * 
 3449:  * @param error The optional axlError to be used to report errors.
 3450:  * 
 3451:  * @return axl_true if the validity test is passed, axl_false if not.
 3452:  */
 3453: axl_bool test_11 (axlError ** error) 
 3454: {
 3455: 	axlDoc * doc = NULL;
 3456: 	axlDtd * dtd = NULL;
 3457: 
 3458: 	/* parse gmovil file (an af-arch xml chunk) */
 3459: 	doc = axl_doc_parse_from_file ("gmovil2.xml", error); 
 3460: 	if (doc == NULL) 
 3461: 		return axl_false;
 3462: 
 3463: 	/* parse af-arch DTD */
 3464: 	dtd = axl_dtd_parse_from_file ("fact.dtd", error);
 3465: 	if (dtd == NULL)
 3466: 		return axl_false;
 3467: 
 3468: 	/* perform DTD validation */
 3469: 	if (! axl_dtd_validate (doc, dtd, error)) {
 3470: 		return axl_false;
 3471: 	}
 3472: 
 3473: 	/* free doc reference */
 3474: 	axl_doc_free (doc); 
 3475: 	
 3476: 	/* free dtd reference */
 3477: 	axl_dtd_free (dtd);
 3478: 
 3479: 	/* test end */
 3480: 	return axl_true;
 3481: }
 3482: 
 3483: /** 
 3484:  * @brief A more complex DTD parsing example
 3485:  * 
 3486:  * @param error The optional axlError to be used to report errors.
 3487:  * 
 3488:  * @return axl_true if the validity test is passed, axl_false if not.
 3489:  */
 3490: axl_bool test_10 (axlError ** error) 
 3491: {
 3492: 	axlDoc                * doc      = NULL;
 3493: 	axlDtd                * dtd      = NULL;
 3494: 	axlDtdElement         * element  = NULL;
 3495: 	axlDtdElementList     * itemList = NULL;
 3496: 
 3497: 	/* parse gmovil file (an af-arch xml chunk) */
 3498: 	doc = axl_doc_parse_from_file ("test5.xml", error); 
 3499: 	if (doc == NULL) 
 3500: 		return axl_false;
 3501: 
 3502: 	/* parse af-arch DTD */
 3503: 	dtd = axl_dtd_parse_from_file ("test5.dtd", error);
 3504: 	if (dtd == NULL)
 3505: 		return axl_false;
 3506: 
 3507: 	/* get the dtd element representation */
 3508: 	element = axl_dtd_get_element (dtd, "choices");
 3509: 
 3510: 	/* get the item list inside */
 3511: 	itemList = axl_dtd_get_item_list (element);
 3512: 	if (axl_dtd_item_list_count (itemList) != 4) {
 3513: 		axl_error_new (-1, "expected to receive an item list with 4 item nodes inside", NULL, error);
 3514: 		return axl_false;
 3515: 	}
 3516: 
 3517: 	if (axl_dtd_item_list_type (itemList) != CHOICE) {
 3518: 		axl_error_new (-1, "expected to receive a choice item list", NULL, error);
 3519: 		return axl_false;
 3520: 	}
 3521: 
 3522: 	if (axl_dtd_item_list_repeat (itemList) != ZERO_OR_MANY) {
 3523: 		axl_log ("test-01", AXL_LEVEL_DEBUG, "received a different repeat configuration: %d != %d",
 3524: 			 ZERO_OR_MANY, axl_dtd_item_list_repeat (itemList));
 3525: 		axl_error_new (-1, "expected to receive an item list with (*) zero or many spec", NULL, error);
 3526: 		return axl_false;
 3527: 	}
 3528: 	
 3529: 
 3530: 	/* perform DTD validation */
 3531: 	if (! axl_dtd_validate (doc, dtd, error)) { 
 3532: 		return axl_false; 
 3533: 	} 
 3534: 
 3535: 	/* free dtd reference */
 3536: 	axl_dtd_free (dtd);
 3537: 
 3538: 
 3539: 	/* parse af-arch DTD */
 3540: 	dtd = axl_dtd_parse_from_file ("test5.1.dtd", error);
 3541: 	if (dtd == NULL)
 3542: 		return axl_false;
 3543: 	
 3544: 	/* perform DTD validation */
 3545: 	if (axl_dtd_validate (doc, dtd, error)) { 
 3546: 		axl_error_new (-1, "A validation failure was expected.", NULL, error);
 3547: 		return axl_false; 
 3548: 	} 
 3549: 
 3550: 	/* because a failure was expected, release memory allocated by
 3551: 	 * axl_error_new */
 3552: 	axl_error_free (*error);
 3553: 	
 3554: 	/* free doc reference */
 3555: 	axl_doc_free (doc); 
 3556: 	
 3557: 	/* free dtd reference */
 3558: 	axl_dtd_free (dtd);
 3559: 
 3560: 	/* test end */
 3561: 	return axl_true;
 3562: }
 3563: 
 3564: /** 
 3565:  * @brief A more complex DTD parsing example
 3566:  * 
 3567:  * @param error The optional axlError to be used to report errors.
 3568:  * 
 3569:  * @return axl_true if the validity test is passed, axl_false if not.
 3570:  */
 3571: axl_bool test_09 (axlError ** error) 
 3572: {
 3573: 	axlDoc                * doc      = NULL;
 3574: 	axlDtd                * dtd      = NULL;
 3575: 	axlDtdElement         * element  = NULL;
 3576: 	axlDtdElementList     * itemList = NULL;
 3577: 	axlDtdElementListNode * itemNode = NULL;
 3578: 	
 3579: 
 3580: 	/* parse gmovil file (an af-arch xml chunk) */
 3581: 	doc = axl_doc_parse_from_file ("test4.xml", error); 
 3582: 	if (doc == NULL) 
 3583: 		return axl_false;
 3584: 
 3585: 	/* parse af-arch DTD */
 3586: 	dtd = axl_dtd_parse_from_file ("test4.dtd", error);
 3587: 	if (dtd == NULL)
 3588: 		return axl_false;
 3589: 
 3590: 	
 3591: 	/* get dtd element */
 3592: 	element = axl_dtd_get_element (dtd, "nodes");
 3593: 	if (element == NULL) {
 3594: 		axl_error_new (-1, "unable to find expected DTD element", NULL, error);
 3595: 		return axl_false;
 3596: 	}
 3597: 
 3598: 	/* get the item list */
 3599: 	itemList = axl_dtd_get_item_list (element);
 3600: 	if (axl_dtd_item_list_count (itemList) != 8) {
 3601: 		axl_log ("test-01", AXL_LEVEL_CRITICAL, "found item list size: %d != 8",
 3602: 			 axl_dtd_item_list_count (itemList));
 3603: 		axl_error_new (-1, "expected to find an item list definition with 8 elements", NULL, error);
 3604: 		return axl_false;
 3605: 	}
 3606: 
 3607: 	/* check <first> node spec */
 3608: 	itemNode = axl_dtd_item_list_get_node (itemList, 0);
 3609: 	if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
 3610: 		axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
 3611: 		return axl_false;
 3612: 	}
 3613: 	
 3614: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "first")) {
 3615: 		axl_error_new (-1, "expected to find an item node name (first) definition, not found", NULL, error);
 3616: 		return axl_false;
 3617: 	}
 3618: 
 3619: 	if (axl_dtd_item_node_get_repeat (itemNode) != ONE_OR_MANY) {
 3620: 		axl_error_new (-1, "expected to find an item node definition with one or many repeat def (+), not found", NULL, error);
 3621: 		return axl_false;
 3622: 	}
 3623: 
 3624: 	/* check <second> node spec */
 3625: 	itemNode = axl_dtd_item_list_get_node (itemList, 1);
 3626: 	if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
 3627: 		axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
 3628: 		return axl_false;
 3629: 	}
 3630: 	
 3631: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "second")) {
 3632: 		axl_error_new (-1, "expected to find an item node name (second) definition, not found", NULL, error);
 3633: 		return axl_false;
 3634: 	}
 3635: 
 3636: 	if (axl_dtd_item_node_get_repeat (itemNode) != ONE_AND_ONLY_ONE) {
 3637: 		axl_error_new (-1, "expected to find an item node definition with one and only one repeat def (), not found", NULL, error);
 3638: 		return axl_false;
 3639: 	}
 3640: 
 3641: 	/* check <third> node spec */
 3642: 	itemNode = axl_dtd_item_list_get_node (itemList, 2);
 3643: 	if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
 3644: 		axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
 3645: 		return axl_false;
 3646: 	}
 3647: 	
 3648: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "third")) {
 3649: 		axl_error_new (-1, "expected to find an item node name (third) definition, not found", NULL, error);
 3650: 		return axl_false;
 3651: 	}
 3652: 
 3653: 	if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_ONE) {
 3654: 		axl_error_new (-1, "expected to find an item node definition with zero or one repeat def (?), not found", NULL, error);
 3655: 		return axl_false;
 3656: 	}
 3657: 
 3658: 	/* check <fourth> node spec */
 3659: 	itemNode = axl_dtd_item_list_get_node (itemList, 3);
 3660: 	if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
 3661: 		axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
 3662: 		return axl_false;
 3663: 	}
 3664: 	
 3665: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "fourth")) {
 3666: 		axl_error_new (-1, "expected to find an item node name (fourth) definition, not found", NULL, error);
 3667: 		return axl_false;
 3668: 	}
 3669: 
 3670: 	if (axl_dtd_item_node_get_repeat (itemNode) != ONE_AND_ONLY_ONE) {
 3671: 		axl_error_new (-1, "expected to find an item node definition with one and only one repeat def (), not found", NULL, error);
 3672: 		return axl_false;
 3673: 	}
 3674: 
 3675: 	/* check <fifth> node spec */
 3676: 	itemNode = axl_dtd_item_list_get_node (itemList, 4);
 3677: 	if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
 3678: 		axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
 3679: 		return axl_false;
 3680: 	}
 3681: 	
 3682: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "fifth")) {
 3683: 		axl_error_new (-1, "expected to find an item node name (fifth) definition, not found", NULL, error);
 3684: 		return axl_false;
 3685: 	}
 3686: 
 3687: 	if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_MANY) {
 3688: 		axl_error_new (-1, "expected to find an item node definition with zero to many repeat def (*), not found", NULL, error);
 3689: 		return axl_false;
 3690: 	}
 3691: 
 3692: 	/* check <fourth> node spec */
 3693: 	itemNode = axl_dtd_item_list_get_node (itemList, 5);
 3694: 	if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
 3695: 		axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
 3696: 		return axl_false;
 3697: 	}
 3698: 	
 3699: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "fourth")) {
 3700: 		axl_error_new (-1, "expected to find an item node name (fourth) definition, not found", NULL, error);
 3701: 		return axl_false;
 3702: 	}
 3703: 
 3704: 	if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_MANY) {
 3705: 		axl_error_new (-1, "expected to find an item node definition with zero to many repeat def (*), not found", NULL, error);
 3706: 		return axl_false;
 3707: 	}
 3708: 
 3709: 	/* check repetition pattern for node spec 6 */
 3710: 	itemNode = axl_dtd_item_list_get_node (itemList, 6);
 3711: 	if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_LIST) {
 3712: 		axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
 3713: 		return axl_false;
 3714: 	}
 3715: 	
 3716: 	if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_ONE) {
 3717: 		axl_log ("test-01", AXL_LEVEL_DEBUG, "repeat configuration was different: %d != %d",
 3718: 			 axl_dtd_item_node_get_repeat (itemNode), ZERO_OR_ONE);
 3719: 		axl_error_new (-1, "expected to find an item node definition with zero or one repeat def (?), not found", NULL, error);
 3720: 		return axl_false;
 3721: 	}
 3722: 
 3723: 	/* check repetition pattern for node spec 7 */
 3724: 	itemNode = axl_dtd_item_list_get_node (itemList, 7);
 3725: 	if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_LIST) {
 3726: 		axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
 3727: 		return axl_false;
 3728: 	}
 3729: 	
 3730: 	if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_MANY) {
 3731: 		axl_log ("test-01", AXL_LEVEL_DEBUG, "repeat configuration was different: %d != %d",
 3732: 			 axl_dtd_item_node_get_repeat (itemNode), ZERO_OR_MANY);
 3733: 		axl_error_new (-1, "expected to find an item node definition with zero or one repeat def (*), not found", NULL, error);
 3734: 		return axl_false;
 3735: 	}
 3736: 
 3737: 
 3738: 	/* perform DTD validation */
 3739: 	if (! axl_dtd_validate (doc, dtd, error)) { 
 3740: 		return axl_false; 
 3741: 	} 
 3742: 
 3743: 	/* free doc reference */
 3744: 	axl_doc_free (doc); 
 3745: 	
 3746: 	/* free dtd reference */
 3747: 	axl_dtd_free (dtd);
 3748: 
 3749: 	/* test end */
 3750: 	return axl_true;
 3751: }
 3752: 
 3753: /** 
 3754:  * @brief Perform a loading for a large file.
 3755:  * 
 3756:  * @param error The optional axlError to be used to report errors.
 3757:  * 
 3758:  * @return axl_true if the validity test is passed, axl_false if not.
 3759:  */
 3760: axl_bool test_08 (axlError ** error)
 3761: {
 3762: 	/* top level definitions */
 3763: 	axlDoc            * doc = NULL;
 3764: 
 3765: 	/* get current doc reference */
 3766: 	doc = axl_doc_parse_from_file ("large.xml", error);
 3767: 	if (doc == NULL)
 3768: 		return axl_false;
 3769: 
 3770: 	/* release the document */
 3771: 	axl_doc_free (doc);
 3772: 
 3773: 	return axl_true;
 3774: }
 3775: 
 3776: 
 3777: /** 
 3778:  * @brief A bit more complex DTD parsing checkings
 3779:  * 
 3780:  * @param error The optional axlError to be used to report errors.
 3781:  * 
 3782:  * @return axl_true if the validity test is passed, axl_false if not.
 3783:  */
 3784: axl_bool test_07 (axlError ** error)
 3785: {
 3786: 	/* top level definitions */
 3787: 	axlDoc            * doc = NULL;
 3788: 	axlDtd            * dtd = NULL;
 3789: 
 3790: 	/* get current doc reference */
 3791: 	doc = axl_doc_parse_from_file ("test3.xml", error);
 3792: 	if (doc == NULL)
 3793: 		return axl_false;
 3794: 
 3795: 	/* load DTD */
 3796: 	dtd = axl_dtd_parse_from_file ("test3.dtd", error);
 3797: 	if (dtd == NULL)
 3798: 		return axl_false;
 3799: 
 3800: 	/* validate the xml document */
 3801: 	if (! axl_dtd_validate (doc, dtd, error)) {
 3802: 		return  axl_false;
 3803: 	}
 3804: 	
 3805: 	/* free document */
 3806: 	axl_doc_free (doc);
 3807: 
 3808: 	/* free dtd document */
 3809: 	axl_dtd_free (dtd);
 3810: 
 3811: 	return axl_true;
 3812: }
 3813: 
 3814: /** 
 3815:  * @brief A bit more complex DTD parsing checkings
 3816:  * 
 3817:  * @param error The optional axlError to be used to report errors.
 3818:  * 
 3819:  * @return axl_true if the validity test is passed, axl_false if not.
 3820:  */
 3821: axl_bool test_06 (axlError ** error)
 3822: {
 3823: 	/* top level definitions */
 3824: 	axlDoc            * doc = NULL;
 3825: 	axlDtd            * dtd = NULL;
 3826: 
 3827: 	/* dtd iteration variables */
 3828: 	axlDtdElement         * element;
 3829: 	axlDtdElementList     * itemList;
 3830: 	axlDtdElementListNode * itemNode;
 3831: 	
 3832: 	/* get current doc reference */
 3833: 	doc = axl_doc_parse_from_file ("test3.xml", error);
 3834: 	if (doc == NULL)
 3835: 		return axl_false;
 3836: 
 3837: 	/* load DTD */
 3838: 	dtd = axl_dtd_parse_from_file ("test3.dtd", error);
 3839: 	if (dtd == NULL)
 3840: 		return axl_false;
 3841: 
 3842: 	/* get the DTD element reference and check it */
 3843: 	element = axl_dtd_get_root (dtd);
 3844: 	if (element == NULL) {
 3845: 		axl_error_new (-1, "Expected to receive a root DTD node, not found", NULL, error);
 3846: 		return axl_false;
 3847: 	}
 3848: 
 3849: 	/* check expected DTD root content */
 3850: 	if (! axl_cmp (axl_dtd_get_element_name (element), "complex")) {
 3851: 		axl_error_new (-1, "Expected to receive a root DTD node name, not found", NULL, error);
 3852: 		return axl_false;
 3853: 	}
 3854: 
 3855: 	if (axl_dtd_get_element_type (element) != ELEMENT_TYPE_CHILDREN) {
 3856: 		axl_error_new (-1, "Expected to receive a root DTD node selection type (Children), not found", NULL, error);
 3857: 		return axl_false;
 3858: 	}
 3859: 
 3860: 	/* get content specification */
 3861: 	itemList = axl_dtd_get_item_list (element);
 3862: 	if (axl_dtd_item_list_count (itemList) != 1) {
 3863: 		axl_log ("test-01", AXL_LEVEL_DEBUG, "item count %d != %d item spected",
 3864: 			 axl_dtd_item_list_count (itemList), 1);
 3865: 		axl_error_new (-1, "Expected to receive an item list specification with only one node, not found", NULL, error);
 3866: 		return axl_false;
 3867: 	}
 3868: 
 3869: 	/* get times configuration */
 3870: 	if (axl_dtd_item_list_repeat (itemList) != ONE_AND_ONLY_ONE) {
 3871: 		axl_error_new (-1, "Expected to receive a repetition configuration (one and only one) but not found", NULL, error);
 3872: 		return axl_false;
 3873: 	}
 3874: 
 3875: 	/* get the child node reference */
 3876: 	itemNode = axl_dtd_item_list_get_node (itemList, 0);
 3877: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "data")) {
 3878: 		axl_log ("test-01", AXL_LEVEL_CRITICAL, "found item name: '%s' != data",
 3879: 			 axl_dtd_item_node_get_value (itemNode));
 3880: 		axl_error_new (-1, "Expected to receive an item node but, not found", NULL, error);
 3881: 		return axl_false;
 3882: 	}
 3883: 
 3884: 	/* get the DTD element which represents the provided data */
 3885: 	element = axl_dtd_get_element (dtd, "data");
 3886: 	if ((element == NULL) || (!axl_cmp (axl_dtd_get_element_name (element), "data"))) {
 3887: 		axl_error_new (-1, "Expected to receive a DTD element definition but NULL was found or a different DTD name, not found", NULL, error);
 3888: 		return axl_false;
 3889: 	}
 3890: 	
 3891: 	/* get content specification */
 3892: 	itemList = axl_dtd_get_item_list (element);
 3893: 	if (axl_dtd_item_list_count (itemList) != 3) {
 3894: 		axl_log ("test-01", AXL_LEVEL_DEBUG, "item count %d != %d item spected",
 3895: 			 axl_dtd_item_list_count (itemList), 3);
 3896: 		axl_error_new (-1, "Expected to receive an item list specification with only one node, not found", NULL, error);
 3897: 		return axl_false;
 3898: 	}
 3899: 
 3900: 	/* get item list especification */
 3901: 	if (axl_dtd_item_list_type (itemList) != SEQUENCE) {
 3902: 		axl_log ("test-01", AXL_LEVEL_DEBUG, "item count %d != %d item spected",
 3903: 			 axl_dtd_item_list_count (itemList), 3);
 3904: 		axl_error_new (-1, "Expected to receive an item list specification as a sequence type, not found", NULL, error);
 3905: 		return axl_false;
 3906: 	}
 3907: 
 3908: 	/* check item nodes found inside the item list */
 3909: 	itemNode = axl_dtd_item_list_get_node (itemList, 0);
 3910: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "row")) {
 3911: 		axl_error_new (-1, "Expected to receive an item node (row) but, not found", NULL, error);
 3912: 		return axl_false;
 3913: 	}
 3914: 
 3915: 	/* get the child node reference */
 3916: 	itemNode = axl_dtd_item_list_get_node (itemList, 1);
 3917: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "column")) {
 3918: 		axl_error_new (-1, "Expected to receive an item node (column) but, not found", NULL, error);
 3919: 		return axl_false;
 3920: 	}
 3921: 
 3922: 	/* get current configuration for repetition value for the
 3923: 	 * provided content particule */
 3924: 	if (axl_dtd_item_node_get_repeat (itemNode) != ONE_AND_ONLY_ONE) {
 3925: 		axl_error_new (-1, "Expected to receive an item node repeat configuration but, not found", NULL, error);
 3926: 		return axl_false;
 3927: 	}
 3928: 		
 3929: 
 3930: 	/* get the child node reference */
 3931: 	itemNode = axl_dtd_item_list_get_node (itemList, 2);
 3932: 	if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "value")) {
 3933: 		axl_error_new (-1, "Expected to receive an item node (value) but, not found", NULL, error);
 3934: 		return axl_false;
 3935: 	}
 3936: 
 3937: 	/* now work with the choice element */
 3938: 	element = axl_dtd_get_element (dtd, "column");
 3939: 	if ((element == NULL) || (!axl_cmp (axl_dtd_get_element_name (element), "column"))) {
 3940: 		axl_error_new (-1, "Expected to receive a DTD element definition but NULL was found or a different DTD name (column), not found", NULL, error);
 3941: 		return axl_false;
 3942: 	}
 3943: 	
 3944: 	/* get content specification */
 3945: 	itemList = axl_dtd_get_item_list (element);
 3946: 	if (axl_dtd_item_list_count (itemList) != 4) {
 3947: 		axl_log ("test-01", AXL_LEVEL_DEBUG, "item count %d != %d item spected",
 3948: 			 axl_dtd_item_list_count (itemList), 4);
 3949: 		axl_error_new (-1, "Expected to receive an item list specification with only one node, not found", NULL, error);
 3950: 		return axl_false;
 3951: 	}
 3952: 
 3953: 	/* get item list especification */
 3954: 	if (axl_dtd_item_list_type (itemList) != CHOICE) {
 3955: 		axl_error_new (-1, "Expected to receive an item list specification as a CHOICE type, not found", NULL, error);
 3956: 		return axl_false;
 3957: 	}
 3958: 
 3959: 	/* get the DTD element which represents the provided data */
 3960: 	element = axl_dtd_get_element (dtd, "data");
 3961: 	if ((element == NULL) || (!axl_cmp (axl_dtd_get_element_name (element), "data"))) {
 3962: 		axl_error_new (-1, "Expected to receive a DTD element definition but NULL was found or a different DTD name, not found", NULL, error);
 3963: 		return axl_false;
 3964: 	}
 3965: 
 3966: 	/* free document */
 3967: 	axl_doc_free (doc);
 3968: 
 3969: 	/* free dtd document */
 3970: 	axl_dtd_free (dtd);
 3971: 
 3972: 	return axl_true;
 3973: }
 3974: 
 3975: /** 
 3976:  * @brief DTD operations. Checks that DTD support works, reading
 3977:  * simple DTD definitions, and ensuring elements are properly read.
 3978:  * 
 3979:  * @param error The axlError reference to be filled if the function
 3980:  * returns axl_false.
 3981:  * 
 3982:  * @return axl_true if the validity test is passed, axl_false if not.
 3983:  */
 3984: axl_bool test_05 (axlError ** error)
 3985: {
 3986: 
 3987: 	axlDoc * doc;
 3988: 	axlNode * node;
 3989: 	axlDtd  * dtd;
 3990: 
 3991: 	/* parse the document found */
 3992: 	doc = axl_doc_parse_from_file ("test.xml", error);
 3993: 	if (doc == NULL)
 3994: 		return axl_false;
 3995: 
 3996: 	node = axl_doc_get (doc, "/complex/data/row/td");
 3997: 	if (node == NULL) {
 3998: 		axl_error_new (-1, "Expected to receive a node, not found", NULL, error);
 3999: 		axl_doc_free (doc);
 4000: 		return axl_false;
 4001: 	}
 4002: 
 4003: 	if (! axl_cmp (axl_node_get_content (node, NULL), "10")) {
 4004: 		axl_error_new (-1, "Expected to receive a node content, not found", NULL, error);
 4005: 		axl_doc_free (doc);
 4006: 		return axl_false;
 4007: 	}
 4008: 
 4009: 	/* free previous document */
 4010: 	axl_doc_free (doc);
 4011: 
 4012: 	/* parse the document found */
 4013: 	doc = axl_doc_parse_from_file ("test2.xml", error);
 4014: 	if (doc == NULL)
 4015: 		return axl_false;
 4016: 	
 4017: 	
 4018: 	dtd = axl_dtd_parse_from_file ("test.dtd", error);
 4019: 	if (dtd == NULL)
 4020: 		return axl_false;
 4021: 
 4022: 	/* now validate the document */
 4023: 	if (! axl_dtd_validate (doc, dtd, error)) {
 4024: 		return axl_false;
 4025: 	}
 4026: 
 4027: 	/* release memory used by the parser */
 4028: 	axl_doc_free (doc);
 4029: 	
 4030: 	/* release memory used by the DTD element */
 4031: 	axl_dtd_free (dtd);
 4032: 
 4033: 	return axl_true;
 4034: 	
 4035: }
 4036: 
 4037: /** 
 4038:  * @brief Perform some additional checks for a more extended xml
 4039:  * documents, that includes attributes inside node definitions.
 4040:  *
 4041:  * @param error The axlError where failures will be reported 
 4042:  *
 4043:  * @return The \ref axl_true if test is passed, axl_false if not.
 4044:  */
 4045: axl_bool test_04 (axlError ** error)
 4046: {
 4047: 	axlDoc  * doc;
 4048: 	axlNode * node;
 4049: 
 4050: 	/* parse the document */
 4051: 	doc = axl_doc_parse_strings (error, 
 4052: 				     "<?xml version='1.0' ?>",
 4053: 				     "  <?test \"my content\" ?>",
 4054: 				     "  <complex>",
 4055: 				     "    <data>",
 4056: 				     "       <row>",
 4057: 				     "         <!-- A comment inside the middle of the document ",
 4058: 				     " more comments ... ",
 4059: 				     " more comments \n \r <td>..</td> -->",
 4060: 				     "          <td>10</td>",
 4061: 				     "          <test />",
 4062: 				     " \n \n \r     <?test \"my content\" ?>     \n    \n",
 4063: 				     "  <?test \"my content\" ?>",
 4064: 				     "          <more>",
 4065: 				     "              <test3 attr='2.0' />",
 4066: 				     "          </more>",
 4067: 				     "       </row>",
 4068: 				     "       <test2 />",
 4069: 				     "       <non-xml-document>",
 4070: 				     "                             \n \r \n \t",
 4071: 				     "         <![CDATA[<xml><<<<<<>>>>>><<<>>>><<<<<<>>>]]>"
 4072: 				     "          \r \n \r \t",
 4073: 				     "       </non-xml-document>",
 4074: 				     "    </data>",
 4075: 				     " <!--   <data>",
 4076: 				     "       <row>",
 4077: 				     "         A comment inside the middle of the document ",
 4078: 				     " more comments ... ",
 4079: 				     " more comments \n \r <td>..</td> ",
 4080: 				     "          <td>10</td>",
 4081: 				     "          <test />",
 4082: 				     "          <more>",
 4083: 				     "              <test2 attr='2.0' attr2='3.0' attr4='4.0'/>",
 4084: 				     "          </more>",
 4085: 				     "       </row>",
 4086: 				     "       <test2 />",
 4087: 				     "    </data> -->",
 4088: 				     "  </complex>",
 4089: 				     NULL);
 4090: 	/* check the result returned */
 4091: 	if (doc == NULL)
 4092: 		return axl_false;
 4093: 
 4094: 	/* get the node <td> value */
 4095: 	node = axl_doc_get (doc, "/complex/data/row/td");
 4096: 	if (! axl_cmp (axl_node_get_content (node, NULL), "10")) {
 4097: 		axl_log ("test-04", AXL_LEVEL_DEBUG, "found a different content than the expected ('10' != '%s')",
 4098: 			 axl_node_get_content (node, NULL));
 4099: 		axl_error_new (-1, "Expected to receive a 10 value, but not found", NULL, error);
 4100: 		return axl_false;
 4101: 	}
 4102: 
 4103: 	/* get a reference to the test2 node */
 4104: 	node = axl_doc_get (doc, "/complex/data/row/more/test3");
 4105: 	if (node == NULL) {
 4106: 		axl_error_new (-1, "Expected to find a test3 node at the given location", NULL, error);
 4107: 		return axl_false;
 4108: 	}
 4109: 
 4110: 	/* check the attribute */
 4111: 	if (! axl_node_has_attribute (node, "attr")) {
 4112: 		axl_error_new (-1, "Expected to find an attribute called 'attr' inside test3 node at the given location", NULL, error);
 4113: 		return axl_false;
 4114: 	}
 4115: 
 4116: 	/* check the attribute value */
 4117: 	if (! axl_cmp (axl_node_get_attribute_value (node, "attr"), "2.0")) {
 4118: 		axl_error_new (-1, "Expected to find an attribute value equal '2.0' inside test2 node at the given location", NULL, error);
 4119: 		return axl_false;
 4120: 	}
 4121: 
 4122: 	/* add here Pi instruction checking */
 4123: 	if (! axl_doc_has_pi_target (doc, "test")) {
 4124: 		axl_error_new (-1, "failed to get expected PI target 'test'", NULL, error);
 4125: 		return axl_false;
 4126: 	}
 4127: 
 4128: 	if (! axl_cmp (axl_doc_get_pi_target_content (doc, "test"), "\"my content\"")) {
 4129: 		axl_error_new (-1, "expected to receive a PI content not found", NULL, error);
 4130: 		return axl_false;
 4131: 	}
 4132: 
 4133: 	node = axl_doc_get (doc, "/complex/data/row");
 4134: 	if (node == NULL) {
 4135: 		axl_error_new (-1, "unable to get expected node to check node PI support", NULL, error);
 4136: 		return axl_false;
 4137: 	}
 4138: 
 4139: 	if (! axl_node_has_pi_target (node, "test")) {
 4140: 		axl_error_new (-1, "failed to get expected PI target 'test' for the node", NULL, error);
 4141: 		return axl_false;
 4142: 	}
 4143: 
 4144: 	
 4145: 	node = axl_doc_get (doc, "/complex/data/non-xml-document");
 4146: 	if (node == NULL) {
 4147: 		axl_error_new (-1, "Expected to receive the CDATA node, not found", NULL, error);
 4148: 		return axl_false;
 4149: 	}
 4150: 
 4151: 	if (! axl_cmp (axl_node_get_content (node, NULL), "<xml><<<<<<>>>>>><<<>>>><<<<<<>>>")) {
 4152: 		printf ("Content doesn't match: %s != %s\n", 
 4153: 			axl_node_get_content (node, NULL), "<xml><<<<<<>>>>>><<<>>>><<<<<<>>>");
 4154: 		axl_error_new (-1, "Expected to recevie CDATA content, not found or not match", NULL, error);
 4155: 		return axl_false;
 4156: 	}
 4157: 
 4158: 				     
 4159: 	/* free the memory */
 4160: 	axl_doc_free (doc);
 4161: 	
 4162: 	return axl_true;
 4163: }
 4164: 
 4165: /** 
 4166:  * @brief Checks a more extended and complex xml documents
 4167:  * 
 4168:  * @param error The axlError where failures will be reported.
 4169:  * 
 4170:  * @return \ref axl_true if test is passed, axl_false if not.
 4171:  */
 4172: axl_bool test_03 (axlError ** error)
 4173: {
 4174: 
 4175: 	axlDoc  * doc;
 4176: 	axlNode * node;
 4177: 
 4178: 	/* parse the xml document provided */
 4179: 	doc = axl_doc_parse ("<?xml version='1.0' ?>\n\
 4180: <complex>\n\
 4181:   <data>\n\
 4182:     <row>10</row><row>20</row><row>30</row><row>40</row>\n\
 4183:   </data>\n\
 4184:   <data2>\n\
 4185:     <td> 23  </td>\n\
 4186:   </data2>\n\
 4187: </complex>", -1, error);
 4188: 	if (doc == NULL)
 4189: 		return axl_false;
 4190: 
 4191: 	/* get the root node */
 4192: 	node = axl_doc_get_root (doc);
 4193: 	if (! NODE_CMP_NAME (node, "complex")) {
 4194: 		axl_error_new (-2, "Root node returned from the document is not the one excepted", NULL, error);
 4195: 		axl_doc_free (doc);
 4196: 		return axl_false;
 4197: 	}
 4198: 
 4199: 	/* test get node function */
 4200: 	node = axl_doc_get (doc, "/complex/data2/td");
 4201: 	if (node == NULL) {
 4202: 		axl_error_new (-2, "Unable to find a node due to a path selection", NULL, error);
 4203: 		axl_doc_free (doc);
 4204: 		return axl_false;
 4205: 	}
 4206: 
 4207: 	/* check the node returned */
 4208: 	if (! NODE_CMP_NAME (node, "td")) {
 4209: 		axl_error_new (-2, "The node for the node looked up doesn't match ", NULL, error);
 4210: 		axl_doc_free (doc);
 4211: 		return axl_false;
 4212: 	}
 4213: 
 4214: 	/* check for returning bad nodes */
 4215: 	node = axl_doc_get (doc, "/complex/data3/td");
 4216: 	if (node != NULL) {
 4217: 		axl_error_new (-2, "Returned a node that should be NULL", NULL, error);
 4218: 		axl_doc_free (doc);
 4219: 		return axl_false;
 4220: 	}
 4221: 
 4222: 	node = axl_doc_get (doc, "/complex/data2/td");
 4223: 	if (!axl_cmp (axl_node_get_content (node, NULL), " 23  ")) {
 4224: 		axl_log ("test-03", AXL_LEVEL_DEBUG, "expected to receive a node content: ' 23  ' but received '%s'",
 4225: 			 axl_node_get_content (node, NULL));
 4226: 		axl_error_new (-2, "Node content have failed, expected a different value", NULL, error);
 4227: 		return axl_false;
 4228: 	}
 4229: 
 4230: 	node = axl_doc_get (doc, "complex/data3/td");
 4231: 	if (node != NULL) {
 4232: 		axl_error_new (-2, "Parsed a path that is invalid", NULL, error);
 4233: 		return axl_false;
 4234: 	}
 4235: 	
 4236: 	/* release memory allocated by the document */
 4237: 	axl_doc_free (doc);
 4238: 
 4239: 	return axl_true;
 4240: }
 4241: 
 4242: axl_bool test_02_always_fail (axlStream * stream, const char ** detected, axlPointer user_data, axlError ** error)
 4243: {
 4244: 	/* always return axl_false to check how behave the library */
 4245: 	return axl_false;
 4246: }
 4247: 
 4248: 
 4249: /** 
 4250:  * @brief Checks xml document error for basic parsing.
 4251:  * 
 4252:  * @param error The axlError where failures are returned.
 4253:  * 
 4254:  * @return axl_true if test are properly run. axl_false if not.
 4255:  */
 4256: axl_bool test_02 (axlError ** error) 
 4257: {
 4258: 	axlDoc * doc;
 4259: 	
 4260: 	doc = axl_doc_parse ("<? xml >", 8, error);
 4261: 	if (doc != NULL) {
 4262: 		axl_error_new (-1, "Failed to detect wrong xml header", NULL, error);
 4263: 		return axl_false;
 4264: 	}
 4265: 	axl_error_free (* error);
 4266: 	(*error) = NULL;
 4267: 
 4268: 	doc = axl_doc_parse ("<?xml >", 7, error);
 4269: 	if (doc != NULL) {
 4270: 		
 4271: 		axl_error_new (-1, "Failed to detect wrong xml trailing header", NULL, error);
 4272: 		return axl_false;
 4273: 	}
 4274: 	axl_error_free (* error);
 4275: 	(*error) = NULL;
 4276: 
 4277: 	/* configure an encoding function that fails to detect */
 4278: 	axl_doc_set_detect_codification_func (test_02_always_fail, NULL);
 4279: 
 4280: 	doc = axl_doc_parse ("<this />", 8, error);
 4281: 	if (doc != NULL) {
 4282: 		axl_error_new (-1, "Failed to detect wrong xml trailing header", NULL, error);
 4283: 		return axl_false;
 4284: 	}
 4285: 	axl_error_free (* error);
 4286: 	(*error) = NULL;
 4287: 	/* uninstall detect codification */
 4288: 	axl_doc_set_detect_codification_func (NULL, NULL);
 4289: 
 4290: 	
 4291: 	/* wrong closed document comment */
 4292: 	doc = axl_doc_parse ("<document><this><!-- this not closed --</document>", 50, error);
 4293: 	if (doc != NULL) {
 4294: 		axl_error_new (-1, "Failed to detect wrong balanced xml document", NULL, error);
 4295: 		return axl_false;
 4296: 	}
 4297: 	axl_error_free (* error);
 4298: 	(*error) = NULL;
 4299: 
 4300: 	/* opening an unbalanced document */
 4301: 	doc = axl_doc_parse ("<document><this><!-- this not closed --></document>", 51, error);
 4302: 	if (doc != NULL) {
 4303: 		axl_error_new (-1, "Failed to detect wrong balanced xml document", NULL, error);
 4304: 		return axl_false;
 4305: 	}
 4306: 	axl_error_free (* error);
 4307: 	(*error) = NULL;
 4308: 
 4309: 	/* opening an unbalanced document with all nodes called the same */
 4310: 	printf ("Test 02: unbalanced document called with same nodes..\n");
 4311: 	doc = axl_doc_parse ("<document><document><!-- this not closed --></document>", 55, error);
 4312: 	if (doc != NULL) {
 4313: 		axl_error_new (-1, "Failed to detect wrong balanced xml document", NULL, error);
 4314: 		return axl_false;
 4315: 	}
 4316: 	axl_error_free (* error);
 4317: 	(*error) = NULL;
 4318: 
 4319: 	return axl_true;
 4320: }
 4321: 
 4322: 
 4323: /** 
 4324:  * @brief Parse an initial document, with an xml header with
 4325:  * version=1.0 and no more header.
 4326:  * 
 4327:  * 
 4328:  * @return axl_false if the function fails to parse the
 4329:  * document. axl_true if the test was properly executed.
 4330:  */
 4331: axl_bool test_01 (axlError ** error) 
 4332: {
 4333: 	/* axl document representation */
 4334: 	axlDoc   * doc;
 4335: 	
 4336: 
 4337: 	/* parse the given string */
 4338: 	doc = axl_doc_parse ("<?xml version='1.0' ?><axldoc />", 32, error);
 4339: 	if (doc == NULL) {
 4340: 		return axl_false;
 4341: 	}
 4342: 	axl_doc_free (doc);
 4343: 
 4344: 	doc = axl_doc_parse ("<?xml      version='1.0'            ?>      <another />", 55, error);
 4345: 	if (doc == NULL) {
 4346: 		return axl_false;
 4347: 	}
 4348: 	
 4349: 	/* release document parsed */
 4350: 	axl_doc_free (doc);
 4351: 
 4352: 	doc = axl_doc_parse ("<?xml    \n   \t \n \r version='1.0' ?>    <doc />", 50, error);
 4353: 	if (doc == NULL) {
 4354: 		return axl_false;
 4355: 	}
 4356: 
 4357: 	/* release document parsed */
 4358: 	axl_doc_free (doc);
 4359: 
 4360: 	doc = axl_doc_parse ("<?xml  version=\"1.0\"        ?>   \r \t \n<another />", 54, error);
 4361: 	if (doc == NULL) {
 4362: 		return axl_false;
 4363: 	}
 4364: 
 4365: 	/* release document parsed */
 4366: 	axl_doc_free (doc);
 4367: 
 4368: 	doc = axl_doc_parse ("<?xml  version=\"1.0\" \t \n \r encoding='utf-8\"   ?> <data />", 63, error);
 4369: 	if (doc == NULL) {
 4370: 		return axl_false;
 4371: 	}
 4372: 
 4373: 	if (strcmp ("utf-8", axl_doc_get_encoding (doc))) {
 4374: 		printf ("ERROR: encoding read from the document differs from the expected (got %s, expected %s)!\n",
 4375: 			axl_doc_get_encoding (doc), "utf-8");
 4376: 		axl_error_new (-1, "ERROR: encoding read from the document differs from the expected!", NULL, error);
 4377: 		return axl_false;
 4378: 	}
 4379: 
 4380: 	/* release document parsed */
 4381: 	axl_doc_free (doc);
 4382: 
 4383: 	doc = axl_doc_parse ("<?xml version='1.0' encoding='utf-8' standalone='yes' ?>  <data/>", 65, error);
 4384: 	if (doc == NULL) {
 4385: 		return axl_false;
 4386: 	}
 4387: 
 4388: 	if (!axl_doc_get_standalone (doc)) {
 4389: 		printf ("ERROR: Expected to receive a true standalone configuration but axl_false was found\n");
 4390: 		return axl_false;
 4391: 	}
 4392: 
 4393: 	/* release document parsed */
 4394: 	axl_doc_free (doc);
 4395: 	
 4396: 
 4397: 	return axl_true;
 4398: }
 4399: 
 4400: /** 
 4401:  * @brief Axl stream boundary checks.
 4402:  * 
 4403:  * 
 4404:  * @return axl_false if the function fails to parse the
 4405:  * document. axl_true if the test was properly executed.
 4406:  */
 4407: axl_bool test_01a (axlError ** error) 
 4408: {
 4409: 	axlStream * stream;
 4410: 	char      * value;
 4411: 	int         chunk_matched = -2;
 4412: 
 4413: 	/* parse the string */
 4414: 	stream = axl_stream_new ("customer", -1, NULL, -1, error);
 4415: 	if (stream == NULL) 
 4416: 		return axl_false;
 4417: 
 4418: 	/* get the value */
 4419: 	value = axl_stream_get_until (stream, NULL, &chunk_matched, axl_true, 2, "[", ".");
 4420: 	if (value != NULL) {
 4421: 		/* free the stream */
 4422: 		axl_stream_free (stream);
 4423: 
 4424: 		/* fill an error */
 4425: 		axl_error_new (-1, "expected to find a null value while parsing content", NULL, error);
 4426: 		
 4427: 		return axl_false;
 4428: 	}
 4429: 
 4430: 	if (chunk_matched != -1) {
 4431: 		/* free the stream */
 4432: 		axl_stream_free (stream);
 4433: 
 4434: 		/* fill an error */
 4435: 		axl_error_new (-1, "expected to chunk matched value equal to -1", NULL, error);
 4436: 		
 4437: 		return axl_false;
 4438: 	}
 4439: 
 4440: 	/* parse the stream using zero support */
 4441: 
 4442: 	/* get the value */
 4443: 	value = axl_stream_get_until_zero (stream, NULL, &chunk_matched, axl_true, 2, "[", ".");
 4444: 	if (value == NULL) {
 4445: 		/* free the stream */
 4446: 		axl_stream_free (stream);
 4447: 
 4448: 		/* fill an error */
 4449: 		axl_error_new (-1, "expected to find a defined value while parsing content", NULL, error);
 4450: 		
 4451: 		return axl_false;
 4452: 	}
 4453: 
 4454: 	if (chunk_matched != -2) {
 4455: 		/* free the stream */
 4456: 		axl_stream_free (stream);
 4457: 
 4458: 		/* fill an error */
 4459: 		axl_error_new (-1, "expected to chunk matched value equal to -2", NULL, error);
 4460: 		
 4461: 		return axl_false;
 4462: 	}
 4463: 
 4464: 	/* zero string found (in the current stream) */
 4465: 	if (! axl_cmp (value, "customer")) {
 4466: 		printf ("Found values: '%s' != 'customer'\n", value);
 4467: 		
 4468: 		/* fill an error */
 4469: 		axl_error_new (-1, "expected to find a string not found", NULL, error);
 4470: 
 4471: 		return axl_false;
 4472: 	}
 4473: 
 4474: 	/* free the stream */
 4475: 	axl_stream_free (stream);
 4476: 
 4477: 	/* parse the string */
 4478: 	stream = axl_stream_new ("customer", -1, NULL, -1, error);
 4479: 	if (stream == NULL) 
 4480: 		return axl_false;
 4481: 
 4482: 	axl_stream_push (stream, "provider ", 9);
 4483: 	if (! (axl_stream_peek (stream, "provider", 8) > 0)) {
 4484: 		axl_error_new (-1, "failed to check expected input at the stream after push operation", NULL, error);
 4485: 		return axl_false;
 4486: 	} /* end if */
 4487: 
 4488: 	if (axl_stream_get_size (stream) != 17) {
 4489: 		axl_error_new (-1, "Found unexpected stream buffer size, while expecting 17", NULL, error);
 4490: 		return axl_false;
 4491: 	} /* end if */
 4492: 
 4493: 	axl_stream_inspect (stream, "pro", 3);
 4494: 
 4495: 	if (! (axl_stream_inspect (stream, "vider ", 6) > 0)) {
 4496: 		axl_error_new (-1, "Expected to find an string value.. ('vider ') not found", NULL, error);
 4497: 		return axl_false;
 4498: 	} /* end if */
 4499: 
 4500: 	axl_stream_free (stream);
 4501: 
 4502: 	return axl_true;
 4503: }
 4504: 
 4505: 
 4506: 
 4507: 
 4508: axl_bool test_01b_show_node_found (axlNode * node,
 4509: 			       axlNode * parent,
 4510: 			       axlDoc  * doc,
 4511: 			       axl_bool    * was_removed,
 4512: 			       axlPointer ptr, 
 4513: 			       axlPointer ptr2)
 4514: {
 4515: 	int * iterator = ptr;
 4516: 
 4517: 	/* show node found  */
 4518: 	switch (*iterator) {
 4519: 	case 0:
 4520: 		/* <document> case */
 4521: 		if (! NODE_CMP_NAME (node, "document")) {
 4522: 
 4523: 			/* fill the error */
 4524: 			axl_error_new (-1, "Expected to find a document node not found <document>", NULL, (axlError **) ptr2);
 4525: 
 4526: 			/* stop iterating */
 4527: 			return axl_false;
 4528: 		}
 4529: 
 4530: 		break;
 4531: 	case 1:
 4532: 		/* <child1> case */
 4533: 		if (! NODE_CMP_NAME (node, "child1")) {
 4534: 			/* fill the error */
 4535: 			axl_error_new (-1, "Expected to find a document node not found <child1>", NULL, (axlError **) ptr2);
 4536: 
 4537: 			/* stop iterating */
 4538: 			return axl_false;
 4539: 		}
 4540: 
 4541: 		if (! NODE_CMP_NAME (parent, "document")) {
 4542: 			/* fill the error */
 4543: 			axl_error_new (-1, "Expected to find parent node <document> for child1", NULL, (axlError **) ptr2);
 4544: 
 4545: 			/* stop iterating */
 4546: 			return axl_false;
 4547: 		}
 4548: 
 4549: 		break;
 4550: 	case 2:
 4551: 		/* <child2> case */
 4552: 		if (! NODE_CMP_NAME (node, "child2")) {
 4553: 			/* fill the error */
 4554: 			axl_error_new (-1, "Expected to find a document node not found <child2>", NULL, (axlError **) ptr2);
 4555: 
 4556: 			/* stop iterating */
 4557: 			return axl_false;
 4558: 		}
 4559: 
 4560: 		if (! NODE_CMP_NAME (parent, "document")) {
 4561: 			/* fill the error */
 4562: 			axl_error_new (-1, "Expected to find parent node <document> for child2", NULL, (axlError **) ptr2);
 4563: 
 4564: 			/* stop iterating */
 4565: 			return axl_false;
 4566: 		}
 4567: 
 4568: 		break;
 4569: 	case 3:
 4570: 		/* <child3> case */
 4571: 		if (! NODE_CMP_NAME (node, "child3")) {
 4572: 			/* fill the error */
 4573: 			axl_error_new (-1, "Expected to find a document node not found <child3>", NULL, (axlError **) ptr2);
 4574: 
 4575: 			/* stop iterating */
 4576: 			return axl_false;
 4577: 		}
 4578: 
 4579: 		if (! NODE_CMP_NAME (parent, "document")) {
 4580: 			/* fill the error */
 4581: 			axl_error_new (-1, "Expected to find parent node <document> for child3", NULL, (axlError **) ptr2);
 4582: 
 4583: 			/* stop iterating */
 4584: 			return axl_false;
 4585: 		}
 4586: 
 4587: 		break;
 4588: 	case 4:
 4589: 		/* <a> case */
 4590: 		if (! NODE_CMP_NAME (node, "a")) {
 4591: 			/* fill the error */
 4592: 			axl_error_new (-1, "Expected to find a document node not found <a>", NULL, (axlError **) ptr2);
 4593: 
 4594: 			/* stop iterating */
 4595: 			return axl_false;
 4596: 		}
 4597: 
 4598: 		if (! NODE_CMP_NAME (parent, "child3")) {
 4599: 			/* fill the error */
 4600: 			axl_error_new (-1, "Expected to find parent node <child3> for a", NULL, (axlError **) ptr2);
 4601: 
 4602: 			/* stop iterating */
 4603: 			return axl_false;
 4604: 		}
 4605: 
 4606: 		break;
 4607: 	case 5:
 4608: 		/* <b> case */
 4609: 		if (! NODE_CMP_NAME (node, "b")) {
 4610: 			/* fill the error */
 4611: 			axl_error_new (-1, "Expected to find a document node not found <b>", NULL, (axlError **) ptr2);
 4612: 
 4613: 			/* stop iterating */
 4614: 			return axl_false;
 4615: 		}
 4616: 
 4617: 		if (! NODE_CMP_NAME (parent, "child3")) {
 4618: 			/* fill the error */
 4619: 			axl_error_new (-1, "Expected to find parent node <child3> for b", NULL, (axlError **) ptr2);
 4620: 
 4621: 			/* stop iterating */
 4622: 			return axl_false;
 4623: 		}
 4624: 
 4625: 		break;
 4626: 	case 6:
 4627: 		/* <c> case */
 4628: 		if (! NODE_CMP_NAME (node, "c")) {
 4629: 			/* fill the error */
 4630: 			axl_error_new (-1, "Expected to find a document node not found <c>", NULL, (axlError **) ptr2);
 4631: 
 4632: 			/* stop iterating */
 4633: 			return axl_false;
 4634: 		}
 4635: 
 4636: 		if (! NODE_CMP_NAME (parent, "child3")) {
 4637: 			/* fill the error */
 4638: 			axl_error_new (-1, "Expected to find parent node <child3> for c", NULL, (axlError **) ptr2);
 4639: 
 4640: 			/* stop iterating */
 4641: 			return axl_false;
 4642: 		}
 4643: 
 4644: 		break;
 4645: 	case 7:
 4646: 		/* <d> case */
 4647: 		if (! NODE_CMP_NAME (node, "d")) {
 4648: 			/* fill the error */
 4649: 			axl_error_new (-1, "Expected to find a document node not found <d>", NULL, (axlError **) ptr2);
 4650: 
 4651: 			/* stop iterating */
 4652: 			return axl_false;
 4653: 		}
 4654: 
 4655: 		if (! NODE_CMP_NAME (parent, "c")) {
 4656: 			/* fill the error */
 4657: 			axl_error_new (-1, "Expected to find parent node <c> for d", NULL, (axlError **) ptr2);
 4658: 
 4659: 			/* stop iterating */
 4660: 			return axl_false;
 4661: 		}
 4662: 
 4663: 		break;
 4664: 	case 8:
 4665: 		/* <e> case */
 4666: 		if (! NODE_CMP_NAME (node, "e")) {
 4667: 			/* fill the error */
 4668: 			axl_error_new (-1, "Expected to find a document node not found <e>", NULL, (axlError **) ptr2);
 4669: 
 4670: 			/* stop iterating */
 4671: 			return axl_false;
 4672: 		}
 4673: 
 4674: 		if (! NODE_CMP_NAME (parent, "c")) {
 4675: 			/* fill the error */
 4676: 			axl_error_new (-1, "Expected to find parent node <c> for e", NULL, (axlError **) ptr2);
 4677: 
 4678: 			/* stop iterating */
 4679: 			return axl_false;
 4680: 		}
 4681: 
 4682: 		break;
 4683: 	case 9:
 4684: 		/* <e> case */
 4685: 		if (! NODE_CMP_NAME (node, "f")) {
 4686: 			/* fill the error */
 4687: 			axl_error_new (-1, "Expected to find a document node not found <f>", NULL, (axlError **) ptr2);
 4688: 
 4689: 			/* stop iterating */
 4690: 			return axl_false;
 4691: 		}
 4692: 
 4693: 		if (! NODE_CMP_NAME (parent, "child3")) {
 4694: 			/* fill the error */
 4695: 			axl_error_new (-1, "Expected to find parent node <child3> for f", NULL, (axlError **) ptr2);
 4696: 
 4697: 			/* stop iterating */
 4698: 			return axl_false;
 4699: 		}
 4700: 
 4701: 		break;
 4702: 	case 10:
 4703: 		/* <g> case */
 4704: 		if (! NODE_CMP_NAME (node, "g")) {
 4705: 			/* fill the error */
 4706: 			axl_error_new (-1, "Expected to find a document node not found <g>", NULL, (axlError **) ptr2);
 4707: 
 4708: 			/* stop iterating */
 4709: 			return axl_false;
 4710: 		}
 4711: 
 4712: 		if (! NODE_CMP_NAME (parent, "child3")) {
 4713: 			/* fill the error */
 4714: 			axl_error_new (-1, "Expected to find parent node <chile3> for g", NULL, (axlError **) ptr2);
 4715: 
 4716: 			/* stop iterating */
 4717: 			return axl_false;
 4718: 		}
 4719: 
 4720: 		break;
 4721: 	case 11:
 4722: 		/* <child4> case */
 4723: 		if (! NODE_CMP_NAME (node, "child4")) {
 4724: 			/* fill the error */
 4725: 			axl_error_new (-1, "Expected to find a document node not found <child4>", NULL, (axlError **) ptr2);
 4726: 
 4727: 			/* stop iterating */
 4728: 			return axl_false;
 4729: 		}
 4730: 
 4731: 		if (! NODE_CMP_NAME (parent, "document")) {
 4732: 			/* fill the error */
 4733: 			axl_error_new (-1, "Expected to find parent node <document> for child4", NULL, (axlError **) ptr2);
 4734: 
 4735: 			/* stop iterating */
 4736: 			return axl_false;
 4737: 		}
 4738: 		break;
 4739: 	case 12:
 4740: 		/* <child5> case */
 4741: 		if (! NODE_CMP_NAME (node, "child5")) {
 4742: 			/* fill the error */
 4743: 			axl_error_new (-1, "Expected to find a document node not found <child5>", NULL, (axlError **) ptr2);
 4744: 
 4745: 			/* stop iterating */
 4746: 			return axl_false;
 4747: 		}
 4748: 
 4749: 		if (! NODE_CMP_NAME (parent, "document")) {
 4750: 			/* fill the error */
 4751: 			axl_error_new (-1, "Expected to find parent node <document> for child4", NULL, (axlError **) ptr2);
 4752: 
 4753: 			/* stop iterating */
 4754: 			return axl_false;
 4755: 		}
 4756: 
 4757: 		break;
 4758: 	}
 4759: 
 4760: 	/* update count */
 4761: 	(*iterator)++;
 4762: 
 4763: 	/* keep iterating */
 4764: 	return axl_true;
 4765: }
 4766: 
 4767: 
 4768: axl_bool test_01b_show_node_found2 (axlNode * node, 
 4769: 				axlNode * parent,
 4770: 				axlDoc  * doc,  
 4771: 				axl_bool    * was_removed,
 4772: 				axlPointer ptr, axlPointer ptr2)
 4773: {
 4774: 	int * iterator = ptr;
 4775: 
 4776: 	/* show node found  */
 4777: 	switch (*iterator) {
 4778: 	case 0:
 4779: 		/* <document> case */
 4780: 		if (! NODE_CMP_NAME (node, "document")) {
 4781: 			/* fill the error */
 4782: 			axl_error_new (-1, "Expected to find a document node not found <document>", NULL, (axlError **) ptr2);
 4783: 
 4784: 			/* stop iterating */
 4785: 			return axl_false;
 4786: 		}
 4787: 		break;
 4788: 	case 1:
 4789: 		/* <child1> case */
 4790: 		if (! NODE_CMP_NAME (node, "child1")) {
 4791: 			/* fill the error */
 4792: 			axl_error_new (-1, "Expected to find a document node not found <child1>", NULL, (axlError **) ptr2);
 4793: 
 4794: 			/* stop iterating */
 4795: 			return axl_false;
 4796: 		}
 4797: 		break;
 4798: 	case 2:
 4799: 		/* <child2> case */
 4800: 		if (! NODE_CMP_NAME (node, "child2")) {
 4801: 			/* fill the error */
 4802: 			axl_error_new (-1, "Expected to find a document node not found <child2>", NULL, (axlError **) ptr2);
 4803: 
 4804: 			/* stop iterating */
 4805: 			return axl_false;
 4806: 		}
 4807: 		break;
 4808: 	case 3:
 4809: 		/* <child3> case */
 4810: 		if (! NODE_CMP_NAME (node, "child3")) {
 4811: 			/* fill the error */
 4812: 			axl_error_new (-1, "Expected to find a document node not found <child3>", NULL, (axlError **) ptr2);
 4813: 
 4814: 			/* stop iterating */
 4815: 			return axl_false;
 4816: 		}
 4817: 		break;
 4818: 	case 4:
 4819: 		/* <child4> case */
 4820: 		if (! NODE_CMP_NAME (node, "child4")) {
 4821: 			/* fill the error */
 4822: 			axl_error_new (-1, "Expected to find a document node not found <child4>", NULL, (axlError **) ptr2);
 4823: 
 4824: 			/* stop iterating */
 4825: 			return axl_false;
 4826: 		}
 4827: 		break;
 4828: 	case 5:
 4829: 		/* <child5> case */
 4830: 		if (! NODE_CMP_NAME (node, "child5")) {
 4831: 			/* fill the error */
 4832: 			axl_error_new (-1, "Expected to find a document node not found <child5>", NULL, (axlError **) ptr2);
 4833: 
 4834: 			/* stop iterating */
 4835: 			return axl_false;
 4836: 		}
 4837: 		break;
 4838: 	case 6:
 4839: 		/* <a> case */
 4840: 		if (! NODE_CMP_NAME (node, "a")) {
 4841: 			/* fill the error */
 4842: 			axl_error_new (-1, "Expected to find a document node not found <a>", NULL, (axlError **) ptr2);
 4843: 
 4844: 			/* stop iterating */
 4845: 			return axl_false;
 4846: 		}
 4847: 		break;
 4848: 	case 7:
 4849: 		/* <b> case */
 4850: 		if (! NODE_CMP_NAME (node, "b")) {
 4851: 			/* fill the error */
 4852: 			axl_error_new (-1, "Expected to find a document node not found <b>", NULL, (axlError **) ptr2);
 4853: 
 4854: 			/* stop iterating */
 4855: 			return axl_false;
 4856: 		}
 4857: 		break;
 4858: 	case 8:
 4859: 		/* <c> case */
 4860: 		if (! NODE_CMP_NAME (node, "c")) {
 4861: 			/* fill the error */
 4862: 			axl_error_new (-1, "Expected to find a document node not found <c>", NULL, (axlError **) ptr2);
 4863: 
 4864: 			/* stop iterating */
 4865: 			return axl_false;
 4866: 		}
 4867: 		break;
 4868: 	case 9:
 4869: 		/* <f> case */
 4870: 		if (! NODE_CMP_NAME (node, "f")) {
 4871: 			/* fill the error */
 4872: 			axl_error_new (-1, "Expected to find a document node not found <f>", NULL, (axlError **) ptr2);
 4873: 
 4874: 			/* stop iterating */
 4875: 			return axl_false;
 4876: 		}
 4877: 		break;
 4878: 	case 10:
 4879: 		/* <g> case */
 4880: 		if (! NODE_CMP_NAME (node, "g")) {
 4881: 			/* fill the error */
 4882: 			axl_error_new (-1, "Expected to find a document node not found <g>", NULL, (axlError **) ptr2);
 4883: 
 4884: 			/* stop iterating */
 4885: 			return axl_false;
 4886: 		}
 4887: 		break;
 4888: 	case 11:
 4889: 		/* <d> case */
 4890: 		if (! NODE_CMP_NAME (node, "d")) {
 4891: 			/* fill the error */
 4892: 			axl_error_new (-1, "Expected to find a document node not found <d>", NULL, (axlError **) ptr2);
 4893: 
 4894: 			/* stop iterating */
 4895: 			return axl_false;
 4896: 		}
 4897: 		break;
 4898: 	case 12:
 4899: 		/* <e> case */
 4900: 		if (! NODE_CMP_NAME (node, "e")) {
 4901: 			/* fill the error */
 4902: 			axl_error_new (-1, "Expected to find a document node not found <e>", NULL, (axlError **) ptr2);
 4903: 
 4904: 			/* stop iterating */
 4905: 			return axl_false;
 4906: 		}
 4907: 		break;
 4908: 	}
 4909: 
 4910: 	/* update count */
 4911: 	(*iterator)++;
 4912: 
 4913: 	/* keep iterating */
 4914: 	return axl_true;
 4915: }
 4916: 
 4917: 
 4918: 
 4919: 
 4920: /** 
 4921:  * @brief Axl stream boundary checks.
 4922:  * 
 4923:  * 
 4924:  * @return axl_false if the function fails to parse the
 4925:  * document. axl_true if the test was properly executed.
 4926:  */
 4927: axl_bool test_01b (axlError ** error)  
 4928: {
 4929: 	axlDoc   * doc;
 4930: 	axlNode  * node;
 4931: 	int        test_01b_id;
 4932: 	
 4933: 	/* parse document */
 4934: 	doc = axl_doc_parse_from_file ("test_01b.xml", error);
 4935: 	if (doc == NULL) 
 4936: 		return axl_false;
 4937: 
 4938: 	/* get document root */
 4939: 	node = axl_doc_get_root (doc);
 4940: 	if (! NODE_CMP_NAME (node, "document")) {
 4941: 		axl_error_new (-1, "Expected to find root <document>, but it wasn't found", NULL, error);
 4942: 		return axl_false;
 4943: 	}
 4944: 
 4945: 	/* get first child node */
 4946: 	node = axl_node_get_first_child (node);
 4947: 	if (! NODE_CMP_NAME (node, "child1")) {
 4948: 		axl_error_new (-1, "Expected to find child node <child1>, but it wasn't found", NULL, error);
 4949: 		return axl_false;
 4950: 	}
 4951: 
 4952: 	/* get sibling node */
 4953: 	node = axl_node_get_next (node);
 4954: 	if (! NODE_CMP_NAME (node, "child2")) {
 4955: 		axl_error_new (-1, "Expected to find child node <child2>, but it wasn't found", NULL, error);
 4956: 		return axl_false;
 4957: 	}
 4958: 
 4959: 	/* now iterate over all nodes inside the document */
 4960: 	test_01b_id = 0;
 4961: 	if (! axl_doc_iterate_full (doc, DEEP_ITERATION, test_01b_show_node_found, &test_01b_id, error))
 4962: 		return axl_false;
 4963: 
 4964: 	/* now iterate over all nodes inside (wide mode) the document */
 4965: 	test_01b_id = 0;
 4966: 	if (! axl_doc_iterate_full (doc, WIDE_ITERATION, test_01b_show_node_found2, &test_01b_id, error))
 4967: 		return axl_false; 
 4968: 
 4969: 	/* test ok */
 4970: 	axl_doc_free (doc);
 4971: 	return axl_true;
 4972: }
 4973: 
 4974: /** 
 4975:  * @brief Axl stream boundary checks.
 4976:  * 
 4977:  * 
 4978:  * @return axl_false if the function fails to parse the
 4979:  * document. axl_true if the test was properly executed.
 4980:  */
 4981: axl_bool test_01c (axlError ** error)  
 4982: {
 4983: 	axlDoc   * doc;
 4984: 	axlNode  * node;
 4985: 	axlNode  * parent;
 4986: 	
 4987: 	/* parse document (uses the same xml document as test_01b) */
 4988: 	doc = axl_doc_parse_from_file ("test_01b.xml", error);
 4989: 	if (doc == NULL) 
 4990: 		return axl_false;
 4991: 
 4992: 	/* get document root */
 4993: 	node = axl_doc_get_root (doc);
 4994: 	if (! NODE_CMP_NAME (node, "document")) {
 4995: 		axl_error_new (-1, "Expected to find root <document>, but it wasn't found", NULL, error);
 4996: 		return axl_false;
 4997: 	}
 4998: 
 4999: 	/* get first child */
 5000: 	node = axl_node_get_first_child (node);
 5001: 	
 5002: 	if (! NODE_CMP_NAME (node, "child1")) {
 5003: 		axl_error_new (-1, "Expected to find <child1>, but it wasn't found", NULL, error);
 5004: 		return axl_false;
 5005: 	}
 5006: 
 5007: 	/* check parent */
 5008: 	parent = axl_node_get_parent (node);
 5009: 	if (! NODE_CMP_NAME (parent, "document")) {
 5010: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5011: 		return axl_false;
 5012: 	}
 5013: 	
 5014: 	node = axl_node_get_next (node);
 5015: 	if (! NODE_CMP_NAME (node, "child2")) {
 5016: 		axl_error_new (-1, "Expected to find <child2>, but it wasn't found", NULL, error);
 5017: 		return axl_false;
 5018: 	}
 5019: 
 5020: 	/* check parent */
 5021: 	parent = axl_node_get_parent (node);
 5022: 	if (! NODE_CMP_NAME (parent, "document")) {
 5023: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5024: 		return axl_false;
 5025: 	}
 5026: 
 5027: 	node = axl_node_get_next (node);
 5028: 	if (! NODE_CMP_NAME (node, "child3")) {
 5029: 		axl_error_new (-1, "Expected to find <child3>, but it wasn't found", NULL, error);
 5030: 		return axl_false;
 5031: 	}
 5032: 	/* check parent */
 5033: 	parent = axl_node_get_parent (node);
 5034: 	if (! NODE_CMP_NAME (parent, "document")) {
 5035: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5036: 		return axl_false;
 5037: 	}
 5038: 
 5039: 	node = axl_node_get_next (node);
 5040: 	if (! NODE_CMP_NAME (node, "child4")) {
 5041: 		axl_error_new (-1, "Expected to find <child4>, but it wasn't found", NULL, error);
 5042: 		return axl_false;
 5043: 	}
 5044: 	/* check parent */
 5045: 	parent = axl_node_get_parent (node);
 5046: 	if (! NODE_CMP_NAME (parent, "document")) {
 5047: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5048: 		return axl_false;
 5049: 	}
 5050: 
 5051: 	node = axl_node_get_next (node);
 5052: 	if (! NODE_CMP_NAME (node, "child5")) {
 5053: 		axl_error_new (-1, "Expected to find <child5>, but it wasn't found", NULL, error);
 5054: 		return axl_false;
 5055: 	}
 5056: 	/* check parent */
 5057: 	parent = axl_node_get_parent (node);
 5058: 	if (! NODE_CMP_NAME (parent, "document")) {
 5059: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5060: 		return axl_false;
 5061: 	}
 5062: 
 5063: 	if (axl_node_get_next (node) != NULL) {
 5064: 		axl_error_new (-1, "Expected to find NULL value while calling to axl_node_get_next, but it wasn't found", NULL, error);
 5065: 		return axl_false;
 5066: 	}
 5067: 
 5068: 	node = axl_node_get_previous (node);
 5069: 	if (! NODE_CMP_NAME (node, "child4")) {
 5070: 		axl_error_new (-1, "Expected to find <child4>, but it wasn't found", NULL, error);
 5071: 		return axl_false;
 5072: 	}
 5073: 	/* check parent */
 5074: 	if (! NODE_CMP_NAME (parent, "document")) {
 5075: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5076: 		return axl_false;
 5077: 	}
 5078: 
 5079: 	node = axl_node_get_previous (node);
 5080: 	if (! NODE_CMP_NAME (node, "child3")) {
 5081: 		axl_error_new (-1, "Expected to find <child3>, but it wasn't found", NULL, error);
 5082: 		return axl_false;
 5083: 	}
 5084: 	/* check parent */
 5085: 	if (! NODE_CMP_NAME (parent, "document")) {
 5086: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5087: 		return axl_false;
 5088: 	}
 5089: 
 5090: 	node = axl_node_get_previous (node);
 5091: 	if (! NODE_CMP_NAME (node, "child2")) {
 5092: 		axl_error_new (-1, "Expected to find <child2>, but it wasn't found", NULL, error);
 5093: 		return axl_false;
 5094: 	}
 5095: 	/* check parent */
 5096:  	if (! NODE_CMP_NAME (parent, "document")) {
 5097: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5098: 		return axl_false;
 5099: 	}
 5100: 
 5101: 	node = axl_node_get_previous (node);
 5102: 	if (! NODE_CMP_NAME (node, "child1")) {
 5103: 		axl_error_new (-1, "Expected to find <child1>, but it wasn't found", NULL, error);
 5104: 		return axl_false;
 5105: 	}
 5106: 	/* check parent */
 5107: 	parent = axl_node_get_parent (node);
 5108: 	if (! NODE_CMP_NAME (parent, "document")) {
 5109: 		axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
 5110: 		return axl_false;
 5111: 	}
 5112: 
 5113: 	if (axl_node_get_previous (node) != NULL) {
 5114: 		axl_error_new (-1, "Expected to find NULL value while calling to axl_node_get_next, but it wasn't found", NULL, error);
 5115: 		return axl_false;
 5116: 	}
 5117: 
 5118: 	/* check next called and previous called api */
 5119: 	node = axl_doc_get_root (doc);
 5120: 	node = axl_node_get_first_child (node);
 5121: 	
 5122: 
 5123: 	/* get <child5> */
 5124: 	node = axl_node_get_next_called (node, "child5");
 5125: 	if (! NODE_CMP_NAME (node, "child5")) {
 5126: 		axl_error_new (-1, "Expected to find <child5> node while calling to axl_node_get_next_called, but it wasn't found", NULL, error);
 5127: 		return axl_false;
 5128: 	}
 5129: 	
 5130: 	/* check next empty */
 5131: 	if (axl_node_get_next_called (node, "child5") != NULL) {
 5132: 		axl_error_new (-1, "Expected to find empty node following to <child5> node while calling to axl_node_get_next_called, but it was found", NULL, error);
 5133: 		return axl_false;
 5134: 	}
 5135: 
 5136: 	/* get <child1> */
 5137: 	node = axl_node_get_previous_called (node, "child1");
 5138: 	if (! NODE_CMP_NAME (node, "child1")) {
 5139: 		axl_error_new (-1, "Expected to find <child1> node while calling to axl_node_get_previous_called, but it wasn't found", NULL, error);
 5140: 		return axl_false;
 5141: 	}
 5142: 
 5143: 	/* check next empty */
 5144: 	if (axl_node_get_previous_called (node, "child1") != NULL) {
 5145: 		axl_error_new (-1, "Expected to find empty node following to <child1> node while calling to axl_node_get_previous_called, but it was found", NULL, error);
 5146: 		return axl_false;
 5147: 	}
 5148: 
 5149: 	/* free document */
 5150: 	axl_doc_free (doc);
 5151: 
 5152: 	return axl_true;
 5153: }
 5154: 
 5155: /** 
 5156:  * @brief Axl node nth access.
 5157:  * 
 5158:  * @return axl_false if the function fails to parse the
 5159:  * document. axl_true if the test was properly executed.
 5160:  */
 5161: axl_bool test_01d (axlError ** error)  
 5162: {
 5163: 	axlDoc   * doc;
 5164: 	axlNode  * node;
 5165: 	axlNode  * child;
 5166: 	
 5167: 	/* parse document */
 5168: 	doc = axl_doc_parse_from_file ("test_01d.xml", error);
 5169: 	if (doc == NULL) 
 5170: 		return axl_false;
 5171: 
 5172: 	/* get document root */
 5173: 	node = axl_doc_get_root (doc);
 5174: 	
 5175: 	/* get the node at the 0 position */
 5176: 	child = axl_node_get_child_nth (node, 0);
 5177: 	if (! NODE_CMP_NAME (child, "child1")) {
 5178: 		axl_error_new (-1, "Expected to find node <child1> at 0, but it wasn't found", NULL, error);
 5179: 		return axl_false;
 5180: 	}
 5181: 
 5182: 	/* get the node at the 1 position */
 5183: 	child = axl_node_get_child_nth (node, 1);
 5184: 	if (! NODE_CMP_NAME (child, "child2")) {
 5185: 		axl_error_new (-1, "Expected to find node <child2> at 1, but it wasn't found", NULL, error);
 5186: 		return axl_false;
 5187: 	}
 5188: 
 5189: 	/* get the node at the 2 position */
 5190: 	child = axl_node_get_child_nth (node, 2);
 5191: 	if (! NODE_CMP_NAME (child, "child3")) {
 5192: 		axl_error_new (-1, "Expected to find node <child3> at 2, but it wasn't found", NULL, error);
 5193: 		return axl_false;
 5194: 	}
 5195: 
 5196: 	/* get the node at the 3 position */
 5197: 	child = axl_node_get_child_nth (node, 3);
 5198: 	if (! NODE_CMP_NAME (child, "child4")) {
 5199: 		axl_error_new (-1, "Expected to find node <child4> at 3, but it wasn't found", NULL, error);
 5200: 		return axl_false;
 5201: 	}
 5202: 
 5203: 	/* get the node at the 4 position */
 5204: 	child = axl_node_get_child_nth (node, 4);
 5205: 	if (! NODE_CMP_NAME (child, "child5")) {
 5206: 		axl_error_new (-1, "Expected to find node <child5> at 4, but it wasn't found", NULL, error);
 5207: 		return axl_false;
 5208: 	}
 5209: 
 5210: 	/* now with <child3> childs *> */
 5211: 	node = axl_node_get_child_nth (node, 2);
 5212: 	
 5213: 	/* get the node at the 0 position */
 5214: 	child = axl_node_get_child_nth (node, 0);
 5215: 	if (! NODE_CMP_NAME (child, "a")) {
 5216: 		axl_error_new (-1, "Expected to find node <a> at 0, but it wasn't found", NULL, error);
 5217: 		return axl_false;
 5218: 	}
 5219: 
 5220: 	/* get the node at the 1 position */
 5221: 	child = axl_node_get_child_nth (node, 1);
 5222: 	if (! NODE_CMP_NAME (child, "b")) {
 5223: 		axl_error_new (-1, "Expected to find node <b> at 1, but it wasn't found", NULL, error);
 5224: 		return axl_false;
 5225: 	}
 5226: 	   
 5227: 	/* get the node at the 2 position */
 5228: 	child = axl_node_get_child_nth (node, 2);
 5229: 	if (! NODE_CMP_NAME (child, "c")) {
 5230: 		axl_error_new (-1, "Expected to find node <c> at 2, but it wasn't found", NULL, error);
 5231: 		return axl_false;
 5232: 	}
 5233: 
 5234: 	/* get the node at the 3 position */
 5235: 	child = axl_node_get_child_nth (node, 3);
 5236: 	if (! NODE_CMP_NAME (child, "f")) {
 5237: 		axl_error_new (-1, "Expected to find node <f> at 3, but it wasn't found", NULL, error);
 5238: 		return axl_false;
 5239: 	}
 5240: 
 5241: 	/* get the node at the 4 position */
 5242: 	child = axl_node_get_child_nth (node, 4);
 5243: 	if (! NODE_CMP_NAME (child, "g")) {
 5244: 		axl_error_new (-1, "Expected to find node <g> at 4, but it wasn't found", NULL, error);
 5245: 		return axl_false;
 5246: 	}
 5247: 
 5248: 	/* test ok */
 5249: 	axl_doc_free (doc);
 5250: 	return axl_true;
 5251: }
 5252: 
 5253: /** 
 5254:  * @brief Check parsing document with huge node content.
 5255:  * 
 5256:  * @return axl_false if the function fails to parse the
 5257:  * document. axl_true if the test was properly executed.
 5258:  */
 5259: axl_bool test_01e (axlError ** error)  
 5260: {
 5261: 	axlDoc         * doc;
 5262: 	axlNode        * node;
 5263: 	int              size;
 5264: 	
 5265: 	/* parse document */
 5266: 	doc = axl_doc_parse_from_file ("test_01e.xml", error);
 5267: 	if (doc == NULL) 
 5268: 		return axl_false;
 5269: 	
 5270: 	/* get root node */
 5271: 	node    = axl_doc_get_root (doc);
 5272: 	if (! axl_node_get_content (node, &size))
 5273: 		return axl_false;
 5274: 	
 5275: 	/* free document */
 5276: 	axl_doc_free (doc);
 5277: 
 5278: 	return axl_true;
 5279: } 
 5280: 
 5281: /** 
 5282:  * @brief Check parsing document xml:space attribute.
 5283:  * 
 5284:  * @return axl_false if the function fails to parse the document. axl_true if
 5285:  * the test was properly executed.
 5286:  */
 5287: axl_bool test_01f (axlError ** error)  
 5288: {
 5289: 	axlDoc         * doc;
 5290: 	axlNode        * node;
 5291: 	const char     * content;
 5292: 	int              size;
 5293: 	
 5294: 	/* parse document */
 5295: 	doc = axl_doc_parse_from_file ("test_01f.xml", error);
 5296: 	if (doc == NULL) 
 5297: 		return axl_false;
 5298: 	
 5299: 	/* get root node */
 5300: 	node    = axl_doc_get_root (doc);
 5301: 	content = axl_node_get_content (node, &size);
 5302: 
 5303: 	if (! axl_cmp (content, "     ")) {
 5304: 		printf ("found content '%s' but expected '%s'...\n", content, "     ");
 5305: 		axl_error_new (-1, "Expected to find content not found", NULL, error);
 5306: 		axl_free (doc);
 5307: 		return axl_false;
 5308: 	}
 5309: 	
 5310: 	/* free document */
 5311: 	axl_doc_free (doc);
 5312: 
 5313: 	/* parse document */
 5314: 	doc = axl_doc_parse_from_file ("test_01f2.xml", error);
 5315: 	if (doc == NULL) 
 5316: 		return axl_false;
 5317: 	
 5318: 	/* get node <content/id> */
 5319: 	node    = axl_doc_get_root (doc);
 5320: 	node    = axl_node_get_child_called (node, "id");
 5321: 	content = axl_node_get_content (node, &size);
 5322: 
 5323: 	if (! axl_cmp (content, "   ")) {
 5324: 		printf ("found content '%s' but expected '%s'...\n", content, "   ");
 5325: 		axl_error_new (-1, "Expected to find content not found", NULL, error);
 5326: 		axl_free (doc);
 5327: 		return axl_false;
 5328: 	}
 5329: 
 5330: 	/* get node <content/id2> */
 5331: 	node    = axl_doc_get_root (doc);
 5332: 	node    = axl_node_get_child_called (node, "id2");
 5333: 	content = axl_node_get_content (node, &size);
 5334: 
 5335: 	if (! axl_cmp (content, "")) {
 5336: 		printf ("found content '%s' but expected '%s'...\n", content, "");
 5337: 		axl_error_new (-1, "Expected to find content not found", NULL, error);
 5338: 		axl_free (doc);
 5339: 		return axl_false;
 5340: 	}
 5341: 	
 5342: 	/* free document */
 5343: 	axl_doc_free (doc);
 5344: 
 5345: 	return axl_true;
 5346: } 
 5347: 
 5348: /** 
 5349:  * @brief Test current libaxl list implementation.
 5350:  * 
 5351:  * 
 5352:  * @return axl_true if it works properly or axl_false if not.
 5353:  */
 5354: axl_bool test_01_01 (void) 
 5355: {
 5356: 	axlList * list;
 5357: 	int        value;
 5358: 
 5359: 	axlPointer ptr1;
 5360: 	axlPointer ptr2;
 5361: 	axlPointer ptr3;
 5362: 	axlPointer ptr4;
 5363: 
 5364: 	/* create the list */
 5365: 	list = axl_list_new (axl_list_equal_string, NULL);
 5366: 	if (axl_list_length (list) != 0) {
 5367: 		printf ("Bad length returned by the list (%d != 0)\n",
 5368: 			axl_list_length (list));
 5369: 		return axl_false;
 5370: 	}
 5371: 
 5372: 	if (! axl_list_is_empty (list)) {
 5373: 		printf ("Expected to find empty list just after list created\n");
 5374: 		return axl_false;
 5375: 	} /* end if */
 5376: 	
 5377: 	/* add data */
 5378: 	axl_list_add (list, "test 1");
 5379: 	if (axl_list_length (list) != 1) {
 5380: 		printf ("Bad length returned by the list (%d != 1)\n",
 5381: 			axl_list_length (list));
 5382: 		return axl_false;
 5383: 	}
 5384: 
 5385: 	if (axl_list_is_empty (list)) {
 5386: 		printf ("Expected to find a non-empty list just after items added\n");
 5387: 		return axl_false;
 5388: 	} /* end if */
 5389: 	
 5390: 	axl_list_add (list, "test 2");
 5391: 	if (axl_list_length (list) != 2) {
 5392: 		printf ("Bad length returned by the list (%d != 2)\n",
 5393: 			axl_list_length (list));
 5394: 		return axl_false;
 5395: 	}
 5396: 
 5397: 	axl_list_add (list, "test 3");
 5398: 	if (axl_list_length (list) != 3) {
 5399: 		printf ("Bad length returned by the list (%d != 3)\n",
 5400: 			axl_list_length (list));
 5401: 		return axl_false;
 5402: 	}
 5403: 
 5404: 	/* remove data */
 5405: 	axl_list_remove (list, "test 1");
 5406: 	if (axl_list_length (list) != 2) {
 5407: 		printf ("Bad length returned by the list, seems that remove doesn't work (%d != 2)\n",
 5408: 			axl_list_length (list));
 5409: 		return axl_false;
 5410: 	}
 5411: 
 5412: 	axl_list_remove (list, "test 2");
 5413: 	if (axl_list_length (list) != 1) {
 5414: 		printf ("Bad length returned by the list, seems that remove doesn't work\n");
 5415: 		return axl_false;
 5416: 	}
 5417: 
 5418: 	axl_list_remove (list, "test 3");
 5419: 	if (axl_list_length (list) != 0) {
 5420: 		printf ("Bad length returned by the list, seems that remove doesn't work\n");
 5421: 		return axl_false;
 5422: 	}
 5423: 
 5424: 	/* add data again */
 5425: 	axl_list_add (list, "test 4");
 5426: 	axl_list_add (list, "test 5");
 5427: 	if (axl_list_length (list) != 2) {
 5428: 		printf ("Bad length returned by the list, seems that remove doesn't work\n");
 5429: 		return axl_false;
 5430: 	}
 5431: 	
 5432: 	axl_list_remove (list, "test 1");
 5433: 	if (axl_list_length (list) != 2) {
 5434: 		printf ("Bad length returned by the list, seems that remove doesn't work\n");
 5435: 		return axl_false;
 5436: 	}
 5437: 
 5438: 	if (! axl_list_exists (list, "test 5")) {
 5439: 		printf ("Exist function have failed\n");
 5440: 		return axl_false;
 5441: 	}
 5442: 
 5443: 	if (! axl_list_exists (list, "test 4")) {
 5444: 		printf ("Exist function have failed\n");
 5445: 		return axl_false;
 5446: 	}
 5447: 	
 5448: 	if (axl_list_exists (list, "test 1")) {
 5449: 		printf ("Exist function have failed\n");
 5450: 		return axl_false;
 5451: 	}
 5452: 
 5453: 	if (! axl_list_exists_at (list, "test 4", 0)) {
 5454: 		printf ("\"Exists at\" functionality seems to not work (0)\n");
 5455: 		return axl_false;
 5456: 	}
 5457: 
 5458: 	if (! axl_list_exists_at (list, "test 5", 1)) {
 5459: 		printf ("\"Exists at\" functionality seems to not work (1)\n");
 5460: 		return axl_false;
 5461: 	}
 5462: 
 5463: 	axl_list_free (list);
 5464: 
 5465: 	/* create a new list */
 5466: 	list = axl_list_new (axl_list_equal_string, NULL);
 5467: 
 5468: 	axl_list_add (list, "test 1");
 5469: 	axl_list_add (list, "test 3");
 5470: 	axl_list_add (list, "test 5");
 5471: 
 5472: 	axl_list_add_at (list, "test 0", 0);
 5473: 	axl_list_add_at (list, "test 2", 2);
 5474: 	axl_list_add_at (list, "test 4", 4);
 5475: 	axl_list_add_at (list, "test 6", 6);
 5476: 
 5477: 	if (! axl_list_exists_at (list, "test 0", 0)) {
 5478: 		printf ("\"Exists at\" functionality seems to not work (0)\n");
 5479: 		return axl_false;
 5480: 	}
 5481: 
 5482: 	if (! axl_list_exists_at (list, "test 1", 1)) {
 5483: 		printf ("\"Exists at\" functionality seems to not work (1)\n");
 5484: 		return axl_false;
 5485: 	}
 5486: 
 5487: 	if (! axl_list_exists_at (list, "test 2", 2)) {
 5488: 		printf ("\"Exists at\" functionality seems to not work (2)\n");
 5489: 		return axl_false;
 5490: 	}
 5491: 
 5492: 	if (! axl_list_exists_at (list, "test 3", 3)) {
 5493: 		printf ("\"Exists at\" functionality seems to not work (3)\n");
 5494: 		return axl_false;
 5495: 	}
 5496: 
 5497: 	if (! axl_list_exists_at (list, "test 4", 4)) {
 5498: 		printf ("\"Exists at\" functionality seems to not work (4)\n");
 5499: 		return axl_false;
 5500: 	}
 5501: 
 5502: 	if (! axl_list_exists_at (list, "test 5", 5)) {
 5503: 		printf ("\"Exists at\" functionality seems to not work (5)\n");
 5504: 		return axl_false;
 5505: 	}
 5506: 
 5507: 	if (! axl_list_exists_at (list, "test 6", 6)) {
 5508: 		printf ("\"Exists at\" functionality seems to not work (6)\n");
 5509: 		return axl_false;
 5510: 	}
 5511: 
 5512: 	/* free the list */
 5513: 	axl_list_free (list);
 5514: 
 5515: 	/* create an integer list */
 5516: 	list = axl_list_new (axl_list_equal_int, NULL);
 5517: 	axl_list_add (list, INT_TO_PTR (1));
 5518: 	axl_list_add (list, INT_TO_PTR (3));
 5519: 	axl_list_add (list, INT_TO_PTR (3900));
 5520: 	axl_list_add (list, INT_TO_PTR (20230));
 5521: 
 5522: 	if (axl_list_length (list) != 4) {
 5523: 		printf ("Expected to find 4 items inside an integer list");
 5524: 		return axl_false;
 5525: 	}
 5526: 
 5527: 	/* remove one item */
 5528: 	axl_list_remove (list, INT_TO_PTR (1));
 5529: 
 5530: 	if (axl_list_length (list) != 3) {
 5531: 		printf ("Expected to find 3 items inside an integer list");
 5532: 		return axl_false;
 5533: 	}
 5534: 
 5535: 	/* remove one item */
 5536: 	axl_list_remove (list, INT_TO_PTR (1));
 5537: 
 5538: 	if (axl_list_length (list) != 3) {
 5539: 		printf ("Expected to find 3 items inside an integer list");
 5540: 		return axl_false;
 5541: 	}
 5542: 
 5543: 	/* remove one item */
 5544: 	axl_list_remove (list, INT_TO_PTR (3));
 5545: 
 5546: 	if (axl_list_length (list) != 2) {
 5547: 		printf ("Expected to find 2 items inside an integer list");
 5548: 		return axl_false;
 5549: 	}
 5550: 
 5551: 	/* remove one item */
 5552: 	axl_list_remove (list, INT_TO_PTR (3900));
 5553: 
 5554: 	if (axl_list_length (list) != 1) {
 5555: 		printf ("Expected to find 1 items inside an integer list");
 5556: 		return axl_false;
 5557: 	}
 5558: 
 5559: 	/* remove one item */
 5560: 	axl_list_remove (list, INT_TO_PTR (20230));
 5561: 
 5562: 	if (axl_list_length (list) != 0) {
 5563: 		printf ("Expected to find 0 items inside an integer list");
 5564: 		return axl_false;
 5565: 	}
 5566: 	axl_list_free (list);
 5567: 
 5568: 	/* create an integer list */
 5569: 	list = axl_list_new (axl_list_equal_int, NULL);
 5570: 
 5571: 	/* add items */
 5572: 	axl_list_add (list, INT_TO_PTR (8));
 5573: 	axl_list_add (list, INT_TO_PTR (10));
 5574: 	axl_list_add (list, INT_TO_PTR (11));
 5575: 	axl_list_add (list, INT_TO_PTR (12));
 5576: 	axl_list_add (list, INT_TO_PTR (102));
 5577: 	axl_list_add (list, INT_TO_PTR (1123));
 5578: 	axl_list_add (list, INT_TO_PTR (412));
 5579: 	axl_list_add (list, INT_TO_PTR (122));
 5580: 	axl_list_add (list, INT_TO_PTR (148));
 5581: 	axl_list_add (list, INT_TO_PTR (670));
 5582: 	axl_list_add (list, INT_TO_PTR (2));
 5583: 	
 5584: 	if (axl_list_length (list) != 11) {
 5585: 		printf ("Expected to find 11 element, but found: %d\n", axl_list_length (list));
 5586: 		return axl_false;
 5587: 	}
 5588: 
 5589: 	/* remove the third element */
 5590: 	axl_list_remove (list, INT_TO_PTR (11));
 5591: 	
 5592: 	if (axl_list_length (list) != 10) {
 5593: 		printf ("Expected to find 10 element, but found: %d\n", axl_list_length (list));
 5594: 		return axl_false;
 5595: 	}
 5596: 
 5597: 	/* remove the third element */
 5598: 	axl_list_remove (list, INT_TO_PTR (122));
 5599: 	
 5600: 	if (axl_list_length (list) != 9) {
 5601: 		printf ("Expected to find 9 element, but found: %d\n", axl_list_length (list));
 5602: 		return axl_false;
 5603: 	}
 5604: 
 5605: 	/* free the list */
 5606: 	axl_list_free (list);
 5607: 	
 5608: 	list = axl_list_new (axl_list_equal_int, NULL);
 5609: 
 5610: 	axl_list_append (list, INT_TO_PTR (9));
 5611: 	axl_list_append (list, INT_TO_PTR (10));
 5612: 	axl_list_append (list, INT_TO_PTR (8));
 5613: 	axl_list_append (list, INT_TO_PTR (11));
 5614: 	
 5615: 	if (axl_list_length (list) != 4) {
 5616: 		printf ("Expected to find 4 element, but found: %d\n", axl_list_length (list));
 5617: 		return axl_false;
 5618: 	}
 5619: 
 5620: 	/* remove */
 5621: 	axl_list_remove (list, INT_TO_PTR(8));
 5622: 	
 5623: 	if (axl_list_length (list) != 3) {
 5624: 		printf ("Expected to find 3 element, but found: %d\n", axl_list_length (list));
 5625: 		return axl_false;
 5626: 	}
 5627: 	
 5628: 	/* free the list */
 5629: 	axl_list_free (list);
 5630: 
 5631: 	list = axl_list_new (axl_list_equal_int, NULL);
 5632: 
 5633: 	axl_list_append (list, INT_TO_PTR (8));
 5634: 	axl_list_append (list, INT_TO_PTR (10));
 5635: 	axl_list_append (list, INT_TO_PTR (11));
 5636: 	axl_list_append (list, INT_TO_PTR (9));
 5637: 	
 5638: 	if (axl_list_length (list) != 4) {
 5639: 		printf ("Expected to find 4 element, but found: %d\n", axl_list_length (list));
 5640: 		return axl_false;
 5641: 	}
 5642: 
 5643: 	axl_list_remove (list, INT_TO_PTR(10));
 5644: 
 5645: 	if (axl_list_length (list) != 3) {
 5646: 		printf ("Expected to find 3 element, but found: %d\n", axl_list_length (list));
 5647: 		return axl_false;
 5648: 	}
 5649: 
 5650: 	/* free the list */
 5651: 	axl_list_free (list);
 5652: 
 5653: 	list = axl_list_new (axl_list_equal_int, NULL);
 5654: 
 5655: 	axl_list_append (list, INT_TO_PTR (9));
 5656: 	axl_list_append (list, INT_TO_PTR (8));
 5657: 	axl_list_append (list, INT_TO_PTR (10));
 5658: 	axl_list_append (list, INT_TO_PTR (11));
 5659: 	
 5660: 	if (axl_list_length (list) != 4) {
 5661: 		printf ("Expected to find 4 element, but found: %d\n", axl_list_length (list));
 5662: 		return axl_false;
 5663: 	}
 5664: 
 5665: 	/* remove */
 5666: 	axl_list_remove (list, INT_TO_PTR(8));
 5667: 
 5668: 	/* remove */
 5669: 	axl_list_remove (list, INT_TO_PTR(10));
 5670: 
 5671: 	if (axl_list_length (list) != 2) {
 5672: 		printf ("Expected to find 2 element, but found: %d\n", axl_list_length (list));
 5673: 		return axl_false;
 5674: 	}
 5675: 	
 5676: 	/* free the list */
 5677: 	axl_list_free (list);
 5678: 
 5679: 
 5680: 	/* create a list and check remove first/get first */
 5681: 	list = axl_list_new (axl_list_equal_int, NULL);
 5682: 	axl_list_add (list, INT_TO_PTR(1));
 5683: 	axl_list_add (list, INT_TO_PTR(2));
 5684: 	axl_list_add (list, INT_TO_PTR(3));
 5685: 	axl_list_add (list, INT_TO_PTR(4));
 5686: 	axl_list_add (list, INT_TO_PTR(5));
 5687: 	axl_list_add (list, INT_TO_PTR(6));
 5688: 	axl_list_add (list, INT_TO_PTR(7));
 5689: 	axl_list_add (list, INT_TO_PTR(8));
 5690: 	axl_list_add (list, INT_TO_PTR(9));
 5691: 	axl_list_add (list, INT_TO_PTR(10));
 5692: 	while (axl_list_length (list) > 0) {
 5693: 		
 5694: 		/* get the integer value */
 5695: 		value = PTR_TO_INT (axl_list_get_first (list));
 5696: 
 5697: 		if (! (value > 0)) {
 5698: 			printf ("Expected to not find any item under 0..\n");
 5699: 			return axl_false;
 5700: 		}
 5701: 		
 5702: 		/* remove */
 5703: 		axl_list_unlink_first (list);
 5704: 	}
 5705: 	if (axl_list_length (list) != 0) {
 5706: 		printf ("Expected to find 0 length list..\n");
 5707: 		return axl_false;
 5708: 	}
 5709: 
 5710: 	axl_list_free (list);
 5711: 
 5712: 	/* create an empty list and destroy */
 5713: 	list = axl_list_new (axl_list_equal_int, NULL);
 5714: 
 5715: 	/* add one item */
 5716: 	axl_list_add (list, INT_TO_PTR (1));
 5717: 	if (axl_list_length (list) != 1) {
 5718: 		printf ("Expected to find 1 length length..\n");
 5719: 		return axl_false;
 5720: 	}
 5721: 
 5722: 	axl_list_add (list, INT_TO_PTR (2));
 5723: 	if (axl_list_length (list) != 2) {
 5724: 		printf ("Expected to find 2 length length..\n");
 5725: 		return axl_false;
 5726: 	}
 5727: 
 5728: 	axl_list_unlink (list, INT_TO_PTR (1));
 5729: 	if (axl_list_length (list) != 1) {
 5730: 		printf ("Expected to find 1 length length..\n");
 5731: 		return axl_false;
 5732: 	}
 5733: 
 5734: 	axl_list_unlink (list, INT_TO_PTR (2));
 5735: 	if (axl_list_length (list) != 0) {
 5736: 		printf ("Expected to find 0 length length..\n");
 5737: 		return axl_false;
 5738: 	}
 5739: 
 5740: 	axl_list_free (list);
 5741: 
 5742: 	/* remove by pointer */
 5743: 	list = axl_list_new (axl_list_always_return_1, axl_free);
 5744: 
 5745: 	/* add items */
 5746: 	ptr1 = axl_new (char, 4);
 5747: 	ptr2 = axl_new (char, 4);
 5748: 	ptr3 = axl_new (char, 4);
 5749: 	ptr4 = axl_new (char, 4);
 5750: 
 5751: 	/* store items */
 5752: 	axl_list_add (list, ptr1);
 5753: 	axl_list_add (list, ptr2);
 5754: 	axl_list_add (list, ptr3);
 5755: 	axl_list_add (list, ptr4);
 5756: 
 5757: 	/* check lengths */
 5758: 	if (axl_list_length (list) != 4) {
 5759: 		printf ("Expected to find a 4 item list...but found: %d..\n",
 5760: 			axl_list_length (list));
 5761: 		return axl_false;
 5762: 	}
 5763: 
 5764: 	/* remove items */
 5765: 	axl_list_remove_ptr (list, ptr1);
 5766: 
 5767: 	if (axl_list_length (list) != 3) {
 5768: 		printf ("Expected to find a 3 item list...but found: %d..\n",
 5769: 			axl_list_length (list));
 5770: 		return axl_false;
 5771: 	}
 5772: 
 5773: 	/* remove items */
 5774: 	axl_list_remove_ptr (list, ptr2);
 5775: 	axl_list_remove_ptr (list, ptr3);
 5776: 	axl_list_remove_ptr (list, ptr4);
 5777: 
 5778: 	if (axl_list_length (list) != 0) {
 5779: 		printf ("Expected to find a 0 item list...but found: %d..\n",
 5780: 			axl_list_length (list));
 5781: 		return axl_false;
 5782: 	}
 5783: 
 5784: 	axl_list_free (list);
 5785: 
 5786: 	/* add and remove item 0 */
 5787: 	list = axl_list_new (axl_list_equal_int, NULL);
 5788: 	axl_list_append (list, INT_TO_PTR (0));
 5789: 	axl_list_append (list, INT_TO_PTR (0));
 5790: 	axl_list_append (list, INT_TO_PTR (0));
 5791: 	axl_list_append (list, INT_TO_PTR (0));
 5792: 	
 5793: 	if (axl_list_length (list) != 4) {
 5794: 		printf ("Expected to find 4 items stored in the list.., but found: %d..\n",
 5795: 			axl_list_length (list));
 5796: 		return axl_false;
 5797: 	} /* end if */
 5798: 
 5799: 	axl_list_remove (list, INT_TO_PTR (0));
 5800: 
 5801: 	if (axl_list_length (list) != 3) {
 5802: 		printf ("Expected to find 3 items stored in the list.., but found: %d..\n",
 5803: 			axl_list_length (list));
 5804: 		return axl_false;
 5805: 	} /* end if */
 5806: 
 5807: 	axl_list_remove_ptr (list, INT_TO_PTR (0));
 5808: 
 5809: 	if (axl_list_length (list) != 2) {
 5810: 		printf ("Expected to find 2 items stored in the list.., but found: %d..\n",
 5811: 			axl_list_length (list));
 5812: 		return axl_false;
 5813: 	} /* end if */
 5814: 
 5815: 	axl_list_remove_first (list);
 5816: 
 5817: 	if (axl_list_length (list) != 1) {
 5818: 		printf ("Expected to find 1 items stored in the list.., but found: %d..\n",
 5819: 			axl_list_length (list));
 5820: 		return axl_false;
 5821: 	} /* end if */
 5822: 
 5823: 	axl_list_remove_last (list);
 5824: 
 5825: 	if (axl_list_length (list) != 0) {
 5826: 		printf ("Expected to find 0 items stored in the list.., but found: %d..\n",
 5827: 			axl_list_length (list));
 5828: 		return axl_false;
 5829: 	} /* end if */
 5830: 
 5831: 	axl_list_free (list);
 5832: 
 5833: 	/* add and remove item 0 */
 5834: 	list = axl_list_new (axl_list_always_return_1, NULL);
 5835: 	axl_list_append (list, INT_TO_PTR (0));
 5836: 	axl_list_append (list, INT_TO_PTR (0));
 5837: 	axl_list_append (list, INT_TO_PTR (0));
 5838: 	axl_list_append (list, INT_TO_PTR (0));
 5839: 	
 5840: 	if (axl_list_length (list) != 4) {
 5841: 		printf ("Expected to find 4 items stored in the list.., but found: %d..\n",
 5842: 			axl_list_length (list));
 5843: 		return axl_false;
 5844: 	} /* end if */
 5845: 
 5846: 	axl_list_remove_ptr (list, INT_TO_PTR (0));
 5847: 
 5848: 	if (axl_list_length (list) != 3) {
 5849: 		printf ("Expected to find 3 items stored in the list.., but found: %d..\n",
 5850: 			axl_list_length (list));
 5851: 		return axl_false;
 5852: 	} /* end if */
 5853: 
 5854: 	axl_list_remove_first (list);
 5855: 
 5856: 	if (axl_list_length (list) != 2) {
 5857: 		printf ("Expected to find 2 items stored in the list.., but found: %d..\n",
 5858: 			axl_list_length (list));
 5859: 		return axl_false;
 5860: 	} /* end if */
 5861: 
 5862: 	axl_list_remove_last (list);
 5863: 
 5864: 	if (axl_list_length (list) != 1) {
 5865: 		printf ("Expected to find 1 items stored in the list.., but found: %d..\n",
 5866: 			axl_list_length (list));
 5867: 		return axl_false;
 5868: 	} /* end if */
 5869: 
 5870: 	axl_list_free (list);
 5871: 
 5872: 	list = axl_list_new (axl_list_always_return_1, NULL);
 5873: 	axl_list_append (list, INT_TO_PTR (0));
 5874: 
 5875: 	if (axl_list_length (list) != 1) {
 5876: 		printf ("Expected to find 1 items stored in the list.., but found: %d..\n",
 5877: 			axl_list_length (list));
 5878: 		return axl_false;
 5879: 	} /* end if */
 5880: 
 5881: 	axl_list_prepend (list, INT_TO_PTR (0));
 5882: 
 5883: 	if (axl_list_length (list) != 2) {
 5884: 		printf ("Expected to find 2 items stored in the list.., but found: %d..\n",
 5885: 			axl_list_length (list));
 5886: 		return axl_false;
 5887: 	} /* end if */
 5888: 	
 5889: 	axl_list_free (list);
 5890: 
 5891: 	return axl_true;
 5892: }
 5893: 
 5894: axl_bool test_01_02_foreach (axlPointer stack_data, 
 5895: 			 axlPointer user_data, 
 5896: 			 axlPointer user_data2)
 5897: {
 5898: 	int * iterator = user_data;
 5899: 
 5900: 	if ((*iterator == 0) && axl_cmp ((char*) stack_data, "test 3")) {
 5901: 		(*iterator)++;
 5902: 		return axl_false;
 5903: 	} else if ((*iterator == 1) && axl_cmp ((char*) stack_data, "test 2")) {
 5904: 		(*iterator)++;
 5905: 		return axl_false;
 5906: 	} else if ((*iterator == 2) && axl_cmp ((char*) stack_data, "test 1")) {
 5907: 		(*iterator)++;
 5908: 		return axl_false;
 5909: 	}
 5910: 	
 5911: 	/* return axl_true to stop operations */
 5912: 	return axl_true;
 5913: }
 5914: 
 5915: /** 
 5916:  * @brief Checks current configuration for the stack implementation
 5917:  * based on the axlList.
 5918:  * 
 5919:  * 
 5920:  * @return axl_true if the stack works properly, otherwise axl_false
 5921:  * is returned.
 5922:  */
 5923: axl_bool test_01_02 (void) 
 5924: {
 5925: 	axlStack * stack;
 5926: 	char     * value;
 5927: 	int        iterator = 0;
 5928: 
 5929: 	/* create the stack */
 5930: 	stack = axl_stack_new (NULL);
 5931: 
 5932: 	axl_stack_push (stack, "test 1");
 5933: 	axl_stack_push (stack, "test 2");
 5934: 	axl_stack_push (stack, "test 3");
 5935: 
 5936: 	/* check foreach function */
 5937: 	axl_stack_foreach (stack, test_01_02_foreach, &iterator, NULL);
 5938: 
 5939: 	if (iterator != 3) {
 5940: 		printf ("Wrong value expected while using the foreach function\n");
 5941: 		return axl_false;
 5942: 	}
 5943: 
 5944: 	if (axl_stack_size (stack) != 3) {
 5945: 		printf ("Wrong stack size expected ..\n");
 5946: 		return axl_false;
 5947: 	}
 5948: 	
 5949: 	value = axl_stack_pop (stack);
 5950: 	if (! axl_stream_cmp (value, "test 3", 6)) {
 5951: 		printf ("Wrong pop value returned (%s != %s)..\n", value, "test 3");
 5952: 		return axl_false;
 5953: 	}
 5954: 
 5955: 	value = axl_stack_pop (stack);
 5956: 	if (! axl_stream_cmp (value, "test 2", 6)) {
 5957: 		printf ("Wrong pop value returned (%s != %s)..\n", value, "test 2");
 5958: 		return axl_false;
 5959: 	}
 5960: 
 5961: 	value = axl_stack_pop (stack);
 5962: 	if (! axl_stream_cmp (value, "test 1", 6)) {
 5963: 		printf ("Wrong pop value returned (%s != %s)..\n", value, "test 1");
 5964: 		return axl_false;
 5965: 	}
 5966: 
 5967: 	if (axl_stack_size (stack) != 0) {
 5968: 		printf ("Wrong stack size before operating..\n");
 5969: 		return axl_false;
 5970: 	}
 5971: 
 5972: 	if (! axl_stack_is_empty (stack)) {
 5973: 		printf ("Wrong stack emptyness value received..\n");
 5974: 		return axl_false;
 5975: 	}
 5976: 
 5977: 	/* destroy the stack */
 5978: 	axl_stack_free (stack);
 5979: 
 5980: 	return axl_true;
 5981: }
 5982: 
 5983: axl_bool test_01_03_vargs (const char * format, ...)
 5984: {
 5985: 	va_list args;
 5986: 
 5987: 	va_start (args, format);
 5988: 
 5989: 	/* get the result */
 5990: 	if (axl_stream_vprintf_len (format, args) != 8)
 5991: 		return axl_false;
 5992: 
 5993: 	va_end (args);
 5994: 	va_start (args, format);
 5995: 
 5996: 	if (axl_stream_vprintf_len (format, args) != 8)
 5997: 		return axl_false;
 5998: 
 5999: 	va_end (args);
 6000: 	va_start (args, format);
 6001: 
 6002: 	if (axl_stream_vprintf_len (format, args) != 8)
 6003: 		return axl_false;
 6004: 
 6005: 	va_end (args);
 6006: 
 6007: 	return axl_true;
 6008: }
 6009: 
 6010: axl_bool test_01_03_replace_check (const char * _source, const char * string, const char * replacement, int check_size, const char * result_string)
 6011: {
 6012: 	char * source;
 6013: 	int    res;
 6014: 
 6015: 	printf ("Test 01-03: Checking %s (%s -> %s)\n", _source, string, replacement);
 6016: 	
 6017: 	source = axl_strdup (_source);
 6018: 	res    = axl_stream_replace (&source, -1, string, -1, replacement, -1);
 6019: 	if (res != check_size) {
 6020: 		printf ("ERROR: expected to find %d bytes but found %d at the replacement\n", check_size, res);
 6021: 		return axl_false;
 6022: 	}
 6023: 	/* check replacement */
 6024: 	if (! axl_cmp (source, result_string)) {
 6025: 		printf ("ERROR: expected to find '%s' but found '%s'\n", result_string, source);
 6026: 		return axl_false;
 6027: 	}
 6028: 	axl_free (source);
 6029: 
 6030: 	return axl_true;
 6031: }
 6032: 
 6033: /** 
 6034:  *
 6035:  * @brief Checks some internal functions that the library provides to
 6036:  * manage strings.
 6037:  *
 6038:  * @return The function must return axl_true if everything is
 6039:  * ok. Otherwise axl_false is returned.
 6040:  */
 6041: axl_bool test_01_03 (void) 
 6042: {
 6043: 	char  * string;
 6044: 	char ** result;
 6045: 	char  * join;
 6046: 	int     res;
 6047: 	int     real_size;
 6048: 	int     trimmed;
 6049: 
 6050: 	/* check that axl_stream_split works */
 6051: 	result = axl_stream_split ("value/value1/value3/value4", 1, "/");
 6052: 	if (result == NULL) {
 6053: 		printf ("Something have failed while using splitting functions\n");
 6054: 		return axl_false;
 6055: 	}
 6056: 
 6057: 	if (axl_stream_strv_num (result) != 4) {
 6058: 		printf ("Something have failed while getting current number of pieces inside the split result (%d != %d)\n", 
 6059: 			axl_stream_strv_num (result),4);
 6060: 		return axl_false;
 6061: 	}
 6062: 	
 6063: 	if (! axl_cmp (result[0], "value")) {
 6064: 		printf ("Failed to get the first element: (%s != %s)\n", result[0], "value");
 6065: 		return axl_false;
 6066: 	}
 6067: 
 6068: 	if (! axl_cmp (result[1], "value1")) {
 6069: 		printf ("Failed to get the second element: (%s != %s)\n", result[1], "value1");
 6070: 		return axl_false;
 6071: 	}
 6072: 
 6073: 	if (! axl_cmp (result[2], "value3")) {
 6074: 		printf ("Failed to get the third element (%s != %s)\n", result[2], "value3");
 6075: 		return axl_false;
 6076: 	}
 6077: 
 6078: 	if (! axl_cmp (result[3], "value4")) {
 6079: 		printf ("Failed to get the fourth element (%s != %s)\n", result[3], "value4");
 6080: 		return axl_false;
 6081: 	}
 6082: 
 6083: 	/* release memory used */
 6084: 	axl_stream_freev (result);
 6085: 
 6086: 	result = axl_stream_split ("value1, value2/ value3* ", 3, ", ", "/ ", "* ");
 6087: 	if (result == NULL) {
 6088: 		printf ("Something have failed while using splitting functions (2)\n");
 6089: 		return axl_false;
 6090: 	}
 6091: 
 6092: 	if (axl_stream_strv_num (result) != 4) {
 6093: 		printf ("Something have failed while getting current number of pieces inside the split result (%d != %d) (2)\n", 
 6094: 			axl_stream_strv_num (result), 4);
 6095: 		return axl_false;
 6096: 	}
 6097: 
 6098: 	if (! axl_cmp (result[0], "value1")) {
 6099: 		printf ("Failed to get the second element: (%s != %s)\n", result[0], "value1");
 6100: 		return axl_false;
 6101: 	}
 6102: 
 6103: 	if (! axl_cmp (result[1], "value2")) {
 6104: 		printf ("Failed to get the third element (%s != %s)\n", result[1], "value2");
 6105: 		return axl_false;
 6106: 	}
 6107: 
 6108: 	if (! axl_cmp (result[2], "value3")) {
 6109: 		printf ("Failed to get the fourth element (%s != %s)\n", result[2], "value3");
 6110: 		return axl_false;
 6111: 	}
 6112: 
 6113: 	if (! axl_cmp (result[3], "")) {
 6114: 		printf ("Failed to get the fourth element ('%s' != '%s')\n", result[3], "");
 6115: 		return axl_false;
 6116: 	}
 6117: 
 6118: 	
 6119: 
 6120: 	/* release memory used */
 6121: 	axl_stream_freev (result);
 6122: 
 6123: 	/* check empty cases */
 6124: 	result = axl_stream_split ("///", 1, "/");
 6125: 	if (result == NULL) {
 6126: 		printf ("Something have failed while using splitting functions (3)\n");
 6127: 		return axl_false;
 6128: 	}
 6129: 
 6130: 	if (axl_stream_strv_num (result) != 4) {
 6131: 		printf ("Something have failed while getting current number of pieces inside the split result (%d != %d) (3)\n", 
 6132: 			axl_stream_strv_num (result), 4);
 6133: 		return axl_false;
 6134: 	}
 6135: 
 6136: 	/* release memory used */
 6137: 	axl_stream_freev (result);
 6138: 
 6139: 
 6140: 	/* now check the join string support */
 6141: 	result = axl_stream_split ("some test AND some test AND some test", 1, "AND");
 6142: 	
 6143: 	/* now join the data */
 6144: 	join   = axl_stream_join (result, "AND");
 6145: 	
 6146: 	if (! axl_cmp (join, "some test AND some test AND some test")) {
 6147: 		printf ("Join operation failed, expected different values '%s' != '%s'",
 6148: 			join, "some test AND some test AND some test");
 6149: 		return axl_false;
 6150: 	}
 6151: 	axl_free (join);
 6152: 	axl_stream_freev (result);
 6153: 
 6154: 	/* now check the join string support */
 6155: 	result = axl_stream_split ("some test", 1, "AND");
 6156: 	
 6157: 	/* now join the data */
 6158: 	join   = axl_stream_join (result, "AND");
 6159: 	
 6160: 	if (! axl_cmp (join, "some test")) {
 6161: 		printf ("Join operation failed, expected different values '%s' != '%s'",
 6162: 			join, "some test");
 6163: 		return axl_false;
 6164: 	}
 6165: 	axl_free (join);
 6166: 	axl_stream_freev (result);
 6167: 
 6168: 	/* now check the join string support */
 6169: 	result = axl_stream_split ("some test AND some test AND some test AND", 1, "AND");
 6170: 	
 6171: 	/* now join the data */
 6172: 	join   = axl_stream_join (result, "AND");
 6173: 	
 6174: 	if (! axl_cmp (join, "some test AND some test AND some test AND")) {
 6175: 		printf ("Join operation failed, expected different values '%s' != '%s'",
 6176: 			join, "some test AND some test AND some test AND");
 6177: 		return axl_false;
 6178: 	}
 6179: 	axl_free (join);
 6180: 	axl_stream_freev (result);
 6181: 
 6182: 	string = axl_strdup ("AxBcA");
 6183: 	if (! axl_cmp (axl_stream_to_upper (string), "AXBCA")) {
 6184: 		/* report error found */
 6185: 		printf ("failed to upper case letters\n");
 6186: 		return axl_false;
 6187: 	}
 6188: 	axl_free (string);
 6189: 
 6190: 	string = axl_strdup ("AxBcA");
 6191: 	if (! axl_cmp (axl_stream_to_lower (string), "axbca")) {
 6192: 		/* report error found */
 6193: 		printf ("failed to lower case letters, result found: %s != %s\n", string, "axbca");
 6194: 		return axl_false;
 6195: 	}
 6196: 	axl_free (string);
 6197: 
 6198: 
 6199: 	string = axl_strdup ("\t \n   \r  value  \n \r \t \t  ");
 6200: 	axl_stream_trim (string);
 6201: 
 6202: 	if (! axl_cmp (string, "value")) {
 6203: 		printf ("failed to trim the string received, expected '%s' == '%s'\n", 
 6204: 			string, "value");
 6205: 		return axl_false;
 6206: 	}
 6207: 
 6208: 	/* release memory */
 6209: 	axl_free (string);
 6210: 
 6211: 	string = axl_strdup ("   value    ");
 6212: 	axl_stream_trim_with_size (string, &trimmed);
 6213: 	if (trimmed != 7) {
 6214: 		printf ("failed, expected to find a trimmed size of 7 but found %d (%s)\n", 
 6215: 			trimmed, string);
 6216: 		return axl_false;
 6217: 	}
 6218: 
 6219: 	/* check axl_stream_vprintf_len implementation */
 6220: 	if (axl_stream_printf_len (NULL, NULL) != 0) {
 6221: 		printf ("failed, expected to find an string value of 0, but it wasn't found\n");
 6222: 		return axl_false;
 6223: 	} /* end if */
 6224: 
 6225: 	if (axl_stream_printf_len (" this is a test", NULL) != 16) {
 6226: 		printf ("failed, expected to find an string value of 16, but it wasn't found\n");
 6227: 		return axl_false;
 6228: 	}
 6229: 
 6230: 	if (axl_stream_printf_len (" this %% is a %% test", NULL) != 20) {
 6231: 		printf ("failed, expected to find an string value of 20, but it wasn't found\n");
 6232: 		return axl_false;
 6233: 	}
 6234: 
 6235: 	if (axl_stream_printf_len ("", NULL) != 1) {
 6236: 		printf ("failed, expected to find an string value of 1, but it wasn't found\n");
 6237: 		return axl_false;
 6238: 	}
 6239: 
 6240: 	if (axl_stream_printf_len ("%%", NULL) != 2) {
 6241: 		printf ("failed, expected to find an string value of 2, but it wasn't found\n");
 6242: 		return axl_false;
 6243: 	}
 6244: 
 6245: 	if (axl_stream_printf_len ("\"", NULL) != 2) {
 6246: 		printf ("failed, expected to find an string value of 2, but it wasn't found\n");
 6247: 		return axl_false;
 6248: 	}
 6249: 
 6250: 	if (axl_stream_printf_len ("\"", NULL) != 2) {
 6251: 		printf ("failed, expected to find an string value of 2, but it wasn't found\n");
 6252: 		return axl_false;
 6253: 	}
 6254: 
 6255: 	if (axl_stream_printf_len (" this is a test \r \t \n  asdf", NULL) != 28) {
 6256: 		printf ("failed, expected to find an string value of 28, but it wasn't found\n");
 6257: 		return axl_false;
 6258: 	} /* end if */
 6259: 
 6260: 	res = axl_stream_printf_len ("%s", "This is a test");
 6261: 	if ( res != 15) {
 6262: 		printf ("failed, expected to find an string value of 15, but it was found (%d)\n", res);
 6263: 		return axl_false;
 6264: 	}
 6265: 
 6266: 	res = axl_stream_printf_len (" adfasdf %s asdfasdf", "This is a test");
 6267: 	if ( res != 33) {
 6268: 		printf ("failed, expected to find an string value of 33, but it was found (%d)\n", res);
 6269: 		return axl_false;
 6270: 	}
 6271: 
 6272: 	res = axl_stream_printf_len (" adfasdf %s asdfasdf %s", "This is a test", "fk2");
 6273: 	if ( res != 37) {
 6274: 		printf ("failed, expected to find an string value of 37, but it was found (%d)\n", res);
 6275: 		return axl_false;
 6276: 	}
 6277: 
 6278: 	res = axl_stream_printf_len ("%% adfasdf %s asdfasdf %s", "This is a test", "fk2");
 6279: 	if ( res != 38) {
 6280: 		printf ("failed, expected to find an string value of 38, but it was found (%d)\n", res);
 6281: 		return axl_false;
 6282: 	}
 6283: 
 6284: 	res = axl_stream_printf_len ("%d", 1);
 6285: 	if ( res != 2) {
 6286: 		printf ("failed, expected to find an string value of 2, but it was found (%d)\n", res);
 6287: 		return axl_false;
 6288: 	}
 6289: 
 6290: 	res = axl_stream_printf_len ("%d", 10);
 6291: 	if ( res != 3) {
 6292: 		printf ("failed, expected to find an string value of 3, but it was found (%d)\n", res);
 6293: 		return axl_false;
 6294: 	}
 6295: 
 6296: 	res = axl_stream_printf_len ("%d", -1);
 6297: 	if ( res != 3) {
 6298: 		printf ("failed, expected to find an string value of 3, but it was found (%d)\n", res);
 6299: 		return axl_false;
 6300: 	}
 6301: 
 6302: 	res = axl_stream_printf_len ("%d", -10);
 6303: 	if ( res != 4) {
 6304: 		printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res);
 6305: 		return axl_false;
 6306: 	}
 6307: 
 6308: 	res = axl_stream_printf_len ("%d", -100);
 6309: 	if ( res != 5) {
 6310: 		printf ("failed, expected to find an string value of 5, but it was found (%d)\n", res);
 6311: 		return axl_false;
 6312: 	}
 6313: 
 6314: 	res = axl_stream_printf_len ("%d", -10012);
 6315: 	if ( res != 7) {
 6316: 		printf ("failed, expected to find an string value of 7, but it was found (%d)\n", res);
 6317: 		return axl_false;
 6318: 	}
 6319: 
 6320: 	res = axl_stream_printf_len ("This is a number %d", -10012);
 6321: 	if ( res != 24) {
 6322: 		printf ("failed, expected to find an string value of 24, but it was found (%d)\n", res);
 6323: 		return axl_false;
 6324: 	}
 6325: 
 6326: 	res = axl_stream_printf_len ("This is a number %d with content ", -10012);
 6327: 	if ( res != 38) {
 6328: 		printf ("failed, expected to find an string value of 38, but it was found (%d)\n", res);
 6329: 		return axl_false;
 6330: 	}
 6331: 
 6332: 	res = axl_stream_printf_len ("This is a number %d with content %s", -10012, "This more content");
 6333: 	if ( res != 55) {
 6334: 		printf ("failed, expected to find an string value of 55, but it was found (%d)\n", res);
 6335: 		return axl_false;
 6336: 	}
 6337: 
 6338: 	res = axl_stream_printf_len ("%c", 1);
 6339: 	if ( res != 2) {
 6340: 		printf ("failed, expected to find an string value of 2, but it was found (%d)\n", res);
 6341: 		return axl_false;
 6342: 	}
 6343: 
 6344: 	res = axl_stream_printf_len (" %c ", 1);
 6345: 	if ( res != 4) {
 6346: 		printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res);
 6347: 		return axl_false;
 6348: 	}
 6349: 
 6350: 	res = axl_stream_printf_len ("\x0D");
 6351: 	if ( res != 2) {
 6352: 		printf ("failed, expected to find an string value of 2, but it was found (%d)\n", res);
 6353: 		return axl_false;
 6354: 	}
 6355: 
 6356: 	res = axl_stream_printf_len ("\x0D\x0A");
 6357: 	if ( res != 3) {
 6358: 		printf ("failed, expected to find an string value of 3, but it was found (%d)\n", res);
 6359: 		return axl_false;
 6360: 	}
 6361: 
 6362: 	res = axl_stream_printf_len ("%ld", 182);
 6363: 	if ( res != 4) {
 6364: 		printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res);
 6365: 		return axl_false;
 6366: 	}
 6367: 
 6368: 	res = axl_stream_printf_len ("%lu", (unsigned long) 182);
 6369: 	if ( res != 4) {
 6370: 		printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res);
 6371: 		return axl_false;
 6372: 	}
 6373: 
 6374: 	res = axl_stream_printf_len ("%6d", 182);
 6375: 	if ( res != 7) {
 6376: 		printf ("failed (%%6d), expected to find an string value of 7, but it was found (%d)\n", res);
 6377: 		return axl_false;
 6378: 	} 
 6379: 
 6380: 	res = axl_stream_printf_len ("%f", 182.0);
 6381: 	if ( res != 11) {
 6382: 		printf ("failed (%%f,182), expected to find an string value of 11, but it was found (%d)\n", res);
 6383: 		return axl_false;
 6384: 	} 
 6385: 
 6386: 	res = axl_stream_printf_len ("%.2f", 18228.0);
 6387: 	if ( res != 9) {
 6388: 		printf ("failed (%%.2f), expected to find an string value of 7, but it was found (%d)\n", res);
 6389: 		return axl_false;
 6390: 	} 
 6391: 
 6392: 	res = axl_stream_printf_len ("%8.2f", 182);
 6393: 	if ( res != 9) {
 6394: 		printf ("failed (%%8.2f), expected to find an string value of 12, but it was found (%d)\n", res);
 6395: 		return axl_false;
 6396: 	} 
 6397: 
 6398: 	res = axl_stream_printf_len ("%.5f", 182.10);
 6399: 	if ( res != 10) {
 6400: 		printf ("failed (%%.5f), expected to find an string value of 10, but it was found (%d)\n", res);
 6401: 		return axl_false;
 6402: 	} 
 6403: 
 6404: 	res = axl_stream_printf_len ("%g", (double) 182.23);
 6405: 	if ( res != 7) {
 6406: 		printf ("failed (%%g,182.23), expected to find an string value of 7, but it was found (%d)\n", res);
 6407: 		return axl_false;
 6408: 	} 
 6409: 
 6410: 	res = axl_stream_printf_len ("%g", 182.39);
 6411: 	if ( res != 7) {
 6412: 		printf ("failed (%%g,182.39), expected to find an string value of 7, but it was found (%d)\n", res);
 6413: 		return axl_false;
 6414: 	} 
 6415: 
 6416: 	res = axl_stream_printf_len ("%g", 182.1);
 6417: 	if ( res != 6) {
 6418: 		printf ("failed (%%g,182.1), expected to find an string value of 6, but it was found (%d)\n", res);
 6419: 		return axl_false;
 6420: 	} 
 6421: 
 6422: 	res = axl_stream_printf_len ("%g", 182.102);
 6423: 	if ( res != 8) {
 6424: 		printf ("failed (%%g,182.1), expected to find an string value of 6, but it was found (%d)\n", res);
 6425: 		return axl_false;
 6426: 	} 
 6427: 
 6428: 	if (! test_01_03_vargs ("%g", 182.102)) {
 6429: 		printf ("failed to reuse vargs..\n");
 6430: 		return axl_false;
 6431: 	}
 6432: 	
 6433: 
 6434: 	/* release the memory */
 6435: 	axl_free (string);
 6436: 	
 6437: 	/* case cmp comparisions */
 6438: 	if (! axl_stream_casecmp ("Content-Type: ", "Content-Type: ", 14)) {
 6439: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6440: 		return axl_false;
 6441: 	}
 6442: 	
 6443: 	if (! axl_stream_casecmp ("CONTENT-Type: ", "Content-Type: ", 14)) {
 6444: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6445: 		return axl_false;
 6446: 	}
 6447: 
 6448: 	if (! axl_stream_casecmp ("CONTENT-Type: ", "Content-TYPE: ", 14)) {
 6449: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6450: 		return axl_false;
 6451: 	}
 6452: 
 6453: 	if (! axl_stream_casecmp ("CoNtENT-type: ", "Content-TYPE: ", 14)) {
 6454: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6455: 		return axl_false;
 6456: 	}
 6457: 
 6458: 	/* check axl_casecmp */
 6459: 	if (! axl_casecmp ("Content-Type: ", "Content-Type: ")) {
 6460: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6461: 		return axl_false;
 6462: 	}
 6463: 	
 6464: 	if (! axl_casecmp ("CONTENT-Type: ", "Content-Type: ")) {
 6465: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6466: 		return axl_false;
 6467: 	}
 6468: 
 6469: 	if (! axl_casecmp ("CONTENT-Type: ", "Content-TYPE: ")) {
 6470: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6471: 		return axl_false;
 6472: 	}
 6473: 
 6474: 	if (! axl_casecmp ("CoNtENT-type: ", "Content-TYPE: ")) {
 6475: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6476: 		return axl_false;
 6477: 	}
 6478: 
 6479: 	/* check with additional content not scanned */
 6480: 	if (! axl_stream_casecmp ("Content-Type: ", "Content-Type: asdf", 14)) {
 6481: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6482: 		return axl_false;
 6483: 	}
 6484: 	
 6485: 	if (! axl_stream_casecmp ("CONTENT-Type: ", "Content-Type: asdf", 14)) {
 6486: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6487: 		return axl_false;
 6488: 	}
 6489: 
 6490: 	if (! axl_stream_casecmp ("CONTENT-Type: ", "Content-TYPE: qwer12343", 14)) {
 6491: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6492: 		return axl_false;
 6493: 	}
 6494: 
 6495: 	if (! axl_stream_casecmp ("CoNtENT-type: ", "Content-TYPE: 23141234", 14)) {
 6496: 		printf ("Expected to find equal comparision for case insensitive check..\n");
 6497: 		return axl_false;
 6498: 	}
 6499: 
 6500: 	/* check axl_casecmp */
 6501: 	if (axl_casecmp ("Content-Type: ", "Content-Type: 12321")) {
 6502: 		printf ("Expected to not find equal comparision for case insensitive check..\n");
 6503: 		return axl_false;
 6504: 	}
 6505: 	
 6506: 	if (axl_casecmp ("CONTENT-Type: ", "Content-Type: awdf21")) {
 6507: 		printf ("Expected to not find equal comparision for case insensitive check..\n");
 6508: 		return axl_false;
 6509: 	}
 6510: 
 6511: 	if (axl_casecmp ("CONTENT-Type: ", "Content-TYPE: adsfasdf")) {
 6512: 		printf ("Expected to not find equal comparision for case insensitive check..\n");
 6513: 		return axl_false;
 6514: 	}
 6515: 
 6516: 	if (axl_casecmp ("CoNtENT-type: ", "Content-TYPE: asdf21")) {
 6517: 		printf ("Expected to not find equal comparision for case insensitive check..\n");
 6518: 		return axl_false;
 6519: 	}
 6520: 
 6521: 	/* check remove function */
 6522: 	string = axl_strdup ("iso-8859-15");
 6523: 	axl_stream_remove (string, "-", axl_false);
 6524: 	if (! axl_cmp (string, "iso885915")) {
 6525: 		printf ("Expected %s value but found %s...\n", 
 6526: 			string, "iso885915");
 6527: 		return axl_false;
 6528: 	} /* end if */
 6529: 	axl_free (string);
 6530: 
 6531: 	string = axl_strdup ("iso885915");
 6532: 	axl_stream_remove (string, "-", axl_false);
 6533: 	if (! axl_cmp (string, "iso885915")) {
 6534: 		printf ("Expected %s value but found %s...\n", 
 6535: 			string, "iso885915");
 6536: 		return axl_false;
 6537: 	} /* end if */
 6538: 	axl_free (string);
 6539: 
 6540: 	string = axl_strdup ("--iso885915---");
 6541: 	axl_stream_remove (string, "-", axl_false);
 6542: 	if (! axl_cmp (string, "iso885915")) {
 6543: 		printf ("Expected %s value but found %s...\n", 
 6544: 			"iso885915", string);
 6545: 		return axl_false;
 6546: 	} /* end if */
 6547: 	axl_free (string);
 6548: 
 6549: 	string = axl_strdup_printf ("-----");
 6550: 	axl_stream_remove (string, "-", axl_false);
 6551: 	if (! axl_cmp (string, "")) {
 6552: 		printf ("Expected %s value but found %s...\n", 
 6553: 			"", string);
 6554: 		return axl_false;
 6555: 	} /* end if */
 6556: 	axl_free (string);
 6557: 
 6558: 	string = axl_strdup_printf ("iso-8859---------15");
 6559: 	axl_stream_remove (string, "-", axl_false);
 6560: 	if (! axl_cmp (string, "iso885915")) {
 6561: 		printf ("Expected %s value but found %s...\n", 
 6562: 			"iso885915", string);
 6563: 		return axl_false;
 6564: 	} /* end if */
 6565: 	axl_free (string);
 6566: 
 6567: 	string = axl_strdup_printf ("iso-8859---------15");
 6568: 	axl_stream_remove (string, "-", axl_true);
 6569: 	if (! axl_cmp (string, "iso8859---------15")) {
 6570: 		printf ("Expected %s value but found %s...\n", 
 6571: 			"iso8859---------15", string);
 6572: 		return axl_false;
 6573: 	} /* end if */
 6574: 	axl_free (string);
 6575: 
 6576: 	/* check printf buffer */
 6577: 	string = axl_new (char, 100);
 6578: 	string [21] = 'a';
 6579: 	res    = axl_stream_printf_buffer (string, 100, &real_size, "SEQ %d %d %d\x0D\x0A", 10, 1203020, 4096);
 6580: 	if (res  != strlen (string)) {
 6581: 		printf ("ERROR(1): expected to find string length %d but found %d..\n",
 6582: 			res, (int) strlen (string));
 6583: 		return axl_false;
 6584: 	}
 6585: 
 6586: 	if (res != 21) {
 6587: 		printf ("ERROR(2): expected to find string length %d but found %d..\n",
 6588: 			res, 21);
 6589: 		return axl_false;
 6590: 	}
 6591: 	/* check string termination */
 6592: 	if (string [21] != '\0') {
 6593: 		printf ("ERROR(2.1): expected string termination at position %d..\n", 21);
 6594: 		return axl_false;
 6595: 	}
 6596: 
 6597: 	/* check real size and returned value */
 6598: 	if (real_size != res) {
 6599: 		printf ("ERROR(2.2): expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
 6600: 			real_size, res);
 6601: 		return axl_false;
 6602: 	}
 6603: 
 6604: 	/* check content */
 6605: 	if (! axl_cmp (string, "SEQ 10 1203020 4096\x0D\x0A")) {
 6606: 		printf ("ERROR: expected to find '%s' but found '%s'..\n",
 6607: 			string, "SEQ 10 1203020 4096\x0D\x0A");
 6608: 		return axl_false;
 6609: 	}
 6610: 
 6611: 	/* check printf buffer */
 6612: 	string[70] = 'a';
 6613: 	res    = axl_stream_printf_buffer (string, 100, &real_size, "SEQ ###############################################3 %d %d %d\x0D\x0A", 10, 1203020, 4096);
 6614: 	/* printf ("Found string (size: %d, real: %d): %s..\n", res, real_size, string); */
 6615: 	
 6616: 	if (res  != strlen (string)) {
 6617: 		printf ("ERROR(3): expected to find string length %d but found %d..\n",
 6618: 			res, (int) strlen (string));
 6619: 		return axl_false;
 6620: 	}
 6621: 
 6622: 	if (res != 70) {
 6623: 		printf ("ERROR(4): expected to find string length %d but found %d..\n",
 6624: 			res, 21);
 6625: 		return axl_false;
 6626: 	}
 6627: 
 6628: 	/* check string termination */
 6629: 	if (string [70] != '\0') {
 6630: 		printf ("ERROR: expected string termination at position %d..\n", 21);
 6631: 		return axl_false;
 6632: 	}
 6633: 
 6634: 	/* check real size and returned value */
 6635: 	if (real_size != res) {
 6636: 		printf ("ERROR: expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
 6637: 			real_size, res);
 6638: 		return axl_false;
 6639: 	}
 6640: 
 6641: 	/* check content */
 6642: 	if (! axl_cmp (string, "SEQ ###############################################3 10 1203020 4096\x0D\x0A")) {
 6643: 		printf ("ERROR: expected to find '%s' but found '%s'..\n",
 6644: 			string, "SEQ ###############################################3 10 1203020 4096\x0D\x0A");
 6645: 		return axl_false;
 6646: 	}
 6647: 
 6648: 	/* check printf buffer */
 6649: 	string[96] = 'a';
 6650: 	res    = axl_stream_printf_buffer (string, 100, &real_size, "SEQ ############################################asdfasdfasdfasdfasdfasdfas###3 %d %d %d\x0D\x0A", 10, 1203020, 4096);
 6651: 	/* printf ("Found string (size: %d, real: %d): %s..\n", res, real_size, string); */
 6652: 
 6653: 	if (res != strlen (string)) {
 6654: 	        printf ("ERROR(5): expected to find string length %d but found %d..\n", res, (int) strlen (string));
 6655: 		return axl_false;
 6656: 	}
 6657: 
 6658: 	if (res != 96) {
 6659: 		printf ("ERROR(6): expected to find string length %d but found %d..\n", res, 96);
 6660: 		return axl_false;
 6661: 	}
 6662: 
 6663: 	/* check string termination */
 6664: 	if (string [96] != '\0') {
 6665: 		printf ("ERROR: expected string termination at position %d..\n", 21);
 6666: 		return axl_false;
 6667: 	}
 6668: 
 6669: 	/* check real size and returned value */
 6670: 	if (real_size != res) {
 6671: 		printf ("ERROR: expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
 6672: 			real_size, res);
 6673: 		return axl_false;
 6674: 	}
 6675: 
 6676: 	/* check content */
 6677: 	if (! axl_cmp (string, "SEQ ############################################asdfasdfasdfasdfasdfasdfas###3 10 1203020 4096\x0D\x0A")) {
 6678: 		printf ("ERROR: expected to find '%s' but found '%s'..\n",
 6679: 			string, "SEQ ############################################asdfasdfasdfasdfasdfasdfas###3 10 1203020 4096\x0D\x0A");
 6680: 		return axl_false;
 6681: 	}
 6682: 
 6683: 	/* check printf buffer */
 6684: 	string[99] = 'a';
 6685: 	res    = axl_stream_printf_buffer (string, 100, &real_size, "SEQ ###@@@#########################################asdfasdfasdfasdfasdfasdfas###3 %d %d %d\x0D\x0A", 
 6686: 					   10, 1203020, 4096);
 6687: 	/* printf ("Found string (size: %d, real: %d): %s..\n", res, real_size, string); */
 6688: 
 6689: 	if (res != strlen (string)) {
 6690: 	        printf ("ERROR(7): expected to find string length %d but found %d (1)..\n", res, (int) strlen (string));
 6691: 		return axl_false;
 6692: 	}
 6693: 
 6694: 	if (res != 99) {
 6695: 		printf ("ERROR(8): expected to find string length %d but found %d (2)..\n", res, 99);
 6696: 		return axl_false;
 6697: 	}
 6698: 
 6699: 	/* check string termination */
 6700: 	if (string [99] != '\0') {
 6701: 		printf ("ERROR: expected string termination at position %d..\n", 21);
 6702: 		return axl_false;
 6703: 	}
 6704: 
 6705: 	/* check real size and returned value */
 6706: 	if (real_size != res) {
 6707: 		printf ("ERROR: expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
 6708: 			real_size, res);
 6709: 		return axl_false;
 6710: 	}
 6711: 
 6712: 	/* check content */
 6713: 	if (! axl_cmp (string, "SEQ ###@@@#########################################asdfasdfasdfasdfasdfasdfas###3 10 1203020 4096\x0D\x0A")) {
 6714: 		printf ("ERROR: expected to find '%s' but found '%s'..\n",
 6715: 			string, "SEQ ###@@@#########################################asdfasdfasdfasdfasdfasdfas###3 10 1203020 4096\x0D\x0A");
 6716: 		return axl_false;
 6717: 	}
 6718: 
 6719: 	/* check printf buffer (out of space situation) */
 6720: 	string[99] = 'a';
 6721: 	res    = axl_stream_printf_buffer (string, 100, &real_size, 
 6722: 					   "SEQ ###@@@##fffasdklfjasdlfkjasdlfkjadf#######################################asdfasdfasdfasdfasdfasdfas###3 %d %d %d\x0D\x0A", 
 6723: 					   10, 1203020, 4096);
 6724: 	/* printf ("Found string (size: %d, real: %d): %s..\n", res, real_size, string);  */
 6725: 
 6726: 	if (res != strlen (string)) {
 6727: 	        printf ("ERROR(9): expected to find string length %d but found %d (1)..\n", res, (int) strlen (string));
 6728: 		return axl_false;
 6729: 	}
 6730: 
 6731: 	if (res != 99) {
 6732: 		printf ("ERROR(10): expected to find string length %d but found %d (2)..\n", res, 99);
 6733: 		return axl_false;
 6734: 	}
 6735: 
 6736: 	/* check string termination */
 6737: 	if (string [99] != '\0') {
 6738: 		printf ("ERROR: expected string termination at position %d..\n", 21);
 6739: 		return axl_false;
 6740: 	}
 6741: 
 6742: 	/* check real size and returned value */
 6743: 	if (real_size != 126) {
 6744: 		printf ("ERROR: expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
 6745: 			real_size, 126);
 6746: 		return axl_false;
 6747: 	}
 6748: 
 6749: 	/* check content */
 6750: 	if (! axl_cmp (string, "SEQ ###@@@##fffasdklfjasdlfkjasdlfkjadf#######################################asdfasdfasdfasdfasdfa")) {
 6751: 		printf ("ERROR: expected to find '%s' but found '%s'..\n",
 6752: 			string, "SEQ ###@@@##fffasdklfjasdlfkjasdlfkjadf#######################################asdfasdfasdfasdfasdfa");
 6753: 		return axl_false;
 6754: 	}
 6755: 
 6756: 	axl_free (string);
 6757: 
 6758: 
 6759: 	/* check replacement */
 6760: 	if (! test_01_03_replace_check ("1) This is a test", "test", "prueba", 19, "1) This is a prueba"))
 6761: 		return axl_false;
 6762: 
 6763: 	/* source, string, replace, check_size, result */
 6764: 	if (! test_01_03_replace_check ("test", "test", "prueba", 6, "prueba"))
 6765: 		return axl_false;
 6766: 
 6767: 	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"))
 6768: 		return axl_false;
 6769: 
 6770: 	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"))
 6771: 		return axl_false;
 6772: 
 6773: 	if (! test_01_03_replace_check ("oooo", "o", "i", 4, "iiii"))
 6774: 		return axl_false;
 6775: 
 6776: 	if (! test_01_03_replace_check ("oooo", "o", "ii", 8, "iiiiiiii"))
 6777: 		return axl_false;
 6778: 
 6779: 	if (! test_01_03_replace_check (" tes", "test", "asdfsdf", 4, " tes"))
 6780: 		return axl_false;
 6781: 
 6782: 	return axl_true;
 6783: }
 6784: 
 6785: /** 
 6786:  * @brief Intensive axl list implementation.
 6787:  */
 6788: axl_bool test_01_04 (void) {
 6789: 	int             iterator = 0;
 6790: 	int             value;
 6791: 	axlList       * list;
 6792: 	axlListCursor * cursor;
 6793: 
 6794: 	/* create the list */
 6795: 	list = axl_list_new (axl_list_always_return_1, NULL);
 6796: 
 6797: 	/* add items */
 6798: 	while (iterator < 10000) {
 6799: 
 6800: 		/* add integers */
 6801: 		axl_list_add (list, INT_TO_PTR(iterator));
 6802: 
 6803: 		/* update the iterator */
 6804: 		iterator++;
 6805: 	}
 6806: 
 6807: 	/* get items using iterator */
 6808: 	cursor   = axl_list_cursor_new (list);
 6809: 	iterator = 0;
 6810: 	while (axl_list_cursor_has_item (cursor)) {
 6811: 		/* get the value */
 6812: 		value = PTR_TO_INT (axl_list_cursor_get (cursor));
 6813: 
 6814: 		/* check value */
 6815: 		if (value != iterator) {
 6816: 			printf ("Values miss match: %d != %d\n", value, iterator);
 6817: 			return axl_false;
 6818: 		}
 6819: 
 6820: 		/* get the next */
 6821: 		axl_list_cursor_next (cursor);
 6822: 
 6823: 		/* update the iterator */
 6824: 		iterator++;
 6825: 		
 6826: 	} /* end while */
 6827: 
 6828: 	/* remove all items */
 6829: 	axl_list_cursor_first (cursor);
 6830: 	iterator = 0;
 6831: 	while (axl_list_cursor_has_item (cursor)) {
 6832: 
 6833: 		/* get the value */
 6834: 		value = PTR_TO_INT (axl_list_cursor_get (cursor));
 6835: 
 6836: 		/* check value */
 6837: 		if (value != iterator) {
 6838: 			printf ("Values miss match (2): %d != %d\n", value, iterator);
 6839: 			return axl_false;
 6840: 		}
 6841: 
 6842: 		/* remove */
 6843: 		axl_list_cursor_remove (cursor);
 6844: 
 6845: 		if (axl_list_length (list) > 1) {
 6846: 
 6847: 			/* get the value */
 6848: 			value = PTR_TO_INT (axl_list_cursor_get (cursor));
 6849: 			
 6850: 			/* check value */
 6851: 			if (value != (iterator + 1)) {
 6852: 				printf ("Values miss match (3): %d != %d\n", value, iterator + 1);
 6853: 				return axl_false;
 6854: 			}
 6855: 		}
 6856: 
 6857: 		/* update the iterator */
 6858: 		iterator++;
 6859: 		
 6860: 	} /* end while */
 6861: 
 6862: 	if (axl_list_length (list) != 0) {
 6863: 		printf ("List lengths mismatch: %d != 0\n", axl_list_length (list));
 6864: 		return axl_false;
 6865: 	}
 6866: 
 6867: 	/* free cursor */
 6868: 	axl_list_cursor_free (cursor);
 6869: 
 6870: 	/* release the list */
 6871: 	axl_list_free (list);
 6872: 	
 6873: 	/* axl_true */
 6874: 	return axl_true;
 6875: }
 6876: 
 6877: /** 
 6878:  * @brief Check axl list remove at API.
 6879:  */
 6880: axl_bool test_01_04_a (void) {
 6881: 	axlList       * list;
 6882: 	char          * value;
 6883: 	char          * value2;
 6884: 	char          * value3;
 6885: 
 6886: 	/* create the list */
 6887: 	list = axl_list_new (axl_list_equal_string, axl_free);
 6888: 
 6889: 	/* add tree items */
 6890: 	axl_list_add (list, axl_strdup ("this is a test 1"));
 6891: 	axl_list_add (list, axl_strdup ("this is a test 2"));
 6892: 	axl_list_add (list, axl_strdup ("this is a test 3"));
 6893: 
 6894: 	/* remove second position */
 6895: 	axl_list_remove_at (list, 1);
 6896: 	if (axl_list_length (list) != 2) {
 6897: 		printf ("ERROR: Expected to find two items in a list after removal operation..");
 6898: 		return axl_false;
 6899: 	} /* end if */
 6900: 
 6901: 	/* check content */
 6902: 	if (! axl_cmp ("this is a test 1", axl_list_get_nth (list, 0))) {
 6903: 		printf ("ERROR: Expected to find item '%s' but found '%s'\n",
 6904: 			"this is a test 1", (char*) axl_list_get_nth (list, 0));
 6905: 		return axl_false;
 6906: 	} /* end if */
 6907: 
 6908: 	/* now remove first position */
 6909: 	axl_list_remove_at (list, 0);
 6910: 	if (axl_list_length (list) != 1) {
 6911: 		printf ("ERROR: Expected to find one item in a list after removal operation..");
 6912: 		return axl_false;
 6913: 	} /* end if */
 6914: 
 6915: 	/* check content */
 6916: 	if (! axl_cmp ("this is a test 3", axl_list_get_nth (list, 0))) {
 6917: 		printf ("ERROR: Expected to find item '%s' but found '%s'\n",
 6918: 			"this is a test 1", (char*) axl_list_get_nth (list, 0));
 6919: 		return axl_false;
 6920: 	} /* end if */
 6921: 
 6922: 	/* now remove first position */
 6923: 	axl_list_remove_at (list, 0);
 6924: 	if (axl_list_length (list) != 0) {
 6925: 		printf ("ERROR: Expected to find no item in a list after removal operation..");
 6926: 		return axl_false;
 6927: 	} /* end if */
 6928: 
 6929: 	axl_list_free (list);
 6930: 
 6931: 	/* now test unlink_at */
 6932: 	value  = axl_strdup ("Funky string");
 6933: 	value2 = axl_strdup ("Funky string 2");
 6934: 	value3 = axl_strdup ("Funky string 3");
 6935: 
 6936: 	/* check axl_list_equal_string */
 6937: 	if (axl_list_equal_string (value, value2) == 0) {
 6938: 		printf ("ERROR: Expected to find different strings, but reported equal for '%s' == '%s'\n",
 6939: 			value, value2);
 6940: 		return axl_false;
 6941: 	}
 6942: 	
 6943: 	/* create the list */
 6944: 	list = axl_list_new (axl_list_equal_string, axl_free);
 6945: 
 6946: 	/* add items */
 6947: 	axl_list_add (list, value);
 6948: 	if (axl_list_length (list) != 1) {
 6949: 		printf ("ERROR: Expected to find a list with one item but found: %d\n", axl_list_length (list));
 6950: 		return axl_false;
 6951: 	}
 6952: 	axl_list_add (list, value2);
 6953: 	if (axl_list_length (list) != 2) {
 6954: 		printf ("ERROR: Expected to find a list with two item but found: %d\n", axl_list_length (list));
 6955: 		return axl_false;
 6956: 	}
 6957: 	axl_list_add (list, value3);
 6958: 	if (axl_list_length (list) != 3) {
 6959: 		printf ("ERROR: Expected to find a list with three item but found: %d\n", axl_list_length (list));
 6960: 		return axl_false;
 6961: 	}
 6962: 
 6963: 	/* unlink items */
 6964: 	axl_list_unlink_at (list, 1);
 6965: 	if (axl_list_length (list) != 2) {
 6966: 		printf ("ERROR: Expected to find two items in a list after removal operation but found:..%d\n", axl_list_length (list));
 6967: 		return axl_false;
 6968: 	} /* end if */
 6969: 
 6970: 	/* check content */
 6971: 	if (! axl_cmp ("Funky string", axl_list_get_nth (list, 0))) {
 6972: 		printf ("ERROR: Expected to find item '%s' but found '%s'\n",
 6973: 			"Funky string", (char*) axl_list_get_nth (list, 0));
 6974: 		return axl_false;
 6975: 	} /* end if */
 6976: 
 6977: 	/* now remove first position */
 6978: 	axl_list_unlink_at (list, 0);
 6979: 	if (axl_list_length (list) != 1) {
 6980: 		printf ("ERROR: Expected to find one item in a list after removal operation..");
 6981: 		return axl_false;
 6982: 	} /* end if */
 6983: 
 6984: 	/* check content */
 6985: 	if (! axl_cmp ("Funky string 3", axl_list_get_nth (list, 0))) {
 6986: 		printf ("ERROR: Expected to find item '%s' but found '%s'\n",
 6987: 			"Funky string 3", (char*) axl_list_get_nth (list, 0));
 6988: 		return axl_false;
 6989: 	} /* end if */
 6990: 
 6991: 	/* now remove first position */
 6992: 	axl_list_unlink_at (list, 0);
 6993: 	if (axl_list_length (list) != 0) {
 6994: 		printf ("ERROR: Expected to find no item in a list after removal operation..");
 6995: 		return axl_false;
 6996: 	} /* end if */
 6997: 
 6998: 	axl_list_free (list);
 6999: 
 7000: 	/* now remove strings */
 7001: 	axl_free (value);
 7002: 	axl_free (value2);
 7003: 	axl_free (value3);
 7004: 
 7005: 	return axl_true;
 7006: }
 7007: 
 7008: /** 
 7009:  * @brief Checks error reporting functions.
 7010:  * 
 7011:  * 
 7012:  * @return \ref axl_true if ok, \ref axl_false on rainy days.
 7013:  */
 7014: axl_bool test_01_05 (void) 
 7015: {
 7016: 	axlError * error = NULL;
 7017: 
 7018: 	if (! axl_error_was_ok (error)) {
 7019: 		printf ("Error: expected to find ok on a non-initialized error\n");
 7020: 		return axl_false;
 7021: 	}
 7022: 
 7023: 	axl_error_new (-1, "An error to report", NULL, &error);
 7024: 
 7025: 	if (axl_error_was_ok (error)) {
 7026: 		printf ("Error: expected to find error reported on an initialized error\n");
 7027: 		return axl_false;
 7028: 	}
 7029: 
 7030: 	axl_error_free (error);
 7031: 
 7032: 	return axl_true;
 7033: }
 7034: 
 7035: int lookups = 0;
 7036: 
 7037: void test_02_02_check_key (axlHash * hash, char * key)
 7038: {
 7039: 	char * value = axl_hash_get (hash, key);	
 7040: 	
 7041: 	if (! axl_cmp (value, key)) {
 7042: 		printf ("ERROR: unable to find %s value, found %s in the hash!!!\n", key, value);
 7043: 		exit (-1);
 7044: 	}
 7045: 
 7046: 	lookups++;
 7047: 
 7048: 	return;
 7049: }
 7050: 
 7051: /** 
 7052:  * @brief Test current libaxl hash implementation.
 7053:  *
 7054:  * @return axl_true if it works properly or axl_false if not.
 7055:  */
 7056: axl_bool test_02_02 (void) 
 7057: {
 7058: 	axlHash     * hash;
 7059: 	int           iterator;
 7060: 	const char  * value;
 7061: 
 7062: 	/* create the hash */
 7063: 	hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
 7064: 	
 7065: 	/* insert data */
 7066: 	axl_hash_insert (hash, "sword", "sword"); 
 7067: 	axl_hash_insert (hash, "mace", "mace");
 7068: 	axl_hash_insert (hash, "axe", "axe");
 7069: 	axl_hash_insert (hash, "arrow", "arrow");
 7070: 	axl_hash_insert (hash, "shield", "shield");
 7071: 	axl_hash_insert (hash, "bag", "bag");
 7072: 	axl_hash_insert (hash, "stone", "stone");
 7073: 	axl_hash_insert (hash, "key", "key");
 7074: 	axl_hash_insert (hash, "skull", "skull");
 7075: 	axl_hash_insert (hash, "jar", "jar");
 7076: 	axl_hash_insert (hash, "bottle", "bottle");
 7077: 	axl_hash_insert (hash, "fairy", "fairy");
 7078: 	axl_hash_insert (hash, "potion", "potion");
 7079: 	axl_hash_insert (hash, "water", "water");
 7080: 	axl_hash_insert (hash, "spoon", "spoon");
 7081: 	axl_hash_insert (hash, "book", "book");
 7082: 	axl_hash_insert (hash, "spear", "spear");
 7083: 	axl_hash_insert (hash, "dagger", "dagger");
 7084: 	axl_hash_insert (hash, "katana", "katana");
 7085: 	axl_hash_insert (hash, "helmet", "helmet");
 7086: 	axl_hash_insert (hash, "chain", "chain");
 7087: 	axl_hash_insert (hash, "halberd", "halberd");
 7088: 	axl_hash_insert (hash, "pipe", "pipe");
 7089: 	axl_hash_insert (hash, "hat", "hat");
 7090: 	axl_hash_insert (hash, "eyeofnewt", "eyeofnewt");
 7091: 	axl_hash_insert (hash, "soup", "soup");
 7092: 	axl_hash_insert (hash, "wolfbane", "wolfbane");
 7093: 	axl_hash_insert (hash, "instantcoffee", "instantcoffee");
 7094: 	axl_hash_insert (hash, "bugspray", "bugspray");
 7095: 	axl_hash_insert (hash, "flint", "flint");
 7096: 	axl_hash_insert (hash, "soap", "soap");
 7097: 	axl_hash_insert (hash, "bones", "bones");
 7098: 	axl_hash_insert (hash, "orb", "orb");
 7099: 	axl_hash_insert (hash, "gold", "gold");
 7100: 	axl_hash_insert (hash, "silver", "silver");
 7101: 	axl_hash_insert (hash, "wine", "wine");
 7102: 	axl_hash_insert (hash, "bread", "bread");
 7103: 
 7104: 	axl_hash_insert (hash, "sword01", "sword01"); 
 7105: 	axl_hash_insert (hash, "mace01", "mace01");
 7106: 	axl_hash_insert (hash, "axe01", "axe01");
 7107: 	axl_hash_insert (hash, "arrow01", "arrow01");
 7108: 	axl_hash_insert (hash, "shield01", "shield01");
 7109: 	axl_hash_insert (hash, "bag01", "bag01");
 7110: 	axl_hash_insert (hash, "stone01", "stone01");
 7111: 	axl_hash_insert (hash, "key01", "key01");
 7112: 	axl_hash_insert (hash, "skull01", "skull01");
 7113: 	axl_hash_insert (hash, "jar01", "jar01");
 7114: 	axl_hash_insert (hash, "bottle01", "bottle01");
 7115: 	axl_hash_insert (hash, "fairy01", "fairy01");
 7116: 	axl_hash_insert (hash, "potion01", "potion01");
 7117: 	axl_hash_insert (hash, "water01", "water01");
 7118: 	axl_hash_insert (hash, "spoon01", "spoon01");
 7119: 	axl_hash_insert (hash, "book01", "book01");
 7120: 	axl_hash_insert (hash, "spear01", "spear01");
 7121: 	axl_hash_insert (hash, "dagger01", "dagger01");
 7122: 	axl_hash_insert (hash, "katana01", "katana01");
 7123: 	axl_hash_insert (hash, "helmet01", "helmet01");
 7124: 	axl_hash_insert (hash, "chain01", "chain01");
 7125: 	axl_hash_insert (hash, "halberd01", "halberd01");
 7126: 	axl_hash_insert (hash, "pipe01", "pipe01");
 7127: 	axl_hash_insert (hash, "hat01", "hat01");
 7128: 	axl_hash_insert (hash, "eyeofnewt01", "eyeofnewt01");
 7129: 	axl_hash_insert (hash, "soup01", "soup01");
 7130: 	axl_hash_insert (hash, "wolfbane01", "wolfbane01");
 7131: 	axl_hash_insert (hash, "instantcoffee01", "instantcoffee01");
 7132: 	axl_hash_insert (hash, "bugspray01", "bugspray01");
 7133: 	axl_hash_insert (hash, "flint01", "flint01");
 7134: 	axl_hash_insert (hash, "soap01", "soap01");
 7135: 	axl_hash_insert (hash, "bones01", "bones01");
 7136: 	axl_hash_insert (hash, "orb01", "orb01");
 7137: 	axl_hash_insert (hash, "gold01", "gold01");
 7138: 	axl_hash_insert (hash, "silver01", "silver01");
 7139: 	axl_hash_insert (hash, "wine01", "wine01");
 7140: 	axl_hash_insert (hash, "bread01", "bread01");
 7141: 
 7142: 	axl_hash_insert (hash, "sword02", "sword02"); 
 7143: 	axl_hash_insert (hash, "mace02", "mace02");
 7144: 	axl_hash_insert (hash, "axe02", "axe02");
 7145: 	axl_hash_insert (hash, "arrow02", "arrow02");
 7146: 	axl_hash_insert (hash, "shield02", "shield02");
 7147: 	axl_hash_insert (hash, "bag02", "bag02");
 7148: 	axl_hash_insert (hash, "stone02", "stone02");
 7149: 	axl_hash_insert (hash, "key02", "key02");
 7150: 	axl_hash_insert (hash, "skull02", "skull02");
 7151: 	axl_hash_insert (hash, "jar02", "jar02");
 7152: 	axl_hash_insert (hash, "bottle02", "bottle02");
 7153: 	axl_hash_insert (hash, "fairy02", "fairy02");
 7154: 	axl_hash_insert (hash, "potion02", "potion02");
 7155: 	axl_hash_insert (hash, "water02", "water02");
 7156: 	axl_hash_insert (hash, "spoon02", "spoon02");
 7157: 	axl_hash_insert (hash, "book02", "book02");
 7158: 	axl_hash_insert (hash, "spear02", "spear02");
 7159: 	axl_hash_insert (hash, "dagger02", "dagger02");
 7160: 	axl_hash_insert (hash, "katana02", "katana02");
 7161: 	axl_hash_insert (hash, "helmet02", "helmet02");
 7162: 	axl_hash_insert (hash, "chain02", "chain02");
 7163: 	axl_hash_insert (hash, "halberd02", "halberd02");
 7164: 	axl_hash_insert (hash, "pipe02", "pipe02");
 7165: 	axl_hash_insert (hash, "hat02", "hat02");
 7166: 	axl_hash_insert (hash, "eyeofnewt02", "eyeofnewt02");
 7167: 	axl_hash_insert (hash, "soup02", "soup02");
 7168: 	axl_hash_insert (hash, "wolfbane02", "wolfbane02");
 7169: 	axl_hash_insert (hash, "instantcoffee02", "instantcoffee02");
 7170: 	axl_hash_insert (hash, "bugspray02", "bugspray02");
 7171: 	axl_hash_insert (hash, "flint02", "flint02");
 7172: 	axl_hash_insert (hash, "soap02", "soap02");
 7173: 	axl_hash_insert (hash, "bones02", "bones02");
 7174: 	axl_hash_insert (hash, "orb02", "orb02");
 7175: 	axl_hash_insert (hash, "gold02", "gold02");
 7176: 	axl_hash_insert (hash, "silver02", "silver02");
 7177: 	axl_hash_insert (hash, "wine02", "wine02");
 7178: 	axl_hash_insert (hash, "bread02", "bread02");
 7179: 
 7180: 	axl_hash_insert (hash, "sword03", "sword03"); 
 7181: 	axl_hash_insert (hash, "mace03", "mace03");
 7182: 	axl_hash_insert (hash, "axe03", "axe03");
 7183: 	axl_hash_insert (hash, "arrow03", "arrow03");
 7184: 	axl_hash_insert (hash, "shield03", "shield03");
 7185: 	axl_hash_insert (hash, "bag03", "bag03");
 7186: 	axl_hash_insert (hash, "stone03", "stone03");
 7187: 	axl_hash_insert (hash, "key03", "key03");
 7188: 	axl_hash_insert (hash, "skull03", "skull03");
 7189: 	axl_hash_insert (hash, "jar03", "jar03");
 7190: 	axl_hash_insert (hash, "bottle03", "bottle03");
 7191: 	axl_hash_insert (hash, "fairy03", "fairy03");
 7192: 	axl_hash_insert (hash, "potion03", "potion03");
 7193: 	axl_hash_insert (hash, "water03", "water03");
 7194: 	axl_hash_insert (hash, "spoon03", "spoon03");
 7195: 	axl_hash_insert (hash, "book03", "book03");
 7196: 	axl_hash_insert (hash, "spear03", "spear03");
 7197: 	axl_hash_insert (hash, "dagger03", "dagger03");
 7198: 	axl_hash_insert (hash, "katana03", "katana03");
 7199: 	axl_hash_insert (hash, "helmet03", "helmet03");
 7200: 	axl_hash_insert (hash, "chain03", "chain03");
 7201: 	axl_hash_insert (hash, "halberd03", "halberd03");
 7202: 	axl_hash_insert (hash, "pipe03", "pipe03");
 7203: 	axl_hash_insert (hash, "hat03", "hat03");
 7204: 	axl_hash_insert (hash, "eyeofnewt03", "eyeofnewt03");
 7205: 	axl_hash_insert (hash, "soup03", "soup03");
 7206: 	axl_hash_insert (hash, "wolfbane03", "wolfbane03");
 7207: 	axl_hash_insert (hash, "instantcoffee03", "instantcoffee03");
 7208: 	axl_hash_insert (hash, "bugspray03", "bugspray03");
 7209: 	axl_hash_insert (hash, "flint03", "flint03");
 7210: 	axl_hash_insert (hash, "soap03", "soap03");
 7211: 	axl_hash_insert (hash, "bones03", "bones03");
 7212: 	axl_hash_insert (hash, "orb03", "orb03");
 7213: 	axl_hash_insert (hash, "gold03", "gold03");
 7214: 	axl_hash_insert (hash, "silver03", "silver03");
 7215: 	axl_hash_insert (hash, "wine03", "wine03");
 7216: 	axl_hash_insert (hash, "bread03", "bread03");
 7217: 
 7218: 	axl_hash_insert (hash, "sword04", "sword04"); 
 7219: 	axl_hash_insert (hash, "mace04", "mace04");
 7220: 	axl_hash_insert (hash, "axe04", "axe04");
 7221: 	axl_hash_insert (hash, "arrow04", "arrow04");
 7222: 	axl_hash_insert (hash, "shield04", "shield04");
 7223: 	axl_hash_insert (hash, "bag04", "bag04");
 7224: 	axl_hash_insert (hash, "stone04", "stone04");
 7225: 	axl_hash_insert (hash, "key04", "key04");
 7226: 	axl_hash_insert (hash, "skull04", "skull04");
 7227: 	axl_hash_insert (hash, "jar04", "jar04");
 7228: 	axl_hash_insert (hash, "bottle04", "bottle04");
 7229: 	axl_hash_insert (hash, "fairy04", "fairy04");
 7230: 	axl_hash_insert (hash, "potion04", "potion04");
 7231: 	axl_hash_insert (hash, "water04", "water04");
 7232: 	axl_hash_insert (hash, "spoon04", "spoon04");
 7233: 	axl_hash_insert (hash, "book04", "book04");
 7234: 	axl_hash_insert (hash, "spear04", "spear04");
 7235: 	axl_hash_insert (hash, "dagger04", "dagger04");
 7236: 	axl_hash_insert (hash, "katana04", "katana04");
 7237: 	axl_hash_insert (hash, "helmet04", "helmet04");
 7238: 	axl_hash_insert (hash, "chain04", "chain04");
 7239: 	axl_hash_insert (hash, "halberd04", "halberd04");
 7240: 	axl_hash_insert (hash, "pipe04", "pipe04");
 7241: 	axl_hash_insert (hash, "hat04", "hat04");
 7242: 	axl_hash_insert (hash, "eyeofnewt04", "eyeofnewt04");
 7243: 	axl_hash_insert (hash, "soup04", "soup04");
 7244: 	axl_hash_insert (hash, "wolfbane04", "wolfbane04");
 7245: 	axl_hash_insert (hash, "instantcoffee04", "instantcoffee04");
 7246: 	axl_hash_insert (hash, "bugspray04", "bugspray04");
 7247: 	axl_hash_insert (hash, "flint04", "flint04");
 7248: 	axl_hash_insert (hash, "soap04", "soap04");
 7249: 	axl_hash_insert (hash, "bones04", "bones04");
 7250: 	axl_hash_insert (hash, "orb04", "orb04");
 7251: 	axl_hash_insert (hash, "gold04", "gold04");
 7252: 	axl_hash_insert (hash, "silver04", "silver04");
 7253: 	axl_hash_insert (hash, "wine04", "wine04");
 7254: 	axl_hash_insert (hash, "bread04", "bread04");
 7255: 
 7256: 	axl_hash_insert (hash, "sword05", "sword05"); 
 7257: 	axl_hash_insert (hash, "mace05", "mace05");
 7258: 	axl_hash_insert (hash, "axe05", "axe05");
 7259: 	axl_hash_insert (hash, "arrow05", "arrow05");
 7260: 	axl_hash_insert (hash, "shield05", "shield05");
 7261: 	axl_hash_insert (hash, "bag05", "bag05");
 7262: 	axl_hash_insert (hash, "stone05", "stone05");
 7263: 	axl_hash_insert (hash, "key05", "key05");
 7264: 	axl_hash_insert (hash, "skull05", "skull05");
 7265: 	axl_hash_insert (hash, "jar05", "jar05");
 7266: 	axl_hash_insert (hash, "bottle05", "bottle05");
 7267: 	axl_hash_insert (hash, "fairy05", "fairy05");
 7268: 	axl_hash_insert (hash, "potion05", "potion05");
 7269: 	axl_hash_insert (hash, "water05", "water05");
 7270: 	axl_hash_insert (hash, "spoon05", "spoon05");
 7271: 	axl_hash_insert (hash, "book05", "book05");
 7272: 	axl_hash_insert (hash, "spear05", "spear05");
 7273: 	axl_hash_insert (hash, "dagger05", "dagger05");
 7274: 	axl_hash_insert (hash, "katana05", "katana05");
 7275: 	axl_hash_insert (hash, "helmet05", "helmet05");
 7276: 	axl_hash_insert (hash, "chain05", "chain05");
 7277: 	axl_hash_insert (hash, "halberd05", "halberd05");
 7278: 	axl_hash_insert (hash, "pipe05", "pipe05");
 7279: 	axl_hash_insert (hash, "hat05", "hat05");
 7280: 	axl_hash_insert (hash, "eyeofnewt05", "eyeofnewt05");
 7281: 	axl_hash_insert (hash, "soup05", "soup05");
 7282: 	axl_hash_insert (hash, "wolfbane05", "wolfbane05");
 7283: 	axl_hash_insert (hash, "instantcoffee05", "instantcoffee05");
 7284: 	axl_hash_insert (hash, "bugspray05", "bugspray05");
 7285: 	axl_hash_insert (hash, "flint05", "flint05");
 7286: 	axl_hash_insert (hash, "soap05", "soap05");
 7287: 	axl_hash_insert (hash, "bones05", "bones05");
 7288: 	axl_hash_insert (hash, "orb05", "orb05");
 7289: 	axl_hash_insert (hash, "gold05", "gold05");
 7290: 	axl_hash_insert (hash, "silver05", "silver05");
 7291: 	axl_hash_insert (hash, "wine05", "wine05");
 7292: 	axl_hash_insert (hash, "bread05", "bread05");
 7293: 
 7294: 	axl_hash_insert (hash, "sword06", "sword06"); 
 7295: 	axl_hash_insert (hash, "mace06", "mace06");
 7296: 	axl_hash_insert (hash, "axe06", "axe06");
 7297: 	axl_hash_insert (hash, "arrow06", "arrow06");
 7298: 	axl_hash_insert (hash, "shield06", "shield06");
 7299: 	axl_hash_insert (hash, "bag06", "bag06");
 7300: 	axl_hash_insert (hash, "stone06", "stone06");
 7301: 	axl_hash_insert (hash, "key06", "key06");
 7302: 	axl_hash_insert (hash, "skull06", "skull06");
 7303: 	axl_hash_insert (hash, "jar06", "jar06");
 7304: 	axl_hash_insert (hash, "bottle06", "bottle06");
 7305: 	axl_hash_insert (hash, "fairy06", "fairy06");
 7306: 	axl_hash_insert (hash, "potion06", "potion06");
 7307: 	axl_hash_insert (hash, "water06", "water06");
 7308: 	axl_hash_insert (hash, "spoon06", "spoon06");
 7309: 	axl_hash_insert (hash, "book06", "book06");
 7310: 	axl_hash_insert (hash, "spear06", "spear06");
 7311: 	axl_hash_insert (hash, "dagger06", "dagger06");
 7312: 	axl_hash_insert (hash, "katana06", "katana06");
 7313: 	axl_hash_insert (hash, "helmet06", "helmet06");
 7314: 	axl_hash_insert (hash, "chain06", "chain06");
 7315: 	axl_hash_insert (hash, "halberd06", "halberd06");
 7316: 	axl_hash_insert (hash, "pipe06", "pipe06");
 7317: 	axl_hash_insert (hash, "hat06", "hat06");
 7318: 	axl_hash_insert (hash, "eyeofnewt06", "eyeofnewt06");
 7319: 	axl_hash_insert (hash, "soup06", "soup06");
 7320: 	axl_hash_insert (hash, "wolfbane06", "wolfbane06");
 7321: 	axl_hash_insert (hash, "instantcoffee06", "instantcoffee06");
 7322: 	axl_hash_insert (hash, "bugspray06", "bugspray06");
 7323: 	axl_hash_insert (hash, "flint06", "flint06");
 7324: 	axl_hash_insert (hash, "soap06", "soap06");
 7325: 	axl_hash_insert (hash, "bones06", "bones06");
 7326: 	axl_hash_insert (hash, "orb06", "orb06");
 7327: 	axl_hash_insert (hash, "gold06", "gold06");
 7328: 	axl_hash_insert (hash, "silver06", "silver06");
 7329: 	axl_hash_insert (hash, "wine06", "wine06");
 7330: 	axl_hash_insert (hash, "bread06", "bread06");
 7331: 
 7332: 	axl_hash_insert (hash, "sword07", "sword07"); 
 7333: 	axl_hash_insert (hash, "mace07", "mace07");
 7334: 	axl_hash_insert (hash, "axe07", "axe07");
 7335: 	axl_hash_insert (hash, "arrow07", "arrow07");
 7336: 	axl_hash_insert (hash, "shield07", "shield07");
 7337: 	axl_hash_insert (hash, "bag07", "bag07");
 7338: 	axl_hash_insert (hash, "stone07", "stone07");
 7339: 	axl_hash_insert (hash, "key07", "key07");
 7340: 	axl_hash_insert (hash, "skull07", "skull07");
 7341: 	axl_hash_insert (hash, "jar07", "jar07");
 7342: 	axl_hash_insert (hash, "bottle07", "bottle07");
 7343: 	axl_hash_insert (hash, "fairy07", "fairy07");
 7344: 	axl_hash_insert (hash, "potion07", "potion07");
 7345: 	axl_hash_insert (hash, "water07", "water07");
 7346: 	axl_hash_insert (hash, "spoon07", "spoon07");
 7347: 	axl_hash_insert (hash, "book07", "book07");
 7348: 	axl_hash_insert (hash, "spear07", "spear07");
 7349: 	axl_hash_insert (hash, "dagger07", "dagger07");
 7350: 	axl_hash_insert (hash, "katana07", "katana07");
 7351: 	axl_hash_insert (hash, "helmet07", "helmet07");
 7352: 	axl_hash_insert (hash, "chain07", "chain07");
 7353: 	axl_hash_insert (hash, "halberd07", "halberd07");
 7354: 	axl_hash_insert (hash, "pipe07", "pipe07");
 7355: 	axl_hash_insert (hash, "hat07", "hat07");
 7356: 	axl_hash_insert (hash, "eyeofnewt07", "eyeofnewt07");
 7357: 	axl_hash_insert (hash, "soup07", "soup07");
 7358: 	axl_hash_insert (hash, "wolfbane07", "wolfbane07");
 7359: 	axl_hash_insert (hash, "instantcoffee07", "instantcoffee07");
 7360: 	axl_hash_insert (hash, "bugspray07", "bugspray07");
 7361: 	axl_hash_insert (hash, "flint07", "flint07");
 7362: 	axl_hash_insert (hash, "soap07", "soap07");
 7363: 	axl_hash_insert (hash, "bones07", "bones07");
 7364: 	axl_hash_insert (hash, "orb07", "orb07");
 7365: 	axl_hash_insert (hash, "gold07", "gold07");
 7366: 	axl_hash_insert (hash, "silver07", "silver07");
 7367: 	axl_hash_insert (hash, "wine07", "wine07");
 7368: 	axl_hash_insert (hash, "bread07", "bread07");
 7369: 
 7370: 	axl_hash_insert (hash, "sword08", "sword08"); 
 7371: 	axl_hash_insert (hash, "mace08", "mace08");
 7372: 	axl_hash_insert (hash, "axe08", "axe08");
 7373: 	axl_hash_insert (hash, "arrow08", "arrow08");
 7374: 	axl_hash_insert (hash, "shield08", "shield08");
 7375: 	axl_hash_insert (hash, "bag08", "bag08");
 7376: 	axl_hash_insert (hash, "stone08", "stone08");
 7377: 	axl_hash_insert (hash, "key08", "key08");
 7378: 	axl_hash_insert (hash, "skull08", "skull08");
 7379: 	axl_hash_insert (hash, "jar08", "jar08");
 7380: 	axl_hash_insert (hash, "bottle08", "bottle08");
 7381: 	axl_hash_insert (hash, "fairy08", "fairy08");
 7382: 	axl_hash_insert (hash, "potion08", "potion08");
 7383: 	axl_hash_insert (hash, "water08", "water08");
 7384: 	axl_hash_insert (hash, "spoon08", "spoon08");
 7385: 	axl_hash_insert (hash, "book08", "book08");
 7386: 	axl_hash_insert (hash, "spear08", "spear08");
 7387: 	axl_hash_insert (hash, "dagger08", "dagger08");
 7388: 	axl_hash_insert (hash, "katana08", "katana08");
 7389: 	axl_hash_insert (hash, "helmet08", "helmet08");
 7390: 	axl_hash_insert (hash, "chain08", "chain08");
 7391: 	axl_hash_insert (hash, "halberd08", "halberd08");
 7392: 	axl_hash_insert (hash, "pipe08", "pipe08");
 7393: 	axl_hash_insert (hash, "hat08", "hat08");
 7394: 	axl_hash_insert (hash, "eyeofnewt08", "eyeofnewt08");
 7395: 	axl_hash_insert (hash, "soup08", "soup08");
 7396: 	axl_hash_insert (hash, "wolfbane08", "wolfbane08");
 7397: 	axl_hash_insert (hash, "instantcoffee08", "instantcoffee08");
 7398: 	axl_hash_insert (hash, "bugspray08", "bugspray08");
 7399: 	axl_hash_insert (hash, "flint08", "flint08");
 7400: 	axl_hash_insert (hash, "soap08", "soap08");
 7401: 	axl_hash_insert (hash, "bones08", "bones08");
 7402: 	axl_hash_insert (hash, "orb08", "orb08");
 7403: 	axl_hash_insert (hash, "gold08", "gold08");
 7404: 	axl_hash_insert (hash, "silver08", "silver08");
 7405: 	axl_hash_insert (hash, "wine08", "wine08");
 7406: 	axl_hash_insert (hash, "bread08", "bread08");
 7407: 
 7408: 	axl_hash_insert (hash, "sword09", "sword09"); 
 7409: 	axl_hash_insert (hash, "mace09", "mace09");
 7410: 	axl_hash_insert (hash, "axe09", "axe09");
 7411: 	axl_hash_insert (hash, "arrow09", "arrow09");
 7412: 	axl_hash_insert (hash, "shield09", "shield09");
 7413: 	axl_hash_insert (hash, "bag09", "bag09");
 7414: 	axl_hash_insert (hash, "stone09", "stone09");
 7415: 	axl_hash_insert (hash, "key09", "key09");
 7416: 	axl_hash_insert (hash, "skull09", "skull09");
 7417: 	axl_hash_insert (hash, "jar09", "jar09");
 7418: 	axl_hash_insert (hash, "bottle09", "bottle09");
 7419: 	axl_hash_insert (hash, "fairy09", "fairy09");
 7420: 	axl_hash_insert (hash, "potion09", "potion09");
 7421: 	axl_hash_insert (hash, "water09", "water09");
 7422: 	axl_hash_insert (hash, "spoon09", "spoon09");
 7423: 	axl_hash_insert (hash, "book09", "book09");
 7424: 	axl_hash_insert (hash, "spear09", "spear09");
 7425: 	axl_hash_insert (hash, "dagger09", "dagger09");
 7426: 	axl_hash_insert (hash, "katana09", "katana09");
 7427: 	axl_hash_insert (hash, "helmet09", "helmet09");
 7428: 	axl_hash_insert (hash, "chain09", "chain09");
 7429: 	axl_hash_insert (hash, "halberd09", "halberd09");
 7430: 	axl_hash_insert (hash, "pipe09", "pipe09");
 7431: 	axl_hash_insert (hash, "hat09", "hat09");
 7432: 	axl_hash_insert (hash, "eyeofnewt09", "eyeofnewt09");
 7433: 	axl_hash_insert (hash, "soup09", "soup09");
 7434: 	axl_hash_insert (hash, "wolfbane09", "wolfbane09");
 7435: 	axl_hash_insert (hash, "instantcoffee09", "instantcoffee09");
 7436: 	axl_hash_insert (hash, "bugspray09", "bugspray09");
 7437: 	axl_hash_insert (hash, "flint09", "flint09");
 7438: 	axl_hash_insert (hash, "soap09", "soap09");
 7439: 	axl_hash_insert (hash, "bones09", "bones09");
 7440: 	axl_hash_insert (hash, "orb09", "orb09");
 7441: 	axl_hash_insert (hash, "gold09", "gold09");
 7442: 	axl_hash_insert (hash, "silver09", "silver09");
 7443: 	axl_hash_insert (hash, "wine09", "wine09");
 7444: 	axl_hash_insert (hash, "bread09", "bread09");
 7445: 
 7446: 	axl_hash_insert (hash, "sword10", "sword10"); 
 7447: 	axl_hash_insert (hash, "mace10", "mace10");
 7448: 	axl_hash_insert (hash, "axe10", "axe10");
 7449: 	axl_hash_insert (hash, "arrow10", "arrow10");
 7450: 	axl_hash_insert (hash, "shield10", "shield10");
 7451: 	axl_hash_insert (hash, "bag10", "bag10");
 7452: 	axl_hash_insert (hash, "stone10", "stone10");
 7453: 	axl_hash_insert (hash, "key10", "key10");
 7454: 	axl_hash_insert (hash, "skull10", "skull10");
 7455: 	axl_hash_insert (hash, "jar10", "jar10");
 7456: 	axl_hash_insert (hash, "bottle10", "bottle10");
 7457: 	axl_hash_insert (hash, "fairy10", "fairy10");
 7458: 	axl_hash_insert (hash, "potion10", "potion10");
 7459: 	axl_hash_insert (hash, "water10", "water10");
 7460: 	axl_hash_insert (hash, "spoon10", "spoon10");
 7461: 	axl_hash_insert (hash, "book10", "book10");
 7462: 	axl_hash_insert (hash, "spear10", "spear10");
 7463: 	axl_hash_insert (hash, "dagger10", "dagger10");
 7464: 	axl_hash_insert (hash, "katana10", "katana10");
 7465: 	axl_hash_insert (hash, "helmet10", "helmet10");
 7466: 	axl_hash_insert (hash, "chain10", "chain10");
 7467: 	axl_hash_insert (hash, "halberd10", "halberd10");
 7468: 	axl_hash_insert (hash, "pipe10", "pipe10");
 7469: 	axl_hash_insert (hash, "hat10", "hat10");
 7470: 	axl_hash_insert (hash, "eyeofnewt10", "eyeofnewt10");
 7471: 	axl_hash_insert (hash, "soup10", "soup10");
 7472: 	axl_hash_insert (hash, "wolfbane10", "wolfbane10");
 7473: 	axl_hash_insert (hash, "instantcoffee10", "instantcoffee10");
 7474: 	axl_hash_insert (hash, "bugspray10", "bugspray10");
 7475: 	axl_hash_insert (hash, "flint10", "flint10");
 7476: 	axl_hash_insert (hash, "soap10", "soap10");
 7477: 	axl_hash_insert (hash, "bones10", "bones10");
 7478: 	axl_hash_insert (hash, "orb10", "orb10");
 7479: 	axl_hash_insert (hash, "gold10", "gold10");
 7480: 	axl_hash_insert (hash, "silver10", "silver10");
 7481: 	axl_hash_insert (hash, "wine10", "wine10");
 7482: 	axl_hash_insert (hash, "bread10", "bread10");
 7483: 
 7484: 	axl_hash_insert (hash, "sword11", "sword11"); 
 7485: 	axl_hash_insert (hash, "mace11", "mace11");
 7486: 	axl_hash_insert (hash, "axe11", "axe11");
 7487: 	axl_hash_insert (hash, "arrow11", "arrow11");
 7488: 	axl_hash_insert (hash, "shield11", "shield11");
 7489: 	axl_hash_insert (hash, "bag11", "bag11");
 7490: 	axl_hash_insert (hash, "stone11", "stone11");
 7491: 	axl_hash_insert (hash, "key11", "key11");
 7492: 	axl_hash_insert (hash, "skull11", "skull11");
 7493: 	axl_hash_insert (hash, "jar11", "jar11");
 7494: 	axl_hash_insert (hash, "bottle11", "bottle11");
 7495: 	axl_hash_insert (hash, "fairy11", "fairy11");
 7496: 	axl_hash_insert (hash, "potion11", "potion11");
 7497: 	axl_hash_insert (hash, "water11", "water11");
 7498: 	axl_hash_insert (hash, "spoon11", "spoon11");
 7499: 	axl_hash_insert (hash, "book11", "book11");
 7500: 	axl_hash_insert (hash, "spear11", "spear11");
 7501: 	axl_hash_insert (hash, "dagger11", "dagger11");
 7502: 	axl_hash_insert (hash, "katana11", "katana11");
 7503: 	axl_hash_insert (hash, "helmet11", "helmet11");
 7504: 	axl_hash_insert (hash, "chain11", "chain11");
 7505: 	axl_hash_insert (hash, "halberd11", "halberd11");
 7506: 	axl_hash_insert (hash, "pipe11", "pipe11");
 7507: 	axl_hash_insert (hash, "hat11", "hat11");
 7508: 	axl_hash_insert (hash, "eyeofnewt11", "eyeofnewt11");
 7509: 	axl_hash_insert (hash, "soup11", "soup11");
 7510: 	axl_hash_insert (hash, "wolfbane11", "wolfbane11");
 7511: 	axl_hash_insert (hash, "instantcoffee11", "instantcoffee11");
 7512: 	axl_hash_insert (hash, "bugspray11", "bugspray11");
 7513: 	axl_hash_insert (hash, "flint11", "flint11");
 7514: 	axl_hash_insert (hash, "soap11", "soap11");
 7515: 	axl_hash_insert (hash, "bones11", "bones11");
 7516: 	axl_hash_insert (hash, "orb11", "orb11");
 7517: 	axl_hash_insert (hash, "gold11", "gold11");
 7518: 	axl_hash_insert (hash, "silver11", "silver11");
 7519: 	axl_hash_insert (hash, "wine11", "wine11");
 7520: 	axl_hash_insert (hash, "bread11", "bread11");
 7521: 
 7522: 	/* show hash status */
 7523: 	axl_hash_show_status  (hash);
 7524: 
 7525: 	/* perform checks */
 7526: 	iterator = 0;
 7527: 	while (iterator < 1000) {
 7528: 
 7529: 		/* get values and check them */
 7530: 		test_02_02_check_key (hash, "bag");
 7531: 		test_02_02_check_key (hash, "sword"); 
 7532: 		test_02_02_check_key (hash, "mace");
 7533: 		test_02_02_check_key (hash, "axe");
 7534: 		test_02_02_check_key (hash, "arrow");
 7535: 		test_02_02_check_key (hash, "shield");
 7536: 		test_02_02_check_key (hash, "bag");
 7537: 		test_02_02_check_key (hash, "stone");
 7538: 		test_02_02_check_key (hash, "key");
 7539: 		test_02_02_check_key (hash, "skull");
 7540: 		test_02_02_check_key (hash, "jar");
 7541: 		test_02_02_check_key (hash, "bottle");
 7542: 		test_02_02_check_key (hash, "fairy");
 7543: 		test_02_02_check_key (hash, "potion");
 7544: 		test_02_02_check_key (hash, "water");
 7545: 		test_02_02_check_key (hash, "spoon");
 7546: 		test_02_02_check_key (hash, "book");
 7547: 		test_02_02_check_key (hash, "spear");
 7548: 		test_02_02_check_key (hash, "dagger");
 7549: 		test_02_02_check_key (hash, "katana");
 7550: 		test_02_02_check_key (hash, "helmet");
 7551: 		test_02_02_check_key (hash, "chain");
 7552: 		test_02_02_check_key (hash, "halberd");
 7553: 		test_02_02_check_key (hash, "pipe");
 7554: 		test_02_02_check_key (hash, "hat");
 7555: 		test_02_02_check_key (hash, "eyeofnewt");
 7556: 		test_02_02_check_key (hash, "soup");
 7557: 		test_02_02_check_key (hash, "wolfbane");
 7558: 		test_02_02_check_key (hash, "instantcoffee");
 7559: 		test_02_02_check_key (hash, "bugspray");
 7560: 		test_02_02_check_key (hash, "flint");
 7561: 		test_02_02_check_key (hash, "soap");
 7562: 		test_02_02_check_key (hash, "bones");
 7563: 		test_02_02_check_key (hash, "orb");
 7564: 		test_02_02_check_key (hash, "gold");
 7565: 		test_02_02_check_key (hash, "silver");
 7566: 		test_02_02_check_key (hash, "wine");
 7567: 		test_02_02_check_key (hash, "bread");
 7568: 		
 7569: 		test_02_02_check_key (hash, "bag01");
 7570: 		test_02_02_check_key (hash, "sword01"); 
 7571: 		test_02_02_check_key (hash, "mace01");
 7572: 		test_02_02_check_key (hash, "axe01");
 7573: 		test_02_02_check_key (hash, "arrow01");
 7574: 		test_02_02_check_key (hash, "shield01");
 7575: 		test_02_02_check_key (hash, "bag01");
 7576: 		test_02_02_check_key (hash, "stone01");
 7577: 		test_02_02_check_key (hash, "key01");
 7578: 		test_02_02_check_key (hash, "skull01");
 7579: 		test_02_02_check_key (hash, "jar01");
 7580: 		test_02_02_check_key (hash, "bottle01");
 7581: 		test_02_02_check_key (hash, "fairy01");
 7582: 		test_02_02_check_key (hash, "potion01");
 7583: 		test_02_02_check_key (hash, "water01");
 7584: 		test_02_02_check_key (hash, "spoon01");
 7585: 		test_02_02_check_key (hash, "book01");
 7586: 		test_02_02_check_key (hash, "spear01");
 7587: 		test_02_02_check_key (hash, "dagger01");
 7588: 		test_02_02_check_key (hash, "katana01");
 7589: 		test_02_02_check_key (hash, "helmet01");
 7590: 		test_02_02_check_key (hash, "chain01");
 7591: 		test_02_02_check_key (hash, "halberd01");
 7592: 		test_02_02_check_key (hash, "pipe01");
 7593: 		test_02_02_check_key (hash, "hat01");
 7594: 		test_02_02_check_key (hash, "eyeofnewt01");
 7595: 		test_02_02_check_key (hash, "soup01");
 7596: 		test_02_02_check_key (hash, "wolfbane01");
 7597: 		test_02_02_check_key (hash, "instantcoffee01");
 7598: 		test_02_02_check_key (hash, "bugspray01");
 7599: 		test_02_02_check_key (hash, "flint01");
 7600: 		test_02_02_check_key (hash, "soap01");
 7601: 		test_02_02_check_key (hash, "bones01");
 7602: 		test_02_02_check_key (hash, "orb01");
 7603: 		test_02_02_check_key (hash, "gold01");
 7604: 		test_02_02_check_key (hash, "silver01");
 7605: 		test_02_02_check_key (hash, "wine01");
 7606: 		test_02_02_check_key (hash, "bread01");
 7607: 		
 7608: 		test_02_02_check_key (hash, "bag02");
 7609: 		test_02_02_check_key (hash, "sword02"); 
 7610: 		test_02_02_check_key (hash, "mace02");
 7611: 		test_02_02_check_key (hash, "axe02");
 7612: 		test_02_02_check_key (hash, "arrow02");
 7613: 		test_02_02_check_key (hash, "shield02");
 7614: 		test_02_02_check_key (hash, "bag02");
 7615: 		test_02_02_check_key (hash, "stone02");
 7616: 		test_02_02_check_key (hash, "key02");
 7617: 		test_02_02_check_key (hash, "skull02");
 7618: 		test_02_02_check_key (hash, "jar02");
 7619: 		test_02_02_check_key (hash, "bottle02");
 7620: 		test_02_02_check_key (hash, "fairy02");
 7621: 		test_02_02_check_key (hash, "potion02");
 7622: 		test_02_02_check_key (hash, "water02");
 7623: 		test_02_02_check_key (hash, "spoon02");
 7624: 		test_02_02_check_key (hash, "book02");
 7625: 		test_02_02_check_key (hash, "spear02");
 7626: 		test_02_02_check_key (hash, "dagger02");
 7627: 		test_02_02_check_key (hash, "katana02");
 7628: 		test_02_02_check_key (hash, "helmet02");
 7629: 		test_02_02_check_key (hash, "chain02");
 7630: 		test_02_02_check_key (hash, "halberd02");
 7631: 		test_02_02_check_key (hash, "pipe02");
 7632: 		test_02_02_check_key (hash, "hat02");
 7633: 		test_02_02_check_key (hash, "eyeofnewt02");
 7634: 		test_02_02_check_key (hash, "soup02");
 7635: 		test_02_02_check_key (hash, "wolfbane02");
 7636: 		test_02_02_check_key (hash, "instantcoffee02");
 7637: 		test_02_02_check_key (hash, "bugspray02");
 7638: 		test_02_02_check_key (hash, "flint02");
 7639: 		test_02_02_check_key (hash, "soap02");
 7640: 		test_02_02_check_key (hash, "bones02");
 7641: 		test_02_02_check_key (hash, "orb02");
 7642: 		test_02_02_check_key (hash, "gold02");
 7643: 		test_02_02_check_key (hash, "silver02");
 7644: 		test_02_02_check_key (hash, "wine02");
 7645: 		test_02_02_check_key (hash, "bread02");
 7646: 
 7647: 		test_02_02_check_key (hash, "bag03");
 7648: 		test_02_02_check_key (hash, "sword03"); 
 7649: 		test_02_02_check_key (hash, "mace03");
 7650: 		test_02_02_check_key (hash, "axe03");
 7651: 		test_02_02_check_key (hash, "arrow03");
 7652: 		test_02_02_check_key (hash, "shield03");
 7653: 		test_02_02_check_key (hash, "bag03");
 7654: 		test_02_02_check_key (hash, "stone03");
 7655: 		test_02_02_check_key (hash, "key03");
 7656: 		test_02_02_check_key (hash, "skull03");
 7657: 		test_02_02_check_key (hash, "jar03");
 7658: 		test_02_02_check_key (hash, "bottle03");
 7659: 		test_02_02_check_key (hash, "fairy03");
 7660: 		test_02_02_check_key (hash, "potion03");
 7661: 		test_02_02_check_key (hash, "water03");
 7662: 		test_02_02_check_key (hash, "spoon03");
 7663: 		test_02_02_check_key (hash, "book03");
 7664: 		test_02_02_check_key (hash, "spear03");
 7665: 		test_02_02_check_key (hash, "dagger03");
 7666: 		test_02_02_check_key (hash, "katana03");
 7667: 		test_02_02_check_key (hash, "helmet03");
 7668: 		test_02_02_check_key (hash, "chain03");
 7669: 		test_02_02_check_key (hash, "halberd03");
 7670: 		test_02_02_check_key (hash, "pipe03");
 7671: 		test_02_02_check_key (hash, "hat03");
 7672: 		test_02_02_check_key (hash, "eyeofnewt03");
 7673: 		test_02_02_check_key (hash, "soup03");
 7674: 		test_02_02_check_key (hash, "wolfbane03");
 7675: 		test_02_02_check_key (hash, "instantcoffee03");
 7676: 		test_02_02_check_key (hash, "bugspray03");
 7677: 		test_02_02_check_key (hash, "flint03");
 7678: 		test_02_02_check_key (hash, "soap03");
 7679: 		test_02_02_check_key (hash, "bones03");
 7680: 		test_02_02_check_key (hash, "orb03");
 7681: 		test_02_02_check_key (hash, "gold03");
 7682: 		test_02_02_check_key (hash, "silver03");
 7683: 		test_02_02_check_key (hash, "wine03");
 7684: 		test_02_02_check_key (hash, "bread03");
 7685: 
 7686: 		test_02_02_check_key (hash, "bag04");
 7687: 		test_02_02_check_key (hash, "sword04"); 
 7688: 		test_02_02_check_key (hash, "mace04");
 7689: 		test_02_02_check_key (hash, "axe04");
 7690: 		test_02_02_check_key (hash, "arrow04");
 7691: 		test_02_02_check_key (hash, "shield04");
 7692: 		test_02_02_check_key (hash, "bag04");
 7693: 		test_02_02_check_key (hash, "stone04");
 7694: 		test_02_02_check_key (hash, "key04");
 7695: 		test_02_02_check_key (hash, "skull04");
 7696: 		test_02_02_check_key (hash, "jar04");
 7697: 		test_02_02_check_key (hash, "bottle04");
 7698: 		test_02_02_check_key (hash, "fairy04");
 7699: 		test_02_02_check_key (hash, "potion04");
 7700: 		test_02_02_check_key (hash, "water04");
 7701: 		test_02_02_check_key (hash, "spoon04");
 7702: 		test_02_02_check_key (hash, "book04");
 7703: 		test_02_02_check_key (hash, "spear04");
 7704: 		test_02_02_check_key (hash, "dagger04");
 7705: 		test_02_02_check_key (hash, "katana04");
 7706: 		test_02_02_check_key (hash, "helmet04");
 7707: 		test_02_02_check_key (hash, "chain04");
 7708: 		test_02_02_check_key (hash, "halberd04");
 7709: 		test_02_02_check_key (hash, "pipe04");
 7710: 		test_02_02_check_key (hash, "hat04");
 7711: 		test_02_02_check_key (hash, "eyeofnewt04");
 7712: 		test_02_02_check_key (hash, "soup04");
 7713: 		test_02_02_check_key (hash, "wolfbane04");
 7714: 		test_02_02_check_key (hash, "instantcoffee04");
 7715: 		test_02_02_check_key (hash, "bugspray04");
 7716: 		test_02_02_check_key (hash, "flint04");
 7717: 		test_02_02_check_key (hash, "soap04");
 7718: 		test_02_02_check_key (hash, "bones04");
 7719: 		test_02_02_check_key (hash, "orb04");
 7720: 		test_02_02_check_key (hash, "gold04");
 7721: 		test_02_02_check_key (hash, "silver04");
 7722: 		test_02_02_check_key (hash, "wine04");
 7723: 		test_02_02_check_key (hash, "bread04");
 7724: 
 7725: 		test_02_02_check_key (hash, "bag05");
 7726: 		test_02_02_check_key (hash, "sword05"); 
 7727: 		test_02_02_check_key (hash, "mace05");
 7728: 		test_02_02_check_key (hash, "axe05");
 7729: 		test_02_02_check_key (hash, "arrow05");
 7730: 		test_02_02_check_key (hash, "shield05");
 7731: 		test_02_02_check_key (hash, "bag05");
 7732: 		test_02_02_check_key (hash, "stone05");
 7733: 		test_02_02_check_key (hash, "key05");
 7734: 		test_02_02_check_key (hash, "skull05");
 7735: 		test_02_02_check_key (hash, "jar05");
 7736: 		test_02_02_check_key (hash, "bottle05");
 7737: 		test_02_02_check_key (hash, "fairy05");
 7738: 		test_02_02_check_key (hash, "potion05");
 7739: 		test_02_02_check_key (hash, "water05");
 7740: 		test_02_02_check_key (hash, "spoon05");
 7741: 		test_02_02_check_key (hash, "book05");
 7742: 		test_02_02_check_key (hash, "spear05");
 7743: 		test_02_02_check_key (hash, "dagger05");
 7744: 		test_02_02_check_key (hash, "katana05");
 7745: 		test_02_02_check_key (hash, "helmet05");
 7746: 		test_02_02_check_key (hash, "chain05");
 7747: 		test_02_02_check_key (hash, "halberd05");
 7748: 		test_02_02_check_key (hash, "pipe05");
 7749: 		test_02_02_check_key (hash, "hat05");
 7750: 		test_02_02_check_key (hash, "eyeofnewt05");
 7751: 		test_02_02_check_key (hash, "soup05");
 7752: 		test_02_02_check_key (hash, "wolfbane05");
 7753: 		test_02_02_check_key (hash, "instantcoffee05");
 7754: 		test_02_02_check_key (hash, "bugspray05");
 7755: 		test_02_02_check_key (hash, "flint05");
 7756: 		test_02_02_check_key (hash, "soap05");
 7757: 		test_02_02_check_key (hash, "bones05");
 7758: 		test_02_02_check_key (hash, "orb05");
 7759: 		test_02_02_check_key (hash, "gold05");
 7760: 		test_02_02_check_key (hash, "silver05");
 7761: 		test_02_02_check_key (hash, "wine05");
 7762: 		test_02_02_check_key (hash, "bread05");
 7763: 
 7764: 		test_02_02_check_key (hash, "bag06");
 7765: 		test_02_02_check_key (hash, "sword06"); 
 7766: 		test_02_02_check_key (hash, "mace06");
 7767: 		test_02_02_check_key (hash, "axe06");
 7768: 		test_02_02_check_key (hash, "arrow06");
 7769: 		test_02_02_check_key (hash, "shield06");
 7770: 		test_02_02_check_key (hash, "bag06");
 7771: 		test_02_02_check_key (hash, "stone06");
 7772: 		test_02_02_check_key (hash, "key06");
 7773: 		test_02_02_check_key (hash, "skull06");
 7774: 		test_02_02_check_key (hash, "jar06");
 7775: 		test_02_02_check_key (hash, "bottle06");
 7776: 		test_02_02_check_key (hash, "fairy06");
 7777: 		test_02_02_check_key (hash, "potion06");
 7778: 		test_02_02_check_key (hash, "water06");
 7779: 		test_02_02_check_key (hash, "spoon06");
 7780: 		test_02_02_check_key (hash, "book06");
 7781: 		test_02_02_check_key (hash, "spear06");
 7782: 		test_02_02_check_key (hash, "dagger06");
 7783: 		test_02_02_check_key (hash, "katana06");
 7784: 		test_02_02_check_key (hash, "helmet06");
 7785: 		test_02_02_check_key (hash, "chain06");
 7786: 		test_02_02_check_key (hash, "halberd06");
 7787: 		test_02_02_check_key (hash, "pipe06");
 7788: 		test_02_02_check_key (hash, "hat06");
 7789: 		test_02_02_check_key (hash, "eyeofnewt06");
 7790: 		test_02_02_check_key (hash, "soup06");
 7791: 		test_02_02_check_key (hash, "wolfbane06");
 7792: 		test_02_02_check_key (hash, "instantcoffee06");
 7793: 		test_02_02_check_key (hash, "bugspray06");
 7794: 		test_02_02_check_key (hash, "flint06");
 7795: 		test_02_02_check_key (hash, "soap06");
 7796: 		test_02_02_check_key (hash, "bones06");
 7797: 		test_02_02_check_key (hash, "orb06");
 7798: 		test_02_02_check_key (hash, "gold06");
 7799: 		test_02_02_check_key (hash, "silver06");
 7800: 		test_02_02_check_key (hash, "wine06");
 7801: 		test_02_02_check_key (hash, "bread06");
 7802: 
 7803: 		test_02_02_check_key (hash, "bag07");
 7804: 		test_02_02_check_key (hash, "sword07"); 
 7805: 		test_02_02_check_key (hash, "mace07");
 7806: 		test_02_02_check_key (hash, "axe07");
 7807: 		test_02_02_check_key (hash, "arrow07");
 7808: 		test_02_02_check_key (hash, "shield07");
 7809: 		test_02_02_check_key (hash, "bag07");
 7810: 		test_02_02_check_key (hash, "stone07");
 7811: 		test_02_02_check_key (hash, "key07");
 7812: 		test_02_02_check_key (hash, "skull07");
 7813: 		test_02_02_check_key (hash, "jar07");
 7814: 		test_02_02_check_key (hash, "bottle07");
 7815: 		test_02_02_check_key (hash, "fairy07");
 7816: 		test_02_02_check_key (hash, "potion07");
 7817: 		test_02_02_check_key (hash, "water07");
 7818: 		test_02_02_check_key (hash, "spoon07");
 7819: 		test_02_02_check_key (hash, "book07");
 7820: 		test_02_02_check_key (hash, "spear07");
 7821: 		test_02_02_check_key (hash, "dagger07");
 7822: 		test_02_02_check_key (hash, "katana07");
 7823: 		test_02_02_check_key (hash, "helmet07");
 7824: 		test_02_02_check_key (hash, "chain07");
 7825: 		test_02_02_check_key (hash, "halberd07");
 7826: 		test_02_02_check_key (hash, "pipe07");
 7827: 		test_02_02_check_key (hash, "hat07");
 7828: 		test_02_02_check_key (hash, "eyeofnewt07");
 7829: 		test_02_02_check_key (hash, "soup07");
 7830: 		test_02_02_check_key (hash, "wolfbane07");
 7831: 		test_02_02_check_key (hash, "instantcoffee07");
 7832: 		test_02_02_check_key (hash, "bugspray07");
 7833: 		test_02_02_check_key (hash, "flint07");
 7834: 		test_02_02_check_key (hash, "soap07");
 7835: 		test_02_02_check_key (hash, "bones07");
 7836: 		test_02_02_check_key (hash, "orb07");
 7837: 		test_02_02_check_key (hash, "gold07");
 7838: 		test_02_02_check_key (hash, "silver07");
 7839: 		test_02_02_check_key (hash, "wine07");
 7840: 		test_02_02_check_key (hash, "bread07");
 7841: 
 7842: 		test_02_02_check_key (hash, "bag08");
 7843: 		test_02_02_check_key (hash, "sword08"); 
 7844: 		test_02_02_check_key (hash, "mace08");
 7845: 		test_02_02_check_key (hash, "axe08");
 7846: 		test_02_02_check_key (hash, "arrow08");
 7847: 		test_02_02_check_key (hash, "shield08");
 7848: 		test_02_02_check_key (hash, "bag08");
 7849: 		test_02_02_check_key (hash, "stone08");
 7850: 		test_02_02_check_key (hash, "key08");
 7851: 		test_02_02_check_key (hash, "skull08");
 7852: 		test_02_02_check_key (hash, "jar08");
 7853: 		test_02_02_check_key (hash, "bottle08");
 7854: 		test_02_02_check_key (hash, "fairy08");
 7855: 		test_02_02_check_key (hash, "potion08");
 7856: 		test_02_02_check_key (hash, "water08");
 7857: 		test_02_02_check_key (hash, "spoon08");
 7858: 		test_02_02_check_key (hash, "book08");
 7859: 		test_02_02_check_key (hash, "spear08");
 7860: 		test_02_02_check_key (hash, "dagger08");
 7861: 		test_02_02_check_key (hash, "katana08");
 7862: 		test_02_02_check_key (hash, "helmet08");
 7863: 		test_02_02_check_key (hash, "chain08");
 7864: 		test_02_02_check_key (hash, "halberd08");
 7865: 		test_02_02_check_key (hash, "pipe08");
 7866: 		test_02_02_check_key (hash, "hat08");
 7867: 		test_02_02_check_key (hash, "eyeofnewt08");
 7868: 		test_02_02_check_key (hash, "soup08");
 7869: 		test_02_02_check_key (hash, "wolfbane08");
 7870: 		test_02_02_check_key (hash, "instantcoffee08");
 7871: 		test_02_02_check_key (hash, "bugspray08");
 7872: 		test_02_02_check_key (hash, "flint08");
 7873: 		test_02_02_check_key (hash, "soap08");
 7874: 		test_02_02_check_key (hash, "bones08");
 7875: 		test_02_02_check_key (hash, "orb08");
 7876: 		test_02_02_check_key (hash, "gold08");
 7877: 		test_02_02_check_key (hash, "silver08");
 7878: 		test_02_02_check_key (hash, "wine08");
 7879: 		test_02_02_check_key (hash, "bread08");
 7880: 
 7881: 		test_02_02_check_key (hash, "bag09");
 7882: 		test_02_02_check_key (hash, "sword09"); 
 7883: 		test_02_02_check_key (hash, "mace09");
 7884: 		test_02_02_check_key (hash, "axe09");
 7885: 		test_02_02_check_key (hash, "arrow09");
 7886: 		test_02_02_check_key (hash, "shield09");
 7887: 		test_02_02_check_key (hash, "bag09");
 7888: 		test_02_02_check_key (hash, "stone09");
 7889: 		test_02_02_check_key (hash, "key09");
 7890: 		test_02_02_check_key (hash, "skull09");
 7891: 		test_02_02_check_key (hash, "jar09");
 7892: 		test_02_02_check_key (hash, "bottle09");
 7893: 		test_02_02_check_key (hash, "fairy09");
 7894: 		test_02_02_check_key (hash, "potion09");
 7895: 		test_02_02_check_key (hash, "water09");
 7896: 		test_02_02_check_key (hash, "spoon09");
 7897: 		test_02_02_check_key (hash, "book09");
 7898: 		test_02_02_check_key (hash, "spear09");
 7899: 		test_02_02_check_key (hash, "dagger09");
 7900: 		test_02_02_check_key (hash, "katana09");
 7901: 		test_02_02_check_key (hash, "helmet09");
 7902: 		test_02_02_check_key (hash, "chain09");
 7903: 		test_02_02_check_key (hash, "halberd09");
 7904: 		test_02_02_check_key (hash, "pipe09");
 7905: 		test_02_02_check_key (hash, "hat09");
 7906: 		test_02_02_check_key (hash, "eyeofnewt09");
 7907: 		test_02_02_check_key (hash, "soup09");
 7908: 		test_02_02_check_key (hash, "wolfbane09");
 7909: 		test_02_02_check_key (hash, "instantcoffee09");
 7910: 		test_02_02_check_key (hash, "bugspray09");
 7911: 		test_02_02_check_key (hash, "flint09");
 7912: 		test_02_02_check_key (hash, "soap09");
 7913: 		test_02_02_check_key (hash, "bones09");
 7914: 		test_02_02_check_key (hash, "orb09");
 7915: 		test_02_02_check_key (hash, "gold09");
 7916: 		test_02_02_check_key (hash, "silver09");
 7917: 		test_02_02_check_key (hash, "wine09");
 7918: 		test_02_02_check_key (hash, "bread09");
 7919: 
 7920: 		test_02_02_check_key (hash, "bag10");
 7921: 		test_02_02_check_key (hash, "sword10"); 
 7922: 		test_02_02_check_key (hash, "mace10");
 7923: 		test_02_02_check_key (hash, "axe10");
 7924: 		test_02_02_check_key (hash, "arrow10");
 7925: 		test_02_02_check_key (hash, "shield10");
 7926: 		test_02_02_check_key (hash, "bag10");
 7927: 		test_02_02_check_key (hash, "stone10");
 7928: 		test_02_02_check_key (hash, "key10");
 7929: 		test_02_02_check_key (hash, "skull10");
 7930: 		test_02_02_check_key (hash, "jar10");
 7931: 		test_02_02_check_key (hash, "bottle10");
 7932: 		test_02_02_check_key (hash, "fairy10");
 7933: 		test_02_02_check_key (hash, "potion10");
 7934: 		test_02_02_check_key (hash, "water10");
 7935: 		test_02_02_check_key (hash, "spoon10");
 7936: 		test_02_02_check_key (hash, "book10");
 7937: 		test_02_02_check_key (hash, "spear10");
 7938: 		test_02_02_check_key (hash, "dagger10");
 7939: 		test_02_02_check_key (hash, "katana10");
 7940: 		test_02_02_check_key (hash, "helmet10");
 7941: 		test_02_02_check_key (hash, "chain10");
 7942: 		test_02_02_check_key (hash, "halberd10");
 7943: 		test_02_02_check_key (hash, "pipe10");
 7944: 		test_02_02_check_key (hash, "hat10");
 7945: 		test_02_02_check_key (hash, "eyeofnewt10");
 7946: 		test_02_02_check_key (hash, "soup10");
 7947: 		test_02_02_check_key (hash, "wolfbane10");
 7948: 		test_02_02_check_key (hash, "instantcoffee10");
 7949: 		test_02_02_check_key (hash, "bugspray10");
 7950: 		test_02_02_check_key (hash, "flint10");
 7951: 		test_02_02_check_key (hash, "soap10");
 7952: 		test_02_02_check_key (hash, "bones10");
 7953: 		test_02_02_check_key (hash, "orb10");
 7954: 		test_02_02_check_key (hash, "gold10");
 7955: 		test_02_02_check_key (hash, "silver10");
 7956: 		test_02_02_check_key (hash, "wine10");
 7957: 		test_02_02_check_key (hash, "bread10");
 7958: 
 7959: 		test_02_02_check_key (hash, "bag11");
 7960: 		test_02_02_check_key (hash, "sword11"); 
 7961: 		test_02_02_check_key (hash, "mace11");
 7962: 		test_02_02_check_key (hash, "axe11");
 7963: 		test_02_02_check_key (hash, "arrow11");
 7964: 		test_02_02_check_key (hash, "shield11");
 7965: 		test_02_02_check_key (hash, "bag11");
 7966: 		test_02_02_check_key (hash, "stone11");
 7967: 		test_02_02_check_key (hash, "key11");
 7968: 		test_02_02_check_key (hash, "skull11");
 7969: 		test_02_02_check_key (hash, "jar11");
 7970: 		test_02_02_check_key (hash, "bottle11");
 7971: 		test_02_02_check_key (hash, "fairy11");
 7972: 		test_02_02_check_key (hash, "potion11");
 7973: 		test_02_02_check_key (hash, "water11");
 7974: 		test_02_02_check_key (hash, "spoon11");
 7975: 		test_02_02_check_key (hash, "book11");
 7976: 		test_02_02_check_key (hash, "spear11");
 7977: 		test_02_02_check_key (hash, "dagger11");
 7978: 		test_02_02_check_key (hash, "katana11");
 7979: 		test_02_02_check_key (hash, "helmet11");
 7980: 		test_02_02_check_key (hash, "chain11");
 7981: 		test_02_02_check_key (hash, "halberd11");
 7982: 		test_02_02_check_key (hash, "pipe11");
 7983: 		test_02_02_check_key (hash, "hat11");
 7984: 		test_02_02_check_key (hash, "eyeofnewt11");
 7985: 		test_02_02_check_key (hash, "soup11");
 7986: 		test_02_02_check_key (hash, "wolfbane11");
 7987: 		test_02_02_check_key (hash, "instantcoffee11");
 7988: 		test_02_02_check_key (hash, "bugspray11");
 7989: 		test_02_02_check_key (hash, "flint11");
 7990: 		test_02_02_check_key (hash, "soap11");
 7991: 		test_02_02_check_key (hash, "bones11");
 7992: 		test_02_02_check_key (hash, "orb11");
 7993: 		test_02_02_check_key (hash, "gold11");
 7994: 		test_02_02_check_key (hash, "silver11");
 7995: 		test_02_02_check_key (hash, "wine11");
 7996: 		test_02_02_check_key (hash, "bread11");
 7997: 
 7998: 		/* update iterator */
 7999: 		iterator++;
 8000: 	}
 8001: 
 8002: 	/* destroy the hash */
 8003: 	axl_hash_free (hash);
 8004: 
 8005: 	/* check integer hash */
 8006: 	hash = axl_hash_new (axl_hash_int, axl_hash_equal_int);
 8007: 	axl_hash_insert (hash, INT_TO_PTR (-1), "menos uno");
 8008: 	axl_hash_insert (hash, INT_TO_PTR (8), "ocho");
 8009: 	
 8010: 	/* check values stored */
 8011: 	value = (const char *) axl_hash_get (hash, INT_TO_PTR (-1));
 8012: 	if (! axl_cmp (value, "menos uno")) {
 8013: 		printf ("Expected to find %s but found %s\n", "menos uno", value);
 8014: 		return axl_false;
 8015: 	}
 8016: 
 8017: 	/* check values stored */
 8018: 	value = (const char *) axl_hash_get (hash, INT_TO_PTR (8));
 8019: 	if (! axl_cmp (value, "ocho")) {
 8020: 		printf ("Expected to find %s but found %s\n", "ocho", value);
 8021: 		return axl_false;
 8022: 	}
 8023: 
 8024: 	/* free hash */
 8025: 	axl_hash_free (hash);
 8026: 
 8027: 	/* terminated test */
 8028: 	return axl_true;
 8029: }
 8030: 
 8031: axlPointer test_02_01_copy_key (axlPointer key, axlDestroyFunc key_destroy, axlPointer data, axlDestroyFunc data_destroy)
 8032: {
 8033: 	if (key_destroy == NULL)
 8034: 		return key;
 8035: 
 8036: 	return axl_strdup (key);
 8037: }
 8038: 
 8039: axlPointer test_02_01_copy_value (axlPointer key, axlDestroyFunc key_destroy, axlPointer data, axlDestroyFunc data_destroy)
 8040: {
 8041: 	if (data_destroy == NULL)
 8042: 		return data;
 8043: 
 8044: 	return axl_strdup (data);
 8045: }
 8046: 
 8047: 
 8048: /** 
 8049:  * @brief Checks normal hash operations.
 8050:  * 
 8051:  * 
 8052:  * @return \ref axl_true if it was ok.
 8053:  */
 8054: axl_bool test_02_01 (void) 
 8055: {
 8056: 	axlHash    * hash;
 8057: 	axlHash    * hash2;
 8058: 	axlPointer * data;
 8059: 
 8060: 	/* create a hash */
 8061: 	hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
 8062: 
 8063: 	/* perform operations on empty state */
 8064: 	if (axl_hash_exists (hash, "value")) {
 8065: 		printf ("Found that the hash returns that item exist but it is empty\n");
 8066: 		return axl_false;
 8067: 	}
 8068: 
 8069: 	/* perform a remove operation */
 8070: 	axl_hash_remove (hash, "value");
 8071: 
 8072: 	/* get data associated */
 8073: 	data = axl_hash_get (hash, "value");
 8074: 	if (data != NULL) {
 8075: 		printf ("Found that the hash returns that item exist but it is empty\n");
 8076: 		return axl_false;
 8077: 	}
 8078: 
 8079: 	/* add items to the hash */
 8080: 	axl_hash_insert_full (hash, "value", NULL, axl_strdup ("value"), axl_free);
 8081: 	axl_hash_insert_full (hash, "value2", NULL, axl_strdup ("value2"), axl_free);
 8082: 	axl_hash_insert_full (hash, "value3", NULL, axl_strdup ("value3"), axl_free);
 8083: 
 8084: 	/* check items stored */
 8085: 	test_02_02_check_key (hash, "value");
 8086: 	test_02_02_check_key (hash, "value2");
 8087: 	test_02_02_check_key (hash, "value3");
 8088: 
 8089: 	/* copy the hash */
 8090: 	hash2 = axl_hash_copy (hash, test_02_01_copy_key, test_02_01_copy_value);
 8091: 
 8092: 	/* check items stored */
 8093: 	test_02_02_check_key (hash2, "value");
 8094: 	test_02_02_check_key (hash2, "value2");
 8095: 	test_02_02_check_key (hash2, "value3");
 8096: 	
 8097: 
 8098: 	/* destroy the hash */
 8099: 	axl_hash_free (hash);
 8100: 
 8101: 	/* destroy the hash2 */
 8102: 	axl_hash_free (hash2);
 8103: 
 8104: 	return axl_true;
 8105: }
 8106: 
 8107: /** 
 8108:  * @brief Test current libaxl hash implementation.
 8109:  *
 8110:  * @return axl_true if it works properly or axl_false if not.
 8111:  */
 8112: axl_bool test_02_03 (void) 
 8113: {
 8114: 	axlHash * hash;
 8115: 
 8116: 	/* create the hash */
 8117: 	hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
 8118: 	
 8119: 	axl_hash_insert (hash, "value", "value");
 8120: 	axl_hash_insert (hash, "value", "value");
 8121: 	axl_hash_insert (hash, "value", "value");
 8122: 	axl_hash_insert (hash, "value", "value");
 8123: 	axl_hash_insert (hash, "value", "value");
 8124: 	axl_hash_insert (hash, "value", "value");
 8125: 	axl_hash_insert (hash, "value", "value");
 8126: 	axl_hash_insert (hash, "value", "value");
 8127: 	axl_hash_insert (hash, "value", "value");
 8128: 	axl_hash_insert (hash, "value", "value");
 8129: 
 8130: 	axl_hash_show_status (hash);
 8131: 
 8132: 	if (axl_hash_items (hash) != 1) {
 8133: 		printf ("ERROR: expected to find a hash size of 1 but found: %d\n",
 8134: 			axl_hash_items (hash));
 8135: 		return axl_false;
 8136: 	}
 8137: 
 8138: 	/* free the hash */
 8139: 	axl_hash_free (hash);
 8140: 
 8141: 	return axl_true;
 8142: }
 8143: 
 8144: axl_bool test_02_03a (void)
 8145: {
 8146: 	axlHash * hash;
 8147: 
 8148: 	hash = axl_hash_new (axl_hash_int, axl_hash_equal_int);
 8149: 
 8150: 	axl_hash_insert (hash, INT_TO_PTR (10), INT_TO_PTR (10));
 8151: 
 8152: 	axl_hash_insert (hash, INT_TO_PTR (1032), INT_TO_PTR (1032));
 8153: 
 8154: 	axl_hash_insert (hash, INT_TO_PTR (1048), INT_TO_PTR (1048));
 8155: 
 8156: 	axl_hash_insert (hash, INT_TO_PTR (10320), INT_TO_PTR (10320));
 8157: 
 8158: 	/* remove */
 8159: 	if (axl_hash_remove (hash, INT_TO_PTR (10321))) {
 8160: 		printf ("ERROR: expected to not find a true result from removing an item that do not exists..");
 8161: 		return axl_false;
 8162: 	}
 8163: 
 8164: 	if (! axl_hash_remove (hash, INT_TO_PTR (10320))) {
 8165: 		printf ("ERROR: expected to find a true result from removing an item that do not exists..");
 8166: 		return axl_false;
 8167: 	}
 8168: 
 8169: 	if (axl_hash_remove (hash, INT_TO_PTR (10320))) {
 8170: 		printf ("ERROR: expected to NOT find a true result from removing an item that do not exists..");
 8171: 		return axl_false;
 8172: 	}
 8173: 
 8174: 	if (! axl_hash_remove (hash, INT_TO_PTR (1048))) {
 8175: 		printf ("ERROR: expected to find a true result from removing an item that do not exists..");
 8176: 		return axl_false;
 8177: 	}
 8178: 
 8179: 	if (axl_hash_remove (hash, INT_TO_PTR (1048))) {
 8180: 		printf ("ERROR: expected to NOT find a true result from removing an item that do not exists..");
 8181: 		return axl_false;
 8182: 	}
 8183: 
 8184: 	if (! axl_hash_remove (hash, INT_TO_PTR (1032))) {
 8185: 		printf ("ERROR: expected to find a true result from removing an item that do not exists..");
 8186: 		return axl_false;
 8187: 	}
 8188: 
 8189: 	if (axl_hash_remove (hash, INT_TO_PTR (1032))) {
 8190: 		printf ("ERROR: expected to NOT find a true result from removing an item that do not exists..");
 8191: 		return axl_false;
 8192: 	}
 8193: 
 8194: 	if (! axl_hash_remove (hash, INT_TO_PTR (10))) {
 8195: 		printf ("ERROR: expected to find a true result from removing an item that do not exists..");
 8196: 		return axl_false;
 8197: 	}
 8198: 
 8199: 	if (axl_hash_remove (hash, INT_TO_PTR (10))) {
 8200: 		printf ("ERROR: expected to NOT find a true result from removing an item that do not exists..");
 8201: 		return axl_false;
 8202: 	}
 8203: 
 8204: 	axl_hash_free (hash);
 8205: 
 8206: 	return axl_true;
 8207: }
 8208: 
 8209: void show_item_test_02_04 (axlPointer key, axlPointer data)
 8210: {
 8211: 	__axl_log ("hash-test", AXL_LEVEL_DEBUG, "  %s -> %s", (char *) key, (char *) data);
 8212: }
 8213: 
 8214: axl_bool test_02_04 (void) 
 8215: {
 8216: 	axlHash * hash;
 8217: 	
 8218: 	/* create the hash */
 8219: 	hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
 8220: 
 8221: 	/* insert data */
 8222: 	axl_hash_insert (hash, "sword", "sword"); 
 8223: 	axl_hash_insert (hash, "mace", "mace");
 8224: 	axl_hash_insert (hash, "axe", "axe");
 8225: 	axl_hash_insert (hash, "arrow", "arrow");
 8226: 	axl_hash_insert (hash, "shield", "shield");
 8227: 	axl_hash_insert (hash, "bag", "bag");
 8228: 	axl_hash_insert (hash, "stone", "stone");
 8229: 	axl_hash_insert (hash, "key", "key");
 8230: 	axl_hash_insert (hash, "skull", "skull");
 8231: 	axl_hash_insert (hash, "jar", "jar");
 8232: 	axl_hash_insert (hash, "bottle", "bottle");
 8233: 	axl_hash_insert (hash, "fairy", "fairy");
 8234: 	axl_hash_insert (hash, "potion", "potion");
 8235: 	axl_hash_insert (hash, "water", "water");
 8236: 	axl_hash_insert (hash, "spoon", "spoon");
 8237: 	axl_hash_insert (hash, "book", "book");
 8238: 	axl_hash_insert (hash, "spear", "spear");
 8239: 	axl_hash_insert (hash, "dagger", "dagger");
 8240: 	axl_hash_insert (hash, "katana", "katana");
 8241: 	axl_hash_insert (hash, "helmet", "helmet");
 8242: 	axl_hash_insert (hash, "chain", "chain");
 8243: 	axl_hash_insert (hash, "halberd", "halberd");
 8244: 	axl_hash_insert (hash, "pipe", "pipe");
 8245: 	axl_hash_insert (hash, "hat", "hat");
 8246: 	axl_hash_insert (hash, "eyeofnewt", "eyeofnewt");
 8247: 	axl_hash_insert (hash, "soup", "soup");
 8248: 	axl_hash_insert (hash, "wolfbane", "wolfbane");
 8249: 	axl_hash_insert (hash, "instantcoffee", "instantcoffee");
 8250: 	axl_hash_insert (hash, "bugspray", "bugspray");
 8251: 	axl_hash_insert (hash, "flint", "flint");
 8252: 	axl_hash_insert (hash, "soap", "soap");
 8253: 	axl_hash_insert (hash, "bones", "bones");
 8254: 	axl_hash_insert (hash, "orb", "orb");
 8255: 	axl_hash_insert (hash, "gold", "gold");
 8256: 	axl_hash_insert (hash, "silver", "silver");
 8257: 	axl_hash_insert (hash, "wine", "wine");
 8258: 	axl_hash_insert (hash, "bread", "bread");
 8259: 
 8260: 	axl_hash_show_status_full (hash, show_item_test_02_04);
 8261: 
 8262: 	axl_hash_free (hash);
 8263: 
 8264: 	return axl_true;
 8265: 
 8266: }
 8267: 
 8268: axl_bool test_02_04_1 (void)
 8269: {
 8270: 	axlHash * hash;
 8271: 	int       iterator;
 8272: 
 8273: 	hash     = axl_hash_new (axl_hash_string, axl_hash_equal_string);
 8274: 	iterator = 0;
 8275: 	while (iterator < 1000) {
 8276: 		/* check the value do not exists */
 8277: 		if (axl_hash_exists (hash, "status-ok")) {
 8278: 			printf ("ERROR (1): expected to not find key value 'status-ok', but found..\n");
 8279: 			return axl_false;
 8280: 		} /* end if */
 8281: 
 8282: 		axl_hash_insert_full (hash, "status-ok", NULL, INT_TO_PTR (1), NULL);
 8283: 
 8284: 		if (! axl_hash_exists (hash, "status-ok")) {
 8285: 			printf ("ERROR (2): expected to find key value 'status-ok', but not found..\n");
 8286: 			return axl_false;
 8287: 		} /* end if */
 8288: 		
 8289: 		axl_hash_remove (hash, "status-ok");
 8290: 
 8291: 		if (axl_hash_exists (hash, "status-ok")) {
 8292: 			printf ("ERROR (3): expected to NOT find key value 'status-ok', but found..\n");
 8293: 			return axl_false;
 8294: 		} /* end if */
 8295: 
 8296: 		/* next iterator */
 8297: 		iterator++;
 8298: 	} /* end while */
 8299: 
 8300: 	printf ("Test 02-04-1: capacity %d, items stored: %d\n", axl_hash_capacity (hash), axl_hash_items (hash));
 8301: 
 8302: 	/* now store 10 items */
 8303: 	axl_hash_insert (hash, "value", INT_TO_PTR (1));
 8304: 	axl_hash_insert (hash, "value2", INT_TO_PTR (2));
 8305: 	axl_hash_insert (hash, "value3", INT_TO_PTR (3));
 8306: 	axl_hash_insert (hash, "value4", INT_TO_PTR (4));
 8307: 	axl_hash_insert (hash, "value5", INT_TO_PTR (5));
 8308: 	axl_hash_insert (hash, "value6", INT_TO_PTR (6));
 8309: 	axl_hash_insert (hash, "value7", INT_TO_PTR (7));
 8310: 	axl_hash_insert (hash, "value8", INT_TO_PTR (8));
 8311: 	axl_hash_insert (hash, "value9", INT_TO_PTR (9));
 8312: 	axl_hash_insert (hash, "value10", INT_TO_PTR (10));
 8313: 
 8314: 	/* check capacity */
 8315: 	printf ("Test 02-04-1: Items stored %d\n", axl_hash_items (hash));
 8316: 	if (axl_hash_items (hash) != 10) {
 8317: 		printf ("ERROR (3): expected to find 10 items but found %d..\n",
 8318: 			axl_hash_items (hash));
 8319: 		return axl_false;
 8320: 	} /* end if */
 8321: 
 8322: 	/* check here available internal store */
 8323: 	if (__axl_hash_spare_max (hash) != 9 || __axl_hash_spare_next (hash) != -1) {
 8324: 		printf ("ERROR (5): expected to find either max spare 9 or next spare -1 but found %d and %d..\n",
 8325: 			__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8326: 		return axl_false;
 8327: 	} /* end if */
 8328: 
 8329: 	/* remove items */
 8330: 	printf ("Test 02-04-1: Calling to remove items..\n");
 8331: 	axl_hash_remove (hash, "value");
 8332: 	axl_hash_remove (hash, "value2");
 8333: 	axl_hash_remove (hash, "value3");
 8334: 	axl_hash_remove (hash, "value4");
 8335: 	axl_hash_remove (hash, "value5");
 8336: 	axl_hash_remove (hash, "value6");
 8337: 	axl_hash_remove (hash, "value7");
 8338: 	axl_hash_remove (hash, "value8");
 8339: 	axl_hash_remove (hash, "value9");
 8340: 	axl_hash_remove (hash, "value10");
 8341: 
 8342: 	if (axl_hash_items (hash) != 0) {
 8343: 		printf ("ERROR (4): expected to find 0 items but found %d..\n",
 8344: 			axl_hash_items (hash));
 8345: 		return axl_false;
 8346: 	} /* end if */
 8347: 
 8348: 	/* check here available internal store */
 8349: 	if (__axl_hash_spare_max (hash) != 9 || __axl_hash_spare_next (hash) != 9) {
 8350: 		printf ("ERROR (5): expected to find either max spare 9 or next spare 9 but found %d and %d..\n",
 8351: 			__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8352: 		return axl_false;
 8353: 	} /* end if */
 8354: 
 8355: 	/* check capacity */
 8356: 	printf ("Test 02-04-1: Items stored %d\n", axl_hash_items (hash));
 8357: 
 8358: 	/* insert lot of items */
 8359: 	axl_hash_insert (hash, "value", INT_TO_PTR (1));
 8360: 	axl_hash_insert (hash, "value2", INT_TO_PTR (2));
 8361: 	axl_hash_insert (hash, "value3", INT_TO_PTR (3));
 8362: 	axl_hash_insert (hash, "value4", INT_TO_PTR (4));
 8363: 	axl_hash_insert (hash, "value5", INT_TO_PTR (5));
 8364: 	axl_hash_insert (hash, "value6", INT_TO_PTR (6));
 8365: 	axl_hash_insert (hash, "value7", INT_TO_PTR (7));
 8366: 	axl_hash_insert (hash, "value8", INT_TO_PTR (8));
 8367: 	axl_hash_insert (hash, "value9", INT_TO_PTR (9));
 8368: 	axl_hash_insert (hash, "value10", INT_TO_PTR (10));
 8369: 	axl_hash_insert (hash, "value11", INT_TO_PTR (1));
 8370: 	axl_hash_insert (hash, "value12", INT_TO_PTR (2));
 8371: 	axl_hash_insert (hash, "value13", INT_TO_PTR (3));
 8372: 	axl_hash_insert (hash, "value14", INT_TO_PTR (4));
 8373: 	axl_hash_insert (hash, "value15", INT_TO_PTR (5));
 8374: 	axl_hash_insert (hash, "value16", INT_TO_PTR (6));
 8375: 	axl_hash_insert (hash, "value17", INT_TO_PTR (7));
 8376: 	axl_hash_insert (hash, "value18", INT_TO_PTR (8));
 8377: 	axl_hash_insert (hash, "value19", INT_TO_PTR (9));
 8378: 	axl_hash_insert (hash, "value20", INT_TO_PTR (10));
 8379: 
 8380: 	/* check here available internal store */
 8381: 	printf ("Test 02-04-1: Max spares %d, next spares %d..\n",
 8382: 		__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8383: 	if (__axl_hash_spare_max (hash) != 9 || __axl_hash_spare_next (hash) != -1) {
 8384: 		printf ("ERROR (5): expected to find either max spare 9 or next spare -1 but found %d and %d..\n",
 8385: 			__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8386: 		return axl_false;
 8387: 	} /* end if */
 8388: 
 8389: 	/* insert lot of items */
 8390: 	axl_hash_remove (hash, "value");
 8391: 	axl_hash_remove (hash, "value2");
 8392: 	axl_hash_remove (hash, "value3");
 8393: 	axl_hash_remove (hash, "value4");
 8394: 	axl_hash_remove (hash, "value5");
 8395: 	axl_hash_remove (hash, "value6");
 8396: 	axl_hash_remove (hash, "value7");
 8397: 	axl_hash_remove (hash, "value8");
 8398: 	axl_hash_remove (hash, "value9");
 8399: 	axl_hash_remove (hash, "value10");
 8400: 	axl_hash_remove (hash, "value11");
 8401: 	axl_hash_remove (hash, "value12");
 8402: 	axl_hash_remove (hash, "value13");
 8403: 	axl_hash_remove (hash, "value14");
 8404: 	axl_hash_remove (hash, "value15");
 8405: 	axl_hash_remove (hash, "value16");
 8406: 	axl_hash_remove (hash, "value17");
 8407: 	axl_hash_remove (hash, "value18");
 8408: 	axl_hash_remove (hash, "value19");
 8409: 	axl_hash_remove (hash, "value20");
 8410: 
 8411: 	printf ("Test 02-04-1: Max spares %d, next spares %d..\n",
 8412: 		__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8413: 
 8414: 	if (__axl_hash_spare_max (hash) != 27 || __axl_hash_spare_next (hash) != 19) {
 8415: 		printf ("ERROR (6): expected to find either max spare 27 or next spare 19 but found %d and %d..\n",
 8416: 			__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8417: 		return axl_false;
 8418: 	} /* end if */
 8419: 
 8420: 	/* insert lot of items */
 8421: 	axl_hash_insert (hash, "value", INT_TO_PTR (1));
 8422: 	axl_hash_insert (hash, "value2", INT_TO_PTR (2));
 8423: 	axl_hash_insert (hash, "value3", INT_TO_PTR (3));
 8424: 	axl_hash_insert (hash, "value4", INT_TO_PTR (4));
 8425: 	axl_hash_insert (hash, "value5", INT_TO_PTR (5));
 8426: 	axl_hash_insert (hash, "value6", INT_TO_PTR (6));
 8427: 	axl_hash_insert (hash, "value7", INT_TO_PTR (7));
 8428: 	axl_hash_insert (hash, "value8", INT_TO_PTR (8));
 8429: 	axl_hash_insert (hash, "value9", INT_TO_PTR (9));
 8430: 	axl_hash_insert (hash, "value10", INT_TO_PTR (10));
 8431: 	axl_hash_insert (hash, "value11", INT_TO_PTR (1));
 8432: 	axl_hash_insert (hash, "value12", INT_TO_PTR (2));
 8433: 	axl_hash_insert (hash, "value13", INT_TO_PTR (3));
 8434: 	axl_hash_insert (hash, "value14", INT_TO_PTR (4));
 8435: 	axl_hash_insert (hash, "value15", INT_TO_PTR (5));
 8436: 	axl_hash_insert (hash, "value16", INT_TO_PTR (6));
 8437: 	axl_hash_insert (hash, "value17", INT_TO_PTR (7));
 8438: 	axl_hash_insert (hash, "value18", INT_TO_PTR (8));
 8439: 	axl_hash_insert (hash, "value19", INT_TO_PTR (9));
 8440: 	axl_hash_insert (hash, "value20", INT_TO_PTR (10));
 8441: 
 8442: 	printf ("Test 02-04-1: Max spares %d, next spares %d..\n",
 8443: 		__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8444: 
 8445: 	if (__axl_hash_spare_max (hash) != 27 || __axl_hash_spare_next (hash) != -1) {
 8446: 		printf ("ERROR (6): expected to find either max spare 27 or next spare 19 but found %d and %d..\n",
 8447: 			__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8448: 		return axl_false;
 8449: 	} /* end if */
 8450: 
 8451: 	/* insert lot of items */
 8452: 	axl_hash_remove (hash, "value");
 8453: 	axl_hash_remove (hash, "value2");
 8454: 	axl_hash_remove (hash, "value3");
 8455: 	axl_hash_remove (hash, "value4");
 8456: 	axl_hash_remove (hash, "value5");
 8457: 	axl_hash_remove (hash, "value6");
 8458: 	axl_hash_remove (hash, "value7");
 8459: 	axl_hash_remove (hash, "value8");
 8460: 	axl_hash_remove (hash, "value9");
 8461: 	axl_hash_remove (hash, "value10");
 8462: 	axl_hash_remove (hash, "value11");
 8463: 	axl_hash_remove (hash, "value12");
 8464: 	axl_hash_remove (hash, "value13");
 8465: 	axl_hash_remove (hash, "value14");
 8466: 	axl_hash_remove (hash, "value15");
 8467: 	axl_hash_remove (hash, "value16");
 8468: 	axl_hash_remove (hash, "value17");
 8469: 	axl_hash_remove (hash, "value18");
 8470: 	axl_hash_remove (hash, "value19");
 8471: 	axl_hash_remove (hash, "value20");
 8472: 
 8473: 	if (__axl_hash_spare_max (hash) != 27 || __axl_hash_spare_next (hash) != 19) {
 8474: 		printf ("ERROR (7): expected to find either max spare 27 or next spare 19 but found %d and %d..\n",
 8475: 			__axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
 8476: 		return axl_false;
 8477: 	} /* end if */
 8478: 
 8479: 	axl_hash_free (hash);
 8480: 
 8481: 	return axl_true;
 8482: }
 8483: 
 8484: axl_bool test_02_05 (void)
 8485: {
 8486: 	axlHash       * hash;
 8487: 	axlHashCursor * cursor;
 8488: 	int             iterator;
 8489: 	char          * key, * value;
 8490: 	
 8491: 	/* create the hash */
 8492: 	hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
 8493: 
 8494: 	/* insert data */
 8495: 	axl_hash_insert (hash, "sword", "sword"); 
 8496: 	axl_hash_insert (hash, "mace", "mace");
 8497: 	axl_hash_insert (hash, "axe", "axe");
 8498: 	axl_hash_insert (hash, "arrow", "arrow");
 8499: 	axl_hash_insert (hash, "shield", "shield");
 8500: 	axl_hash_insert (hash, "bag", "bag");
 8501: 	axl_hash_insert (hash, "stone", "stone");
 8502: 	axl_hash_insert (hash, "key", "key");
 8503: 	axl_hash_insert (hash, "skull", "skull");
 8504: 	axl_hash_insert (hash, "jar", "jar");
 8505: 	axl_hash_insert (hash, "bottle", "bottle");
 8506: 	axl_hash_insert (hash, "fairy", "fairy");
 8507: 	axl_hash_insert (hash, "potion", "potion");
 8508: 	axl_hash_insert (hash, "water", "water");
 8509: 	axl_hash_insert (hash, "spoon", "spoon");
 8510: 	axl_hash_insert (hash, "book", "book");
 8511: 	axl_hash_insert (hash, "spear", "spear");
 8512: 	axl_hash_insert (hash, "dagger", "dagger");
 8513: 	axl_hash_insert (hash, "katana", "katana");
 8514: 	axl_hash_insert (hash, "helmet", "helmet");
 8515: 	axl_hash_insert (hash, "chain", "chain");
 8516: 	axl_hash_insert (hash, "halberd", "halberd");
 8517: 	axl_hash_insert (hash, "pipe", "pipe");
 8518: 	axl_hash_insert (hash, "hat", "hat");
 8519: 	axl_hash_insert (hash, "eyeofnewt", "eyeofnewt");
 8520: 	axl_hash_insert (hash, "soup", "soup");
 8521: 	axl_hash_insert (hash, "wolfbane", "wolfbane");
 8522: 	axl_hash_insert (hash, "instantcoffee", "instantcoffee");
 8523: 	axl_hash_insert (hash, "bugspray", "bugspray");
 8524: 	axl_hash_insert (hash, "flint", "flint");
 8525: 	axl_hash_insert (hash, "soap", "soap");
 8526: 	axl_hash_insert (hash, "bones", "bones");
 8527: 	axl_hash_insert (hash, "orb", "orb");
 8528: 	axl_hash_insert (hash, "gold", "gold");
 8529: 	axl_hash_insert (hash, "silver", "silver");
 8530: 	axl_hash_insert (hash, "wine", "wine");
 8531: 	axl_hash_insert (hash, "bread", "bread");
 8532: 
 8533: 	/* create a cursor */
 8534: 	cursor   = axl_hash_cursor_new (hash);
 8535: 	iterator = 0;
 8536: 	while (axl_hash_cursor_has_item (cursor)) {
 8537: 		/* first item */
 8538: 		if (! axl_cmp (axl_hash_cursor_get_key (cursor),
 8539: 			       axl_hash_cursor_get_value (cursor))) {
 8540: 			printf ("error: supposed to find key and value equal (%s==%s), but not found..\n",
 8541: 				(char*)axl_hash_cursor_get_key (cursor),
 8542: 				(char*)axl_hash_cursor_get_value (cursor));
 8543: 			return axl_false;
 8544: 		} /* end if */
 8545: 
 8546: 		/* get next */
 8547: 		axl_hash_cursor_next (cursor);
 8548: 
 8549: 		iterator++;
 8550: 
 8551: 		if (iterator == 38) {
 8552: 			printf ("error: found more items than actually expected..\n");
 8553: 			return axl_false;
 8554: 		}
 8555: 	} /* end while */
 8556: 
 8557: 	if (iterator != 37) {
 8558: 		printf ("error: found more items than actually expected..\n");
 8559: 		return axl_false;
 8560: 	}
 8561: 
 8562: 	iterator = 0;
 8563: 	axl_hash_cursor_first (cursor);
 8564: 	while (axl_hash_cursor_has_item (cursor)) {
 8565: 		/* first item */
 8566: 		if (! axl_cmp (axl_hash_cursor_get_key (cursor),
 8567: 			       axl_hash_cursor_get_value (cursor))) {
 8568: 			printf ("error: supposed to find key and value equal (%s==%s), but not found..\n",
 8569: 				(char*)axl_hash_cursor_get_key (cursor),
 8570: 				(char*)axl_hash_cursor_get_value (cursor));
 8571: 			return axl_false;
 8572: 		} /* end if */
 8573: 
 8574: 		iterator++;
 8575: 
 8576: 		if (iterator < 37) {
 8577: 			if (! axl_hash_cursor_has_next (cursor)) {
 8578: 				printf ("error: expected to find next node on iterator (%d)\n", iterator);
 8579: 				return axl_false;
 8580: 			} /* end if */
 8581: 		} /* end if */
 8582: 
 8583: 		/* get next */
 8584: 		axl_hash_cursor_next (cursor);
 8585: 
 8586: 		if (iterator == 38) {
 8587: 			printf ("error: found more items than actually expected..\n");
 8588: 			return axl_false;
 8589: 		}
 8590: 	} /* end while */
 8591: 
 8592: 	if (iterator != 37) {
 8593: 		printf ("error: found different count of items than actually expected (%d != 37)..\n", iterator);
 8594: 		return axl_false;
 8595: 	}
 8596: 
 8597: 	/* check last api */
 8598: 	axl_hash_cursor_last (cursor);
 8599: 	if (! axl_hash_cursor_has_item (cursor)) {
 8600: 		printf ("error: expected to find last element defined..\n");
 8601: 		return axl_false;
 8602: 	}
 8603: 
 8604: 	/* check last */
 8605: 	if (! axl_cmp ("flint", axl_hash_cursor_get_key (cursor))) {
 8606: 		printf ("error: expected to find last element \"flint\"=\"%s\"\n", (char*) axl_hash_cursor_get_key (cursor));
 8607: 		return axl_false;
 8608: 	}
 8609: 
 8610: 
 8611: 	if (axl_hash_cursor_has_next (cursor)) {
 8612: 		printf ("error: expected to not find next element defined..\n");
 8613: 		return axl_false;
 8614: 	} /* end if */
 8615: 
 8616: 	axl_hash_cursor_first (cursor);
 8617: 	while (axl_hash_cursor_has_item (cursor)) {
 8618: 		/* first item */
 8619: 		if (! axl_cmp (axl_hash_cursor_get_key (cursor),
 8620: 			       axl_hash_cursor_get_value (cursor))) {
 8621: 			printf ("error: supposed to find key and value equal (%s==%s), but not found..\n",
 8622: 				(char*)axl_hash_cursor_get_key (cursor),
 8623: 				(char*)axl_hash_cursor_get_value (cursor));
 8624: 			return axl_false;
 8625: 		} /* end if */
 8626: 
 8627: 		/* get value */
 8628: 		key   = axl_hash_cursor_get_key (cursor);
 8629: 		value = axl_hash_cursor_get_value (cursor);
 8630: 
 8631: 		/* check key to exists */
 8632: 		if (! axl_hash_exists (axl_hash_cursor_hash (cursor), key)) {
 8633: 			printf ("error: expected to find key defined=<%s>\n", key);
 8634: 			return axl_false;
 8635: 		}
 8636: 
 8637: 		/* check value to exists */
 8638: 		if (! axl_cmp (axl_hash_get (axl_hash_cursor_hash (cursor), key), value)) {
 8639: 			printf ("error: expected to find value not found: <%s>!=<%s>\n", 
 8640: 				value, (char*) axl_hash_get (axl_hash_cursor_hash (cursor), key));
 8641: 			return axl_false;
 8642: 		} /* end if */
 8643: 		
 8644: 
 8645: 		/* remove items */
 8646: 		axl_hash_cursor_remove (cursor);
 8647: 		
 8648: 	} /* end while */
 8649: 
 8650: 	if (axl_hash_items (hash) != 0) {
 8651: 		printf ("error: expected to find hash with 0 size (but found: %d)\n",
 8652: 			axl_hash_items (hash));
 8653: 		return axl_false;
 8654: 	} /* end if */
 8655: 
 8656: 	/* free cursor */
 8657: 	axl_hash_cursor_free (cursor);
 8658: 
 8659: 	/* free the hash */
 8660: 	axl_hash_free (hash);
 8661: 
 8662: 	/* now check the cursor with only one item */
 8663: 	hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
 8664: 	axl_hash_insert (hash, "12:BB:DD:8A:1D:E5:64:0C:7E:F5:EB:B3:21:C7:67:7E", "test");
 8665: 	cursor = axl_hash_cursor_new (hash);
 8666: 
 8667: 	iterator = 0;
 8668: 	while (axl_hash_cursor_has_item (cursor) && iterator < 10) {
 8669: 		
 8670: 		axl_hash_cursor_get_value (cursor);
 8671: 		
 8672: 		/* get next cursor */
 8673: 		axl_hash_cursor_next (cursor);
 8674: 		iterator++;
 8675: 	}
 8676: 
 8677: 	if (iterator != 1) {
 8678: 		printf ("Expected to find only one iteration inside the hash but the limit was found\n");
 8679: 		return axl_false;
 8680: 	}
 8681: 
 8682: 	axl_hash_free (hash);
 8683: 	axl_hash_cursor_free (cursor);
 8684: 
 8685: 	/* test ok */
 8686: 	return axl_true;
 8687: }
 8688: 
 8689: /** 
 8690:  * @brief Allows to check current binary stack used by the library.
 8691:  * 
 8692:  * 
 8693:  * @return axl_true if tests are ok.
 8694:  */
 8695: axl_bool test_02_06 (void)
 8696: {
 8697: 	axl_bool         value;
 8698: 	axlBinaryStack * bstack;
 8699: 	int              iterator;
 8700: 
 8701: 	/* create a bstack */
 8702: 	bstack = axl_binary_stack_new ();
 8703: 
 8704: 	/* push 10 axl_true values */
 8705: 	axl_binary_stack_push (bstack, axl_true);
 8706: 	axl_binary_stack_push (bstack, axl_true);
 8707: 	axl_binary_stack_push (bstack, axl_true);
 8708: 	axl_binary_stack_push (bstack, axl_true);
 8709: 	axl_binary_stack_push (bstack, axl_true);
 8710: 
 8711: 	axl_binary_stack_push (bstack, axl_true);
 8712: 	axl_binary_stack_push (bstack, axl_true);
 8713: 	axl_binary_stack_push (bstack, axl_true);
 8714: 	axl_binary_stack_push (bstack, axl_true);
 8715: 	axl_binary_stack_push (bstack, axl_true);
 8716: 
 8717: 	/* check count */
 8718: 	if (axl_binary_stack_size (bstack) != 10) {
 8719: 		printf ("Expected to find %d items but found: %d", 
 8720: 			10, axl_binary_stack_size (bstack));
 8721: 		return axl_false;
 8722: 	} /* end if */
 8723: 
 8724: 	/* push values */
 8725: 
 8726: 	axl_binary_stack_push (bstack, axl_false);
 8727: 	axl_binary_stack_push (bstack, axl_true);
 8728: 	axl_binary_stack_push (bstack, axl_true);
 8729: 
 8730: 	axl_binary_stack_push (bstack, axl_true);
 8731: 	axl_binary_stack_push (bstack, axl_false);
 8732: 	axl_binary_stack_push (bstack, axl_false);
 8733: 
 8734: 	/* check count */
 8735: 	if (axl_binary_stack_size (bstack) != 16) {
 8736: 		printf ("Expected to find %d items but found: %d\n", 
 8737: 			16, axl_binary_stack_size (bstack));
 8738: 		return axl_false;
 8739: 	} /* end if */
 8740: 
 8741: 	/* pop data */
 8742: 	value = axl_binary_stack_pop (bstack);
 8743: 	if (value != axl_false) {
 8744: 		printf ("Expected to find %d, but found %d (1)\n", axl_false, value);
 8745: 		return axl_false;
 8746: 	}
 8747: 
 8748: 	value = axl_binary_stack_pop (bstack);
 8749: 	if (value != axl_false) {
 8750: 		printf ("Expected to find %d, but found %d (2)\n", axl_false, value);
 8751: 		return axl_false;
 8752: 	}
 8753: 
 8754: 	value = axl_binary_stack_pop (bstack);
 8755: 	if (value != axl_true) {
 8756: 		printf ("Expected to find %d, but found %d (3)\n", axl_true, value);
 8757: 		return axl_false;
 8758: 	}
 8759: 
 8760: 	value = axl_binary_stack_pop (bstack);
 8761: 	if (value != axl_true) {
 8762: 		printf ("Expected to find %d, but found %d (4)\n", axl_true, value);
 8763: 		return axl_false;
 8764: 	}
 8765: 
 8766: 	value = axl_binary_stack_pop (bstack);
 8767: 	if (value != axl_true) {
 8768: 		printf ("Expected to find %d, but found %d (5)\n", axl_true, value);
 8769: 		return axl_false;
 8770: 	}
 8771: 
 8772: 	value = axl_binary_stack_pop (bstack);
 8773: 	if (value != axl_false) {
 8774: 		printf ("Expected to find %d, but found %d (6)\n", axl_false, value);
 8775: 		return axl_false;
 8776: 	}
 8777: 
 8778: 	/* check count */
 8779: 	if (axl_binary_stack_size (bstack) != 10) {
 8780: 		printf ("Expected to find %d items but found: %d\n", 
 8781: 			10, axl_binary_stack_size (bstack));
 8782: 		return axl_false;
 8783: 	} /* end if */
 8784: 
 8785: 	iterator = 0;
 8786: 	while (iterator < 10) {
 8787: 		/* get the value */
 8788: 		value    = axl_binary_stack_pop (bstack);
 8789: 		if (value != axl_true) {
 8790: 			printf ("Expected to find %d, but found %d (3)\n", axl_true, value);
 8791: 			return axl_false;
 8792: 		}  /* end if */
 8793: 
 8794: 		iterator++;
 8795: 	} /* end while */
 8796: 
 8797: 	/* check count */
 8798: 	if (axl_binary_stack_size (bstack) != 0) {
 8799: 		printf ("Expected to find %d items but found: %d\n", 
 8800: 			0, axl_binary_stack_size (bstack));
 8801: 		return axl_false;
 8802: 	} /* end if */
 8803: 
 8804: 	/* free binary stack */
 8805: 	axl_binary_stack_free (bstack);
 8806: 
 8807: 	return axl_true;
 8808: }
 8809: 
 8810: /** 
 8811:  * Test01: Initial xml header checking.
 8812:  */
 8813: int main (int argc, char ** argv)
 8814: {
 8815: 	axlError * error;
 8816: 
 8817: 	printf ("** LibAxl: Another XML library (regression test).\n");
 8818: 	printf ("** Copyright (C) 2008 Advanced Software Production Line, S.L.\n**\n");
 8819: 	printf ("** Axl regression tests: version=%s\n**\n",
 8820: 		VERSION);
 8821: 	printf ("** To gather information about time performance you can use:\n**\n");
 8822: 	printf ("**     >> time ./test_01\n**\n");
 8823: 	printf ("** To gather information about memory consumed (and leaks) use:\n**\n");
 8824: 	printf ("**     >> libtool --mode=execute valgrind --leak-check=yes --error-limit=no ./test_01\n**\n");
 8825: 	printf ("**\n");
 8826: 	printf ("** Report bugs to:\n**\n");
 8827: 	printf ("**     <axl@lists.aspl.es> Axl mailing list\n**\n");
 8828: 
 8829: 
 8830: 	/* initialize axl library */
 8831: 	if (! axl_init ()) {
 8832: 		printf ("Unable to initialize Axl library\n");
 8833: 		return -1;
 8834: 	}
 8835: 
 8836: 	/* DATA STRUCTURE TESTS */
 8837: 	if (test_01_01 ()) {	
 8838: 		printf ("Test 01-01: LibAxl list implementation [   OK   ]\n");
 8839: 	}else {
 8840: 		printf ("Test 01-01 ##: LibAxl list implementation [ FAILED ]\n");
 8841: 		return -1;
 8842: 	}
 8843: 
 8844: 	if (test_01_02 ()) {
 8845: 		printf ("Test 01-02: LibAxl FIFO implementation [   OK   ]\n");
 8846: 	}else {
 8847: 		printf ("Test 01-02: LibAxl list implementation [ FAILED ]\n");
 8848: 		return -1;
 8849: 	}
 8850: 
 8851: 	if (test_01_03 ()) {
 8852: 		printf ("Test 01-03: LibAxl string functions    [   OK   ]\n");
 8853: 	}else {
 8854: 		printf ("Test 01-03: LibAxl string functions    [ FAILED ]\n");
 8855: 		return -1;
 8856: 	}
 8857: 
 8858: 	if (test_01_04 ()) {
 8859: 		printf ("Test 01-04: LibAxl list implementation (II) [   OK   ]\n");
 8860: 	}else {
 8861: 		printf ("Test 01-04: LibAxl list implementation (II) [ FAILED ]\n");
 8862: 		return -1;
 8863: 	}
 8864: 
 8865: 	if (test_01_04_a ()) {
 8866: 		printf ("Test 01-04-a: LibAxl list implementation (III) [   OK   ]\n");
 8867: 	}else {
 8868: 		printf ("Test 01-04-a: LibAxl list implementation (III) [ FAILED ]\n");
 8869: 		return -1;
 8870: 	}
 8871: 
 8872: 	if (test_01_05 ()) {
 8873: 		printf ("Test 01-05: LibAxl error reporting [   OK   ]\n");
 8874: 	}else {
 8875: 		printf ("Test 01-05: LibAxl error reporting [ FAILED ]\n");
 8876: 		return -1;
 8877: 	}
 8878: 
 8879: 	/* HASH IMPLEMENTATION CHECKS */
 8880: 	if (test_02_01 ()) {
 8881: 		printf ("Test 02-01: LibAxl hash implementation [   OK   ]\n");
 8882: 	}else {
 8883: 		printf ("Test 02-01: LibAxl hash implementation [ FAILEDp ]\n");
 8884: 		return -1;
 8885: 	}
 8886: 
 8887: 	if (test_02_02 ()) {
 8888: 		printf ("Test 02-02: LibAxl hash implementation (lookup) [   OK   ]\n");
 8889: 	}else {
 8890: 		printf ("Test 02-02: LibAxl hash implementation (lookup) [ FAILED ]\n");
 8891: 		return -1;
 8892: 	}
 8893: 
 8894: 	if (test_02_03 ()) {
 8895: 		printf ("Test 02-03: LibAxl hash implementation (replace) [   OK   ]\n");
 8896: 	}else {
 8897: 		printf ("Test 02-03: LibAxl hash implementation (replace) [ FAILED ]\n");
 8898: 		return -1;
 8899: 	}
 8900: 
 8901: 	if (test_02_03a ()) {
 8902: 		printf ("Test 02-03-a: LibAxl hash remove notification [   OK   ]\n");
 8903: 	}else {
 8904: 		printf ("Test 02-03-a: LibAxl hash remove notification [ FAILED ]\n");
 8905: 		return -1;
 8906: 	}
 8907: 
 8908: 	if (test_02_04 ()) {
 8909: 		printf ("Test 02-04: LibAxl hash implementation (remove) [   OK   ]\n");
 8910: 	}else {
 8911: 		printf ("Test 02-04: LibAxl hash implementation (remove) [ FAILED ]\n");
 8912: 		return -1;
 8913: 	}
 8914: 
 8915: 	if (test_02_04_1 ()) {
 8916: 		printf ("Test 02-04-1: LibAxl hash implementation (insert-remove cycle) [   OK   ]\n");
 8917: 	}else {
 8918: 		printf ("Test 02-04-1: LibAxl hash implementation (insert-remove cycle) [ FAILED ]\n");
 8919: 		return -1;
 8920: 	}
 8921: 
 8922: 	if (test_02_05 ()) {
 8923: 		printf ("Test 02-05: LibAxl hash cursor [   OK   ]\n");
 8924: 	}else {
 8925: 		printf ("Test 02-05: LibAxl hash cursor [ FAILED ]\n");
 8926: 		return -1;
 8927: 	}
 8928: 
 8929: 	/* binary stack checks */
 8930: 	if (test_02_06 ()) {
 8931: 		printf ("Test 02-06: LibAxl binary stack [   OK   ]\n");
 8932: 	}else {
 8933: 		printf ("Test 02-06: LibAxl binary stack [ FAILED ]\n");
 8934: 		return -1;
 8935: 	}
 8936: 
 8937: 	/* LIBRARY TESTS */
 8938: 	if (test_01 (&error))
 8939: 		printf ("Test 01: basic xml parsing [   OK   ]\n");
 8940: 	else {
 8941: 		printf ("Test 01: basic xml parsing [ FAILED ]\n  (code: %d) %s\n",
 8942: 			axl_error_get_code (error), axl_error_get (error));
 8943: 		axl_error_free (error);
 8944: 		return -1;
 8945: 	}
 8946: 
 8947: 	if (test_01a (&error)) {
 8948: 		printf ("Test 01-a: Axl Stream boundary checks [   OK   ]\n");
 8949: 	} else {
 8950: 		printf ("Test 01-a: Axl Stream boundary checks [ FAILED ]\n  (CODE: %d) %s\n",
 8951: 			axl_error_get_code (error), axl_error_get (error));
 8952: 		axl_error_free (error);
 8953: 		return -1;
 8954: 	}	
 8955: 
 8956: 	if (test_01b (&error)) {
 8957: 		printf ("Test 01-b: Basic XML parsing, XML document position [   OK   ]\n");
 8958: 	} else {
 8959: 		printf ("Test 01-b: Basic XML parsing, XML document position [ FAILED ]\n  (CODE: %d) %s\n",
 8960: 			axl_error_get_code (error), axl_error_get (error));
 8961: 		axl_error_free (error);
 8962: 		return -1;
 8963: 	}
 8964: 
 8965: 	if (test_01c (&error)) {
 8966: 		printf ("Test 01-c: Basic XML parsing, XML document traversing [   OK   ]\n");
 8967: 	} else {
 8968: 		printf ("Test 01-c: Basic XML parsing, XML document traversing [ FAILED ]\n  (CODE: %d) %s\n",
 8969: 			axl_error_get_code (error), axl_error_get (error));
 8970: 		axl_error_free (error);
 8971: 		return -1;
 8972: 	}	
 8973: 
 8974: 	if (test_01d (&error)) {
 8975: 		printf ("Test 01-d: Basic XML parsing, node nth access [   OK   ]\n");
 8976: 	} else {
 8977: 		printf ("Test 01-d: Basic XML parsing, node nth access [ FAILED ]\n  (CODE: %d) %s\n",
 8978: 			axl_error_get_code (error), axl_error_get (error));
 8979: 		axl_error_free (error);
 8980: 		return -1;
 8981: 	}	
 8982: 
 8983: 	if (test_01e (&error)) {
 8984: 		printf ("Test 01-e: Basic XML parsing, large content  [   OK   ]\n");
 8985: 	} else {
 8986: 		printf ("Test 01-e: Basic XML parsing, large content  [ FAILED ]\n   (CODE: %d) %s\n",
 8987: 			axl_error_get_code (error), axl_error_get (error));
 8988: 		axl_error_free (error);
 8989: 		return -1;
 8990: 	} /* end if */
 8991: 
 8992: 	if (test_01f (&error)) {
 8993: 		printf ("Test 01-f: Basic XML parsing, white space node content  [   OK   ]\n");
 8994: 	} else {
 8995: 		printf ("Test 01-f: Basic XML parsing, white space node content  [ FAILED ]\n   (CODE: %d) %s\n",
 8996: 			axl_error_get_code (error), axl_error_get (error));
 8997: 		axl_error_free (error);
 8998: 		return -1;
 8999: 	} /* end if */
 9000: 
 9001: 	if (test_02 (&error))
 9002: 		printf ("Test 02: basic xml error detection [   OK   ]\n");
 9003: 	else {
 9004: 		printf ("Test 02: basic xml error detection [ FAILED ]\n  (CODE: %d) %s\n",
 9005: 			axl_error_get_code (error), axl_error_get (error));
 9006: 		axl_error_free (error);
 9007: 		return -1;
 9008: 	}	
 9009: 
 9010: 	if (test_03 (&error))
 9011: 		printf ("Test 03: complex xml error detection [   OK   ]\n");
 9012: 	else {
 9013: 		printf ("Test 03: complex xml error detection [ FAILED ]\n  (CODE: %d) %s\n",
 9014: 			axl_error_get_code (error), axl_error_get (error));
 9015: 		axl_error_free (error);
 9016: 		return -1;
 9017: 	}	
 9018: 
 9019: 	if (test_04 (&error))
 9020: 		printf ("Test 04: complex xml parsing [   OK   ]\n");
 9021: 	else {
 9022: 		printf ("Test 04: complex xml parsing [ FAILED ]\n  (CODE: %d) %s\n",
 9023: 			axl_error_get_code (error), axl_error_get (error));
 9024: 		axl_error_free (error);
 9025: 		return -1;
 9026: 	}	
 9027: 
 9028: 	if (test_05 (&error))
 9029: 		printf ("Test 05: DTD basic parsing [   OK   ]\n");
 9030: 	else {
 9031: 		printf ("Test 05: DTD basic parsing [ FAILED ]\n  (CODE: %d) %s\n",
 9032: 			axl_error_get_code (error), axl_error_get (error));
 9033: 		axl_error_free (error);
 9034: 		return -1;
 9035: 	}	
 9036: 
 9037: 	if (test_06 (&error))
 9038: 		printf ("Test 06: DTD basic parsing (2) [   OK   ]\n");
 9039: 	else {
 9040: 		printf ("Test 06: DTD basic parsing (2) [ FAILED ]\n  (CODE: %d) %s\n",
 9041: 			axl_error_get_code (error), axl_error_get (error));
 9042: 		axl_error_free (error);
 9043: 		return -1;
 9044: 	}	
 9045: 
 9046: 	if (test_07 (&error)) 
 9047: 		printf ("Test 07: DTD validation (I) [   OK   ]\n");
 9048: 	else {
 9049: 		printf ("Test 07: DTD validation (I) [ FAILED ]\n  (CODE: %d) %s\n",
 9050: 			axl_error_get_code (error), axl_error_get (error));
 9051: 		axl_error_free (error);
 9052: 		return -1;
 9053: 	}	
 9054: 
 9055: 	if (test_08 (&error)) 
 9056: 		printf ("Test 08: Large XML file loading [   OK   ]\n");
 9057: 	else {
 9058: 		printf ("Test 08: Large XML file loading [ FAILED ]\n  (CODE: %d) %s\n",
 9059: 			axl_error_get_code (error), axl_error_get (error));
 9060: 		axl_error_free (error);
 9061: 		return -1;
 9062: 	}	
 9063: 
 9064: 
 9065: 
 9066: 	if (test_09 (&error)) 
 9067: 		printf ("Test 09: Complex DTD validation [   OK   ]\n");
 9068: 	else {
 9069: 		printf ("Test 09: Complex DTD validation [ FAILED ]\n  (CODE: %d) %s\n",
 9070: 			axl_error_get_code (error), axl_error_get (error));
 9071: 		axl_error_free (error);
 9072: 		return -1;
 9073: 	}
 9074: 
 9075: 
 9076: 	if (test_10 (&error)) 
 9077: 		printf ("Test 10: Complex DTD validation (II) [   OK   ]\n");
 9078: 	else {
 9079: 		printf ("Test 10: Complex DTD validation (II) [ FAILED ]\n  (CODE: %d) %s\n",
 9080: 			axl_error_get_code (error), axl_error_get (error));
 9081: 		axl_error_free (error);
 9082: 		return -1;
 9083: 	}
 9084: 
 9085: 	if (test_11 (&error)) 
 9086: 		printf ("Test 11: Complex DTD validation (III) [   OK   ]\n");
 9087: 	else {
 9088: 		printf ("Test 11: Complex DTD validation (III) [ FAILED ]\n  (CODE: %d) %s\n",
 9089: 			axl_error_get_code (error), axl_error_get (error));
 9090: 		axl_error_free (error);
 9091: 		return -1;
 9092: 	}	
 9093: 
 9094: 	if (test_12 (&error)) 
 9095: 		printf ("Test 12: Complex DTD validation (IV) [   OK   ]\n");
 9096: 	else {
 9097: 		printf ("Test 12: Complex DTD validation (IV) [ FAILED ]\n  (CODE: %d) %s\n",
 9098: 			axl_error_get_code (error), axl_error_get (error));
 9099: 		axl_error_free (error);
 9100: 		return -1;
 9101: 	}	
 9102: 	
 9103: 	if (test_13 (&error)) 
 9104: 		printf ("Test 13: XML memory dumping [   OK   ]\n");
 9105: 	else {
 9106: 		printf ("Test 13: XML memory dumping [ FAILED ]\n  (CODE: %d) %s\n",
 9107: 			axl_error_get_code (error), axl_error_get (error));
 9108: 		axl_error_free (error);
 9109: 		return -1;
 9110: 	}	
 9111: 
 9112: 	if (test_14 (&error)) {
 9113: 		printf ("Test 14: quotation and escape sequences (&,',\",<,>) [   OK   ]\n");
 9114: 	} else {
 9115: 		printf ("Test 14: quotation and escape sequences (&,',\",<,>) [ FAILED ]\n  (CODE: %d) %s\n",
 9116: 			axl_error_get_code (error), axl_error_get (error));
 9117: 		axl_error_free (error);
 9118: 		return -1;
 9119: 	}	
 9120: 
 9121: 	if (test_15 (&error)) {
 9122: 		printf ("Test 15: DTD validation fail checks (25/04/2006) [   OK   ]\n");
 9123: 	} else {
 9124: 		printf ("Test 15: DTD validation fail checks (25/04/2006) [ FAILED ]\n  (CODE: %d) %s\n",
 9125: 			axl_error_get_code (error), axl_error_get (error));
 9126: 		axl_error_free (error);
 9127: 		return -1;
 9128: 	}	
 9129: 
 9130: 
 9131: 	if (test_16 (&error)) {
 9132: 		printf ("Test 16: DTD validation fail checks (03/05/2006) [   OK   ]\n");
 9133: 	} else {
 9134: 		printf ("Test 16: DTD validation fail checks (03/05/2006) [ FAILED ]\n  (CODE: %d) %s\n",
 9135: 			axl_error_get_code (error), axl_error_get (error));
 9136: 		axl_error_free (error);
 9137: 		return -1;
 9138: 	}	
 9139: 
 9140: 	if (test_17 (&error)) {
 9141: 		printf ("Test 17: DTD validation fail checks (02/07/2006) [   OK   ]\n");
 9142: 	} else {
 9143: 		printf ("Test 17: DTD validation fail checks (02/07/2006) [ FAILED ]\n  (CODE: %d) %s\n",
 9144: 			axl_error_get_code (error), axl_error_get (error));
 9145: 		axl_error_free (error);
 9146: 		return -1;
 9147: 	}	
 9148: 
 9149: 	if (test_18 (&error)) {
 9150: 		printf ("Test 18: DTD ENTITY support [   OK   ]\n");
 9151: 	} else {
 9152: 		printf ("Test 18: DTD ENTITY support [ FAILED ]\n  (CODE: %d) %s\n",
 9153: 			axl_error_get_code (error), axl_error_get (error));
 9154: 		axl_error_free (error);
 9155: 		return -1;
 9156: 	}	
 9157: 
 9158: 	if (test_19 (&error)) {
 9159: 		printf ("Test 19: Axl document node replacing [   OK   ]\n");
 9160: 	} else {
 9161: 		printf ("Test 19: Axl document node replacing [ FAILED ]\n  (CODE: %d) %s\n",
 9162: 			axl_error_get_code (error), axl_error_get (error));
 9163: 		axl_error_free (error);
 9164: 		return -1;
 9165: 	}	
 9166: 
 9167: 
 9168: 	if (test_20 (&error)) {
 9169: 		printf ("Test 20: Axl node copy and anotation data [   OK   ]\n");
 9170: 	} else {
 9171: 		printf ("Test 20: Axl node copy and anotation data [ FAILED ]\n  (CODE: %d) %s\n",
 9172: 			axl_error_get_code (error), axl_error_get (error));
 9173: 		axl_error_free (error);
 9174: 		return -1;
 9175: 	}	
 9176: 
 9177: 	if (test_20b (&error)) {
 9178: 		printf ("Test 20b: Axl node copy 2 [   OK   ]\n");
 9179: 	} else {
 9180: 		printf ("Test 20b: Axl node copy 2 [ FAILED ]\n  (CODE: %d) %s\n",
 9181: 			axl_error_get_code (error), axl_error_get (error));
 9182: 		axl_error_free (error);
 9183: 		return -1;
 9184: 	}	
 9185: 
 9186: 	if (test_21 (&error)) {
 9187: 		printf ("Test 21: Axl node mixed content [   OK   ]\n");
 9188: 	} else {
 9189: 		printf ("Test 21: Axl node mixed content [ FAILED ]\n  (CODE: %d) %s\n",
 9190: 			axl_error_get_code (error), axl_error_get (error));
 9191: 		axl_error_free (error);
 9192: 		return -1;
 9193: 	}	
 9194: 
 9195: 	if (test_22 (&error)) {
 9196: 		printf ("Test 22: Axl node attributes [   OK   ]\n");
 9197: 	} else {
 9198: 		printf ("Test 22: Axl node attributes [ FAILED ]\n  (CODE: %d) %s\n",
 9199: 			axl_error_get_code (error), axl_error_get (error));
 9200: 		axl_error_free (error);
 9201: 		return -1;
 9202: 	}
 9203: 
 9204: 	if (test_23 (&error)) {
 9205: 		printf ("Test 23: Axl item modification [   OK   ]\n");
 9206: 	} else {
 9207: 		printf ("Test 23: Axl item modification [ FAILED ]\n  (CODE: %d) %s\n",
 9208: 			axl_error_get_code (error), axl_error_get (error));
 9209: 		axl_error_free (error);
 9210: 		return -1;
 9211: 	}
 9212: 
 9213: 	if (test_24 (&error)) {
 9214: 		printf ("Test 24: Invalid sequences detection [   OK   ]\n");
 9215: 	}else {
 9216: 		printf ("Test 24: Invalid sequences detection [ FAILED ]\n  (CODE: %d) %s\n",
 9217: 			axl_error_get_code (error), axl_error_get (error));
 9218: 		axl_error_free (error);
 9219: 		return -1;
 9220: 	}
 9221: 
 9222: 	if (test_25 (&error)) {
 9223: 		printf ("Test 25: Lookup functions [   OK   ]\n");
 9224: 	}else {
 9225: 		printf ("Test 25: Lookup [ FAILED ]\n  (CODE: %d) %s\n",
 9226: 			axl_error_get_code (error), axl_error_get (error));
 9227: 		axl_error_free (error);
 9228: 		return -1;
 9229: 	}
 9230: 
 9231: #ifdef AXL_NS_SUPPORT
 9232: 	if (test_26 (&error)) {
 9233: 		printf ("Test 26: Namespace support (basic) [   OK   ]\n");
 9234: 	}else {
 9235: 		printf ("Test 26: Namespace support (basic) [ FAILED ]\n  (CODE: %d) %s\n",
 9236: 			axl_error_get_code (error), axl_error_get (error));
 9237: 		axl_error_free (error);
 9238: 		return -1;
 9239: 	}
 9240: 
 9241: 	if (test_27 (&error)) {
 9242: 		printf ("Test 27: Namespace support [   OK   ]\n");
 9243: 	}else {
 9244: 		printf ("Test 27: Namespace support [ FAILED ]\n  (CODE: %d) %s\n",
 9245: 			axl_error_get_code (error), axl_error_get (error));
 9246: 		axl_error_free (error);
 9247: 		return -1;
 9248: 	}
 9249: 
 9250: 	if (test_28 (&error)) {
 9251: 		printf ("Test 28: Namespace defaulting support [   OK   ]\n");
 9252: 	}else {
 9253: 		printf ("Test 28: Namespace defaulting support [ FAILED ]\n  (CODE: %d) %s\n",
 9254: 			axl_error_get_code (error), axl_error_get (error));
 9255: 		axl_error_free (error);
 9256: 		return -1;
 9257: 	}
 9258: 
 9259: 	if (test_29 (&error)) {
 9260: 		printf ("Test 29: Namespace lookup support [   OK   ]\n");
 9261: 	}else {
 9262: 		printf ("Test 29: Namespace lookup support [ FAILED ]\n  (CODE: %d) %s\n",
 9263: 			axl_error_get_code (error), axl_error_get (error));
 9264: 		axl_error_free (error);
 9265: 		return -1;
 9266: 	}
 9267: 
 9268: #endif /* end #ifdef AXL_NS_SUPPORT */	
 9269: 
 9270: 	if (test_30 (&error)) {
 9271: 		printf ("Test 30: DTD attribute validation support [   OK   ]\n");
 9272: 	}else {
 9273: 		printf ("Test 30: DTD attribute validation support [ FAILED ]\n  (CODE: %d) %s\n",
 9274: 			axl_error_get_code (error), axl_error_get (error));
 9275: 		axl_error_free (error);
 9276: 		return -1;
 9277: 	}
 9278: 
 9279: 	if (test_31 (&error)) {
 9280: 		printf ("Test 31: DTD attribute validation (ID support) [   OK   ]\n");
 9281: 	}else {
 9282: 		printf ("Test 31: DTD attribute validation (ID support) [ FAILED ]\n  (CODE: %d) %s\n",
 9283: 			axl_error_get_code (error), axl_error_get (error));
 9284: 		axl_error_free (error);
 9285: 		return -1;
 9286: 	}
 9287: 
 9288: 	if (test_32 (&error)) {
 9289: 		printf ("Test 32: DTD attribute validation (IDREF support) [   OK   ]\n");
 9290: 	}else {
 9291: 		printf ("Test 32: DTD attribute validation (IDREF support) [ FAILED ]\n  (CODE: %d) %s\n",
 9292: 			axl_error_get_code (error), axl_error_get (error));
 9293: 		axl_error_free (error);
 9294: 		return -1;
 9295: 	}
 9296: 	
 9297: 	if (test_33 (&error)) {
 9298: 		printf ("Test 33: Recursive root node replace [   OK   ]\n");
 9299: 	}else {
 9300: 		printf ("Test 33: Recursive root node replace [ FAILED ]\n  (CODE: %d) %s\n",
 9301: 			axl_error_get_code (error), axl_error_get (error));
 9302: 		axl_error_free (error);
 9303: 		return -1;
 9304: 	}
 9305: 
 9306: 	if (test_34 (&error)) {
 9307: 		printf ("Test 34: axl trim bug (19/06/2007) [   OK   ]\n");
 9308: 	}else {
 9309: 		printf ("Test 34: axl trim bug (19/06/2007) [ FAILED ]\n  (CODE: %d) %s\n",
 9310: 			axl_error_get_code (error), axl_error_get (error));
 9311: 		axl_error_free (error);
 9312: 		return -1;
 9313: 	}
 9314: 
 9315: 	if (test_35 (&error)) {
 9316: 		printf ("Test 35: axl_doc_parse_from_file bug (20/06/2007) [   OK   ]\n");
 9317: 	}else {
 9318: 		printf ("Test 35: axl_doc_parse_from_file bug (20/06/2007) [ FAILED ]\n  (CODE: %d) %s\n",
 9319: 			axl_error_get_code (error), axl_error_get (error));
 9320: 		axl_error_free (error);
 9321: 		return -1;
 9322: 	}
 9323: 
 9324: 	if (test_36 (&error)) {
 9325: 		printf ("Test 36: deattach root node [   OK   ]\n");
 9326: 	}else {
 9327: 		printf ("Test 36: deattach root node [ FAILED ]\n  (CODE: %d) %s\n",
 9328: 			axl_error_get_code (error), axl_error_get (error));
 9329: 		axl_error_free (error);
 9330: 		return -1;
 9331: 	}
 9332: 
 9333: 	if (test_37 (&error)) {
 9334: 		printf ("Test 37: clearing xml node content [   OK   ]\n");
 9335: 	}else {
 9336: 		printf ("Test 37: clearing xml node content [ FAILED ]\n  (CODE: %d) %s\n",
 9337: 			axl_error_get_code (error), axl_error_get (error));
 9338: 		axl_error_free (error);
 9339: 		return -1;
 9340: 	}
 9341: 
 9342: 	if (test_38 (&error)) {
 9343: 		printf ("Test 38: IDREF dtd error found (23/06/2007) [   OK   ]\n");
 9344: 	}else {
 9345: 		printf ("Test 38: IDREF dtd error found (23/06/2007) [ FAILED ]\n  (CODE: %d) %s\n",
 9346: 			axl_error_get_code (error), axl_error_get (error));
 9347: 		axl_error_free (error);
 9348: 		return -1;
 9349: 	}
 9350: 
 9351: 	if (test_39 (&error)) {
 9352: 		printf ("Test 39: Inline dtd support [   OK   ]\n");
 9353: 	}else {
 9354: 		printf ("Test 39: Inline dtd support [ FAILED ]\n  (CODE: %d) %s\n",
 9355: 			axl_error_get_code (error), axl_error_get (error));
 9356: 		axl_error_free (error);
 9357: 		return -1;
 9358: 	}
 9359: 
 9360: 	if (test_40 (&error)) {
 9361: 		printf ("Test 40: Avoid recursive content inclusion into coments  [   OK   ]\n");
 9362: 	}else {
 9363: 		printf ("Test 40: Avoid recursive content inclusion into coments  [ FAILED ]\n  (CODE: %d) %s\n",
 9364: 			axl_error_get_code (error), axl_error_get (error));
 9365: 		axl_error_free (error);
 9366: 		return -1;
 9367: 	}
 9368: 
 9369: 	if (test_41 (&error)) {
 9370: 		printf ("Test 41: Extended encoding support (through axl-babel)  [   OK   ]\n");
 9371: 	}else {
 9372: 		printf ("Test 41: Extended encoding support (through axl-babel)  [ FAILED ]\n  (CODE: %d) %s\n",
 9373: 			axl_error_get_code (error), axl_error_get (error));
 9374: 		axl_error_free (error);
 9375: 		return -1;
 9376: 	}
 9377: 
 9378: 	if (test_42 (&error)) {
 9379: 		printf ("Test 42: Checking nested CDATA support (including ']]>', '<![CDATA[' or xml documents with '<![CDATA[..]]>' decls) [   OK   ]\n");
 9380: 	}else {
 9381: 		printf ("Test 42: Checking nested CDATA support CDATA declaration (including ']]>', '<![CDATA[' or xml documents with '<![CDATA[..]]>' decls) [ FAILED ]\n  (CODE: %d) %s\n",
 9382: 			axl_error_get_code (error), axl_error_get (error));
 9383: 		axl_error_free (error);
 9384: 		return -1;
 9385: 	}
 9386: 
 9387: 	if (test_43 (&error)) {
 9388: 		printf ("Test 43: Memory leak check with root nodes [   OK   ]\n");
 9389: 	}else {
 9390: 		printf ("Test 43: Memory leak check with root nodes [ FAILED ]\n  (CODE: %d) %s\n",
 9391: 			axl_error_get_code (error), axl_error_get (error));
 9392: 		axl_error_free (error);
 9393: 		return -1;
 9394: 	}
 9395: 
 9396: 	if (test_44 (&error)) {
 9397: 		printf ("Test 44: DTD fix (optional child after one to many child spec) [   OK   ]\n");
 9398: 	}else {
 9399: 		printf ("Test 44: DTD fix (optional child after one to many child spec) [ FAILED ]\n  (CODE: %d) %s\n",
 9400: 			axl_error_get_code (error), axl_error_get (error));
 9401: 		axl_error_free (error);
 9402: 		return -1;
 9403: 	}
 9404: 
 9405: 	if (test_45 (&error)) {
 9406: 		printf ("Test 45: Fix attribute added twice [   OK   ]\n");
 9407: 	}else {
 9408: 		printf ("Test 45: Fix attribute added twice [ FAILED ]\n  (CODE: %d) %s\n",
 9409: 			axl_error_get_code (error), axl_error_get (error));
 9410: 		axl_error_free (error);
 9411: 		return -1;
 9412: 	}
 9413: 
 9414: 	/* cleanup axl library */
 9415: 	axl_end ();
 9416: 	return 0;
 9417: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>