Annotation of gpl/axl/test/test_01.c, revision 1.1.1.1

1.1       misho       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:        axl_node_remove_attribute (node, "attribute1");
                   2109: 
                   2110:        if (axl_node_num_attributes (node) != 10) {
                   2111:                axl_error_new (-1, "Expected to find 10 attributes", NULL, error);
                   2112:                return axl_false;
                   2113:        }
                   2114:        
                   2115:        if (axl_node_has_attribute (node, "attribute1")) {
                   2116:                axl_error_new (-1, "Found that attribute1 should not appear, but it was found", NULL, error);
                   2117:                return axl_false;
                   2118:        } /* end if */
                   2119: 
                   2120:        node = axl_node_create ("test");
                   2121:        axl_node_set_attribute (node, "test", "test");
                   2122:        
                   2123:        if (axl_node_num_attributes (node) != 1) {
                   2124:                axl_error_new (-1, "Expected to find 1 attributes", NULL, error);
                   2125:                return axl_false;
                   2126:        }
                   2127: 
                   2128:        axl_node_remove_attribute (node, "test");
                   2129: 
                   2130:        if (axl_node_num_attributes (node) != 0) {
                   2131:                axl_error_new (-1, "Expected to find 1 attributes", NULL, error);
                   2132:                return axl_false;
                   2133:        }
                   2134: 
                   2135:        axl_node_set_attribute (node, "test1", "test");
                   2136:        axl_node_set_attribute (node, "test2", "test");
                   2137:        axl_node_set_attribute (node, "test3", "test");
                   2138: 
                   2139:        if (axl_node_num_attributes (node) != 3) {
                   2140:                axl_error_new (-1, "Expected to find 3 attributes", NULL, error);
                   2141:                return axl_false;
                   2142:        }
                   2143: 
                   2144:        axl_node_remove_attribute (node, "test1");
                   2145:        axl_node_remove_attribute (node, "test2");
                   2146:        axl_node_remove_attribute (node, "test3");
                   2147: 
                   2148:        if (axl_node_num_attributes (node) != 0) {
                   2149:                axl_error_new (-1, "Expected to find 0 attributes", NULL, error);
                   2150:                return axl_false;
                   2151:        }
                   2152: 
                   2153:        axl_node_free (node);
                   2154:        
                   2155:        /* free document */
                   2156:        axl_doc_free (doc);
                   2157: 
                   2158:        /* check to parse a document with */
                   2159:        doc = axl_doc_parse_from_file ("test_22.xml", NULL);
                   2160:        if (doc != NULL) {
                   2161:                axl_error_report (error, -1, "Expected to find a failure while reading an xml document with duplicated attributes");
                   2162:                return axl_false;
                   2163:        } /* end if */
                   2164: 
                   2165:        
                   2166:        /* check for empty attributes ( ='value') */
                   2167:        doc = axl_doc_parse_from_file ("test_22b.xml", NULL);
                   2168:        if (doc != NULL) {
                   2169:                axl_error_report (error, -1, "Expected to find a failure while loading a document with empty attributes");
                   2170:                return axl_false;
                   2171:        }
                   2172: 
                   2173:        /* check for empty values associated to
                   2174:         * attributes ( value=' this value ' ) */
                   2175:        doc = axl_doc_parse_from_file ("test_22c.xml", NULL);
                   2176:        if (doc != NULL) {
                   2177:                axl_error_report (error, -1, "Expected to find a failure while loading a document with empty attributes values");
                   2178:                return axl_false;
                   2179:        } /* end if */
                   2180: 
                   2181:        doc = axl_doc_create (NULL, NULL, axl_true);
                   2182:        node = axl_node_create ("test");
                   2183:        axl_doc_set_root (doc, node);
                   2184: 
                   2185:        /* configure attributes */
                   2186:        axl_node_set_attribute (node, "", "a value");
                   2187: 
                   2188:        /* configure attribute */
                   2189:        axl_node_set_attribute (node, "", "");
                   2190: 
                   2191:        /* configure attribute */
                   2192:        axl_node_set_attribute (node, "", "another value");
                   2193: 
                   2194:        if (! axl_doc_dump_pretty_to_file (doc, "test_22-test.xml", 4)) {
                   2195:                axl_error_report (error, -1, "Expected to find proper dump after wrong attribute configuration..");
                   2196:                return axl_false;
                   2197:        } /* end if */
                   2198: 
                   2199:        axl_doc_free (doc);
                   2200: 
                   2201:        /* check for empty values associated to
                   2202:         * attributes ( value=' this value ' ) */
                   2203:        doc = axl_doc_parse_from_file ("test_22-test.xml", NULL);
                   2204:        if (doc == NULL) {
                   2205:                axl_error_report (error, -1, "Expected to find proper document loading after wrong attribute configuration.");
                   2206:                return axl_false;
                   2207:        } /* end if */
                   2208: 
                   2209:        /* free documnent */
                   2210:        axl_doc_free (doc);
                   2211: 
                   2212:        return axl_true;
                   2213: }
                   2214: 
                   2215: /** 
                   2216:  * @brief Test mixed content documents support (TEST NOT FINISHED).
                   2217:  * 
                   2218:  * @param error The optional axlError to be used to report errors.
                   2219:  * 
                   2220:  * @return axl_true if the validity test is passed, axl_false if not.
                   2221:  */
                   2222: axl_bool test_21 (axlError ** error)
                   2223: {
                   2224:        axlDoc  * doc;
                   2225:        axlNode * node;
                   2226:        axlItem * item;
                   2227:        char    * content;
                   2228:        int       content_size;
                   2229: 
                   2230:        /* load the document */
                   2231:        doc = axl_doc_parse_from_file ("test_21.xml", error);
                   2232:        if (doc == NULL)
                   2233:                return axl_false;
                   2234: 
                   2235:        /* get the root node */
                   2236:        node = axl_doc_get_root (doc);
                   2237: 
                   2238:        /* check document content */
                   2239:        if (! NODE_CMP_NAME (node, "document")) {
                   2240:                axl_error_new (-1, "Expected to find root node=<document> but it wasn't found", NULL, error);
                   2241:                return axl_false;
                   2242:        }
                   2243: 
                   2244:        /* iterate root childs */
                   2245:        item = axl_item_get_first_child (node);
                   2246: 
                   2247:        if (axl_item_get_type (item) != ITEM_CONTENT) {
                   2248:                axl_error_new (-1, "Expected to find content but it wasn't found", NULL, error);
                   2249:                return axl_false;
                   2250:        }       
                   2251: 
                   2252:        /* get the content */
                   2253:        content = axl_item_get_content (item, &content_size);
                   2254:        if (! axl_cmp (content, "\n  Some content inside the document ")) {
                   2255:                axl_error_new (-1, "Expected to find content but it wasn't found", NULL, error);
                   2256:                return axl_false;
                   2257:        }
                   2258: 
                   2259:        /* get tne the item */
                   2260:        item = axl_item_get_next (item);
                   2261:        if (axl_item_get_type (item) != ITEM_NODE) {
                   2262:                axl_error_new (-1, "Expected to find a node but it wasn't found", NULL, error);
                   2263:                return axl_false;
                   2264:        }
                   2265: 
                   2266:        /* get the node */
                   2267:        node = axl_item_get_data (item);
                   2268: 
                   2269:        /* check document content */
                   2270:        if (! NODE_CMP_NAME (node, "strong")) {
                   2271:                axl_error_new (-1, "Expected to find root node=<strong> but it wasn't found", NULL, error);
                   2272:                return axl_false;
                   2273:        }
                   2274: 
                   2275:        /* get the first child of <strong> */
                   2276:        item = axl_item_get_first_child (node);
                   2277: 
                   2278:        if (axl_item_get_type (item) != ITEM_CONTENT) {
                   2279:                axl_error_new (-1, "Expected to find content inside strong but it wasn't found", NULL, error);
                   2280:                return axl_false;
                   2281:        }       
                   2282: 
                   2283:        /* get the content */
                   2284:        content = axl_item_get_content (item, &content_size);
                   2285:        if (! axl_cmp (content, "this content goes\n  bold")) {
                   2286:                axl_error_new (-1, "Expected to find content but it wasn't found", NULL, error);
                   2287:                return axl_false;
                   2288:        }
                   2289: 
                   2290:        /* now get the next item following the <strong> node */
                   2291:        item = axl_item_node_next (node);
                   2292: 
                   2293:        if (item == NULL) {
                   2294:                axl_error_new (-1, "Expected to find content following <strong> but a null item reference was found", NULL, error);
                   2295:                return axl_false;
                   2296:        }
                   2297: 
                   2298:        /* check to be it a content */
                   2299:        if (axl_item_get_type (item) != ITEM_CONTENT) {
                   2300:                axl_error_new (-1, "Expected to find content following <strong> node but it wasn't found", NULL, error);
                   2301:                return axl_false;
                   2302:        }       
                   2303: 
                   2304:        /* get the content */
                   2305:        content = axl_item_get_content (item, &content_size);
                   2306:        if (! axl_cmp (content, " more data stored directly inside the document node.\n\n ")) {
                   2307:                axl_error_new (-1, "Expected to find content but it wasn't found", NULL, error);
                   2308:                return axl_false;
                   2309:        }
                   2310: 
                   2311:        /* get the next item */
                   2312:        item = axl_item_get_next (item);
                   2313:        if (axl_item_get_type (item) != ITEM_NODE) {
                   2314:                axl_error_new (-1, "Expected to find a node but it wasn't found", NULL, error);
                   2315:                return axl_false;
                   2316:        }
                   2317: 
                   2318:        /* get the node */
                   2319:        node = axl_item_get_data (item);
                   2320: 
                   2321:        /* check document content */
                   2322:        if (! NODE_CMP_NAME (node, "childs")) {
                   2323:                axl_error_new (-1, "Expected to find root node=<strong> but it wasn't found", NULL, error);
                   2324:                return axl_false;
                   2325:        }
                   2326: 
                   2327:        /* get the first item */
                   2328:        item = axl_item_get_first_child (node);
                   2329:        if (axl_item_get_type (item) != ITEM_COMMENT) {
                   2330:                axl_error_new (-1, "Expected to find content inside strong but it wasn't found", NULL, error);
                   2331:                return axl_false;
                   2332:        }       
                   2333: 
                   2334:        /* get the content */
                   2335:        content = axl_item_get_content (item, &content_size);
                   2336:        if (! axl_cmp (content, " here goes a comment before text block ")) {
                   2337:                axl_error_new (-1, "Expected to find a comment, child of <childs>, but it wasn't found", NULL, error);
                   2338:                return axl_false;
                   2339:        }       
                   2340: 
                   2341:        /* get next item */
                   2342:        item = axl_item_get_next (item);
                   2343: 
                   2344:        /* check to be it a content */
                   2345:        if (axl_item_get_type (item) != ITEM_CONTENT) {
                   2346:                axl_error_new (-1, "Expected to find content following <childs> node comment but it wasn't found", NULL, error);
                   2347:                return axl_false;
                   2348:        }       
                   2349: 
                   2350:        /* get the content */
                   2351:        content = axl_item_get_content (item, &content_size);
                   2352:        if (! axl_cmp (content, "More text after child declaration.\n   ")) {
                   2353:                axl_error_new (-1, "Expected to find a content inside <childs> node, but it wasn't found", NULL, error);
                   2354:                return axl_false;
                   2355:        }       
                   2356: 
                   2357:        /* get next item */
                   2358:        item = axl_item_get_next (item);
                   2359: 
                   2360:        /* get the node */
                   2361:        node = axl_item_get_data (item);
                   2362: 
                   2363:        /* check document content */
                   2364:        if (! NODE_CMP_NAME (node, "child1")) {
                   2365:                axl_error_new (-1, "Expected to find root node=<strong> but it wasn't found", NULL, error);
                   2366:                return axl_false;
                   2367:        }
                   2368: 
                   2369: 
                   2370:        /* free axl document */
                   2371:        axl_doc_free (doc);
                   2372: 
                   2373:        return axl_true;
                   2374: }
                   2375: 
                   2376: /** 
                   2377:  * @brief Test entity support (basic entity support).
                   2378:  * 
                   2379:  * @param error The optional axlError to be used to report errors.
                   2380:  * 
                   2381:  * @return axl_true if the validity test is passed, axl_false if not.
                   2382:  */
                   2383: axl_bool test_20b (axlError ** error)
                   2384: {
                   2385:        axlNode * node;
                   2386: 
                   2387:        axlNode * aux;
                   2388:        axlNode * aux2;
                   2389: 
                   2390:        axlNode * child1;
                   2391:        axlNode * root;
                   2392: 
                   2393:        axlDoc  * doc;
                   2394:        axlDoc  * doc2;
                   2395:        axlDoc  * doc3;
                   2396: 
                   2397: 
                   2398:        int       iterator = 0;
                   2399:        int       sum = 0;
                   2400: 
                   2401:        /* load the document */
                   2402:        doc = axl_doc_parse_from_file ("test_20.xml", error);
                   2403:        if (doc == NULL)
                   2404:                return axl_false;
                   2405: 
                   2406:        /* load reference */
                   2407:        doc2 = axl_doc_parse_from_file ("test_20a.xml", error);
                   2408:        if (doc2 == NULL)
                   2409:                return axl_false;
                   2410: 
                   2411:        while (iterator < 10) {
                   2412: 
                   2413:                /* get document root */
                   2414:                root = axl_doc_get_root (doc);
                   2415:        
                   2416:                /* copy and release */
                   2417:                node = axl_node_copy (root, axl_true, axl_true);
                   2418: 
                   2419:                /* get the child1 reference */
                   2420:                child1 = axl_node_get_first_child (node);
                   2421:                
                   2422:                /* get child2 refrence */
                   2423:                aux    = axl_node_get_first_child (child1);
                   2424:                while (aux != NULL) {
                   2425:                        
                   2426:                        sum = axl_node_get_child_num (child1);
                   2427:                        
                   2428:                        /* get the next child before deattaching the
                   2429:                         * node */
                   2430:                        aux2 = axl_node_get_next (aux);
                   2431: 
                   2432:                        /* dettach the node from the <child1> parent
                   2433:                         * and attach it to the document */
                   2434:                        axl_node_deattach (aux);
                   2435: 
                   2436:                        if ((sum - 1) != (axl_node_get_child_num (child1))) {
                   2437:                                /* after doing the deattach process,
                   2438:                                 * the copy node doesn't have the
                   2439:                                 * expected child number */
                   2440:                                axl_error_new (-1, "After doing the deattach process, the copy node doesn't have the expected child number", NULL, error);
                   2441:                                return axl_false;
                   2442:                        }
                   2443: 
                   2444:                        /* set the node to the document root */
                   2445:                        axl_node_set_child (node, aux);
                   2446: 
                   2447:                        if (! NODE_CMP_NAME (axl_node_get_parent (aux), "document")) {
                   2448:                                
                   2449:                                axl_error_new (-1, "Expected to find a parent not found", NULL, error);
                   2450:                                return axl_false;
                   2451:                        }
                   2452: 
                   2453:                        /* get the next child */
                   2454:                        aux = aux2;
                   2455:                        
                   2456:                } /* end while */
                   2457: 
                   2458:                /* remove the child1 node */
                   2459:                aux = axl_node_get_first_child (node);
                   2460:                axl_node_remove (aux, axl_true);
                   2461: 
                   2462:                /* create the document holding the result */
                   2463:                doc3 = axl_doc_create (NULL, NULL, axl_false);
                   2464:                axl_doc_set_root (doc3, node);
                   2465: 
                   2466:                /* compare the document */
                   2467:                if (!axl_doc_are_equal (doc2, doc3)) {
                   2468:                        axl_error_new (-1, "Expected to find equal documents but (modified doc2 != doc3), they wasn't found", NULL, error);
                   2469:                        return axl_false;
                   2470:                }
                   2471: 
                   2472:                /* free the document */
                   2473:                axl_doc_free (doc3);
                   2474: 
                   2475:                /* update iterator */
                   2476:                iterator++;
                   2477: 
                   2478:        } /* end while */
                   2479: 
                   2480:        /* free the document 2 */
                   2481:        axl_doc_free (doc2);
                   2482: 
                   2483:        /* free the document */
                   2484:        axl_doc_free (doc);
                   2485: 
                   2486:        return axl_true;
                   2487: 
                   2488: }
                   2489: 
                   2490: 
                   2491: /** 
                   2492:  * @brief Test entity support (basic entity support).
                   2493:  * 
                   2494:  * @param error The optional axlError to be used to report errors.
                   2495:  * 
                   2496:  * @return axl_true if the validity test is passed, axl_false if not.
                   2497:  */
                   2498: axl_bool test_20 (axlError ** error)
                   2499: {
                   2500:        axlNode * node;
                   2501:        axlNode * root;
                   2502:        axlDoc  * doc;
                   2503:        axlDoc  * doc2;
                   2504:        char    * data;
                   2505:        
                   2506: 
                   2507:        /* load the document */
                   2508:        doc = axl_doc_parse_from_file ("test_20.xml", error);
                   2509:        if (doc == NULL)
                   2510:                return axl_false;
                   2511: 
                   2512:        /* get document root */
                   2513:        root = axl_doc_get_root (doc);
                   2514:        node = axl_node_copy (root, axl_true, axl_true);
                   2515: 
                   2516:        /* check if both nodes are equal */
                   2517:        if (! axl_node_are_equal (root, node)) {
                   2518:                axl_error_new (-1, "Expected to find equal nodes but they weren't", NULL, error);
                   2519:                return axl_false;
                   2520:        }
                   2521:        
                   2522:        /* create a new document */
                   2523:        doc2 = axl_doc_create (NULL, NULL, axl_false);
                   2524:        axl_doc_set_root (doc2, node);
                   2525: 
                   2526:        if (! axl_doc_are_equal (doc, doc2)) {
                   2527:                axl_error_new (-1, "Expected to find equal documents but they weren't", NULL, error);
                   2528:                return axl_false;
                   2529:        }
                   2530: 
                   2531:        /* free document */
                   2532:        axl_doc_free (doc2);
                   2533: 
                   2534:        /* configure some anotation data */
                   2535:        axl_node_annotate_data (root, "key", "value");
                   2536:        
                   2537:        /* get child1 */
                   2538:        node = axl_node_get_first_child (root);
                   2539: 
                   2540:        /* get child2 */
                   2541:        node = axl_node_get_first_child (node);
                   2542: 
                   2543:        /* anotate data */
                   2544:        axl_node_annotate_data (node, "key1", "value1");
                   2545: 
                   2546:        /* perform searches */
                   2547:        data = axl_node_annotate_get (node, "key", axl_false);
                   2548:        if (data != NULL) {
                   2549:                axl_error_new (-1, "Expected to find nothing while looking for 'key'(1)", NULL, error);
                   2550:                return axl_false;
                   2551:        }
                   2552: 
                   2553:        data = axl_node_annotate_get (node, "key", axl_true);
                   2554:        if (data == NULL || !axl_cmp (data, "value")) {
                   2555:                axl_error_new (-1, "Expected to find data while looking for 'key' at parents (2)", NULL, error);
                   2556:                return axl_false;
                   2557:        }
                   2558: 
                   2559:        /* perform searches inside the node */
                   2560:        data = axl_node_annotate_get (node, "key1", axl_false);
                   2561:        if (data == NULL || !axl_cmp (data, "value1")) {
                   2562:                axl_error_new (-1, "Expected to find nothing while looking for 'key1'(3)", NULL, error);
                   2563:                return axl_false;
                   2564:        }
                   2565: 
                   2566:        /* perform more anotation but with native data */
                   2567:        axl_node_annotate_int (root, "int-value", 14);
                   2568:        
                   2569:        if (axl_node_annotate_get_int (root, "int-value", axl_false) != 14) {
                   2570:                axl_error_new (-1, "Expected to find an integer value (14), but it wasn't found", NULL, error);
                   2571:                return axl_false;
                   2572:        }
                   2573: 
                   2574:        axl_node_annotate_double (root, "double-value", 58.20);
                   2575: 
                   2576:        if (axl_node_annotate_get_double (root, "double-value", axl_false) != 58.20) {
                   2577:                axl_error_new (-1, "Expected to find an double value (58.20), but it wasn't found", NULL, error);
                   2578:                return axl_false;
                   2579:        }
                   2580: 
                   2581:        axl_node_annotate_string (root, "string-value", "this is a test string");
                   2582: 
                   2583:        if (! axl_cmp (axl_node_annotate_get_string (root, "string-value", axl_false), "this is a test string")) {
                   2584:                axl_error_new (-1, "Expected to find a string value (\"this is a test string\"), but it wasn't found", NULL, error);
                   2585:                return axl_false;
                   2586:        }
                   2587: 
                   2588:        if (axl_node_annotate_get_string (root, "string-not-found", axl_false) != NULL) {
                   2589:                axl_error_new (-1, "Expected to find empty value for an anotated element which isn't installed", NULL, error);
                   2590:                return axl_false;
                   2591:        }
                   2592: 
                   2593:        /* free document created */
                   2594:        axl_doc_free (doc);
                   2595: 
                   2596:        return axl_true;
                   2597: 
                   2598: }
                   2599: 
                   2600: /** 
                   2601:  * @brief Test entity support (basic entity support).
                   2602:  * 
                   2603:  * @param error The optional axlError to be used to report errors.
                   2604:  * 
                   2605:  * @return axl_true if the validity test is passed, axl_false if not.
                   2606:  */
                   2607: axl_bool test_19 (axlError ** error)
                   2608: {
                   2609:        axlDoc  * doc;
                   2610:        axlDoc  * reference;
                   2611:        axlNode * node;
                   2612:        axlNode * replace;
                   2613: 
                   2614:        /* create replace node */
                   2615:        replace = axl_node_create ("replace");
                   2616:        axl_node_set_content (replace, "test", -1);
                   2617: 
                   2618:        doc = axl_doc_parse_from_file ("test_19.xml", error);
                   2619:        if (doc == NULL)
                   2620:                return axl_false;
                   2621:        
                   2622:        /* document */
                   2623:        node = axl_doc_get_root (doc);
                   2624: 
                   2625:        /* child1 */
                   2626:        node = axl_node_get_first_child (node);
                   2627: 
                   2628:        /* child2 */
                   2629:        node = axl_node_get_first_child (node);
                   2630: 
                   2631:        /* replace */
                   2632:        axl_node_replace (node, replace, axl_false);
                   2633: 
                   2634:        reference = axl_doc_parse_from_file ("test_19a.xml", error);
                   2635:        if (reference == NULL)
                   2636:                return axl_false;
                   2637: 
                   2638:        /* check both documents to be equal */
                   2639:        if (! axl_doc_are_equal (doc, reference)) {
                   2640:                axl_error_new (-1, "Expected to find equal documents, but not found on first child replace", NULL, error);
                   2641:                return axl_false;
                   2642:        }
                   2643: 
                   2644:        /* free reference */
                   2645:        axl_doc_free (reference);
                   2646: 
                   2647:        /* restore */
                   2648:        axl_node_replace (replace, node, axl_false);
                   2649: 
                   2650:        /* get child2 */
                   2651:        node = axl_node_get_next (node);
                   2652:        
                   2653:        /* replace */
                   2654:        axl_node_replace (node, replace, axl_false);
                   2655: 
                   2656: 
                   2657:        reference = axl_doc_parse_from_file ("test_19b.xml", error);
                   2658:        if (reference == NULL)
                   2659:                return axl_false;
                   2660: 
                   2661:        /* check both documents to be equal */
                   2662:        if (! axl_doc_are_equal (doc, reference)) {
                   2663:                axl_error_new (-1, "Expected to find equal documents, but not found on first child replace", NULL, error);
                   2664:                return axl_false;
                   2665:        }
                   2666: 
                   2667:        /* free reference */
                   2668:        axl_doc_free (reference);       
                   2669: 
                   2670:        /* restore */
                   2671:        axl_node_replace (replace, node, axl_false);
                   2672: 
                   2673:        /* get child2 */
                   2674:        node = axl_node_get_next (node);
                   2675:        /* get child2 */
                   2676:        node = axl_node_get_next (node);
                   2677:        
                   2678:        /* replace */
                   2679:        axl_node_replace (node, replace, axl_true);
                   2680: 
                   2681:        reference = axl_doc_parse_from_file ("test_19c.xml", error);
                   2682:        if (reference == NULL)
                   2683:                return axl_false;
                   2684: 
                   2685:        /* check both documents to be equal */
                   2686:        if (! axl_doc_are_equal (doc, reference)) {
                   2687:                axl_error_new (-1, "Expected to find equal documents, but not found on first child replace", NULL, error);
                   2688:                return axl_false;
                   2689:        }
                   2690: 
                   2691:        /* free reference */
                   2692:        axl_doc_free (reference);       
                   2693: 
                   2694:        node = axl_node_create ("child5");
                   2695:        axl_node_set_content (node, "test", -1);
                   2696: 
                   2697:        /* replace */
                   2698:        axl_node_replace (replace, node, axl_true);
                   2699: 
                   2700:        /* document */
                   2701:        node = axl_doc_get_root (doc);
                   2702:        /* child1 */
                   2703:        node = axl_node_get_first_child (node);
                   2704:        /* child2 */
                   2705:        node = axl_node_get_first_child (node); 
                   2706: 
                   2707:        /* remove child2 */
                   2708:        axl_node_remove (node, axl_true);
                   2709: 
                   2710:        reference = axl_doc_parse_from_file ("test_19d.xml", error);
                   2711:        if (reference == NULL)
                   2712:                return axl_false;
                   2713: 
                   2714:        /* check both documents to be equal */
                   2715:        if (! axl_doc_are_equal (doc, reference)) {
                   2716:                axl_error_new (-1, "Expected to find equal documents, but not found on first child remove", NULL, error);
                   2717:                return axl_false;
                   2718:        }
                   2719: 
                   2720:        /* free reference */
                   2721:        axl_doc_free (reference);       
                   2722: 
                   2723:        /* document */
                   2724:        node = axl_doc_get_root (doc);
                   2725:        /* child1 */
                   2726:        node = axl_node_get_first_child (node);
                   2727:        /* child3 */
                   2728:        node = axl_node_get_first_child (node); 
                   2729: 
                   2730:        /* remove child3 */
                   2731:        axl_node_remove (node, axl_true);
                   2732: 
                   2733:        reference = axl_doc_parse_from_file ("test_19e.xml", error);
                   2734:        if (reference == NULL)
                   2735:                return axl_false;
                   2736: 
                   2737:        /* check both documents to be equal */
                   2738:        if (! axl_doc_are_equal (doc, reference)) {
                   2739:                axl_error_new (-1, "Expected to find equal documents, but not found on first child remove", NULL, error);
                   2740:                return axl_false;
                   2741:        }
                   2742: 
                   2743:        /* free reference */
                   2744:        axl_doc_free (reference);       
                   2745: 
                   2746:        /* document */
                   2747:        node = axl_doc_get_root (doc);
                   2748:        /* child1 */
                   2749:        node = axl_node_get_first_child (node);
                   2750:        /* child4 */
                   2751:        node = axl_node_get_first_child (node); 
                   2752: 
                   2753:        /* remove child4 */
                   2754:        axl_node_remove (node, axl_true);
                   2755: 
                   2756:        reference = axl_doc_parse_from_file ("test_19f.xml", error);
                   2757:        if (reference == NULL)
                   2758:                return axl_false;
                   2759: 
                   2760:        /* check both documents to be equal */
                   2761:        if (! axl_doc_are_equal (doc, reference)) {
                   2762:                axl_error_new (-1, "Expected to find equal documents, but not found on first child remove", NULL, error);
                   2763:                return axl_false;
                   2764:        }
                   2765: 
                   2766:        /* free reference */
                   2767:        axl_doc_free (reference);       
                   2768: 
                   2769:        /* document */
                   2770:        node = axl_doc_get_root (doc);
                   2771:        /* child1 */
                   2772:        node = axl_node_get_first_child (node);
                   2773:        /* child5 */
                   2774:        node = axl_node_get_first_child (node); 
                   2775: 
                   2776:        /* remove child5 */
                   2777:        axl_node_remove (node, axl_true);
                   2778: 
                   2779:        reference = axl_doc_parse_from_file ("test_19g.xml", error);
                   2780:        if (reference == NULL)
                   2781:                return axl_false;
                   2782: 
                   2783:        /* check both documents to be equal */
                   2784:        if (! axl_doc_are_equal (doc, reference)) {
                   2785:                axl_error_new (-1, "Expected to find equal documents, but not found on first child remove", NULL, error);
                   2786:                return axl_false;
                   2787:        }
                   2788: 
                   2789:        /* free reference */
                   2790:        axl_doc_free (reference);       
                   2791:        
                   2792:        /* free document */
                   2793:        axl_doc_free (doc);
                   2794: 
                   2795:        /* free reference */
                   2796:        return axl_true;
                   2797: }
                   2798: 
                   2799: /** 
                   2800:  * @brief Test entity support (basic entity support).
                   2801:  * 
                   2802:  * @param error The optional axlError to be used to report errors.
                   2803:  * 
                   2804:  * @return axl_true if the validity test is passed, axl_false if not.
                   2805:  */
                   2806: axl_bool test_18 (axlError ** error)
                   2807: {
                   2808:        axlDtd * dtd = NULL;
                   2809:        char   * content;
                   2810: 
                   2811:        /* parse af-arch DTD */
                   2812:        dtd = axl_dtd_parse_from_file ("channel.dtd", error);
                   2813:        if (dtd == NULL)
                   2814:                return axl_false;
                   2815: 
                   2816:        /* lookup for entity definitions */
                   2817:        if (axl_dtd_entity_exists (dtd, "TEST", GENERAL_ENTITY)) {
                   2818:                axl_error_new (-1, "Expected to not find an entity value which was found (TEST)..", NULL, error);
                   2819:                return axl_false;
                   2820:        }
                   2821:        
                   2822:        if (axl_dtd_entity_exists (dtd, "URI", GENERAL_ENTITY)) {
                   2823:                axl_error_new (-1, "Expected to not find an entity value which was found (URI)..", NULL, error);
                   2824:                return axl_false;
                   2825:        }
                   2826:        
                   2827:        /* lookup for entity definitions that are expected to be found */
                   2828:        if (! axl_dtd_entity_exists (dtd, "URI", PARAMETER_ENTITY)) {
                   2829:                axl_error_new (-1, "Expected to find an entity value which wasn't found (% URI)..", NULL, error);
                   2830:                return axl_false;
                   2831:        }
                   2832: 
                   2833:        if (! axl_dtd_entity_exists (dtd, "LOCS", PARAMETER_ENTITY)) {
                   2834:                axl_error_new (-1, "Expected to find an entity value which wasn' found (% LOCS)..", NULL, error);
                   2835:                return axl_false;
                   2836:        }
                   2837: 
                   2838:        /* now get the content inside */
                   2839:        content = axl_dtd_entity_value (dtd, "CHAN", PARAMETER_ENTITY);
                   2840:        if (content == NULL) {
                   2841:                axl_error_new (-1, "Expected to find parameter entity content for (% CHAN) but it wasn't found", NULL, error);
                   2842:                return axl_false;
                   2843:        }
                   2844:        
                   2845:        if (! axl_cmp (content, "CDATA")) {
                   2846:                axl_error_new (-1, "Expected to find parameter entity content for (% CHAN) it doesn't match", NULL, error);
                   2847:                return axl_false;       
                   2848:        }
                   2849: 
                   2850:        /* free the dtd */
                   2851:        axl_dtd_free (dtd);
                   2852: 
                   2853:        return axl_true;
                   2854: }
                   2855: 
                   2856: /** 
                   2857:  * @brief A more complex DTD parsing example
                   2858:  * 
                   2859:  * @param error The optional axlError to be used to report errors.
                   2860:  * 
                   2861:  * @return axl_true if the validity test is passed, axl_false if not.
                   2862:  */
                   2863: axl_bool test_17 (axlError ** error) 
                   2864: {
                   2865:        axlDoc  * doc  = NULL;
                   2866:        axlDtd  * dtd  = NULL;
                   2867: 
                   2868:        /* parse common DTD file */
                   2869:        dtd = axl_dtd_parse_from_file ("xml-rpc.dtd", error);
                   2870:        if (dtd == NULL)
                   2871:                return axl_false;
                   2872: 
                   2873:        /* parse a file that must not be valid */
                   2874:        doc = axl_doc_parse_from_file ("test17.xdl", error);
                   2875:        if (doc == NULL)
                   2876:                return axl_false;
                   2877: 
                   2878:        /* the following validation must fail */
                   2879:        if (axl_dtd_validate (doc, dtd, error)) {
                   2880:                axl_error_new (-1, "A validation was produced when expected a failure", NULL, error);
                   2881:                return axl_false;
                   2882:        }
                   2883: 
                   2884:        /* because a failure was expected, release memory allocated by
                   2885:         * axl_error_new */
                   2886:        axl_error_free (*error);
                   2887: 
                   2888:        /* free the document */
                   2889:        axl_doc_free (doc);
                   2890: 
                   2891:        /* release DTD reference */
                   2892:        axl_dtd_free (dtd);
                   2893: 
                   2894:        return axl_true;
                   2895: }
                   2896: 
                   2897: /** 
                   2898:  * @brief A more complex DTD parsing example
                   2899:  * 
                   2900:  * @param error The optional axlError to be used to report errors.
                   2901:  * 
                   2902:  * @return axl_true if the validity test is passed, axl_false if not.
                   2903:  */
                   2904: axl_bool test_16 (axlError ** error) 
                   2905: {
                   2906:        axlDoc  * doc  = NULL;
                   2907:        axlDtd  * dtd  = NULL;
                   2908: 
                   2909:        /* parse common DTD file */
                   2910:        dtd = axl_dtd_parse_from_file ("xml-rpc.dtd", error);
                   2911:        if (dtd == NULL)
                   2912:                return axl_false;
                   2913: 
                   2914:        /* parse a file that must not be valid */
                   2915:        doc = axl_doc_parse_from_file ("test03.xdl", error);
                   2916:        if (doc == NULL)
                   2917:                return axl_false;
                   2918: 
                   2919:        /* the following validation must fail */
                   2920:        if (axl_dtd_validate (doc, dtd, error)) {
                   2921:                axl_error_new (-1, "A validation was produced when expected a failure", NULL, error);
                   2922:                return axl_false;
                   2923:        }
                   2924: 
                   2925:        /* because a failure was expected, release memory allocated by
                   2926:         * axl_error_new */
                   2927:        axl_error_free (*error);
                   2928: 
                   2929:        /* free the document */
                   2930:        axl_doc_free (doc);
                   2931: 
                   2932:        /* parse the next file that must be valid */
                   2933:        doc = axl_doc_parse_from_file ("test04.xdl", error);
                   2934:        if (doc == NULL)
                   2935:                return axl_false;
                   2936: 
                   2937:        /* the following validation should successed */
                   2938:        if (! axl_dtd_validate (doc, dtd, error))
                   2939:                return axl_false;
                   2940: 
                   2941:        /* release the document */
                   2942:        axl_doc_free (doc);
                   2943:        
                   2944:        /* release DTD reference */
                   2945:        axl_dtd_free (dtd);
                   2946: 
                   2947:        return axl_true;
                   2948: }
                   2949: 
                   2950: /** 
                   2951:  * @brief A more complex DTD parsing example
                   2952:  * 
                   2953:  * @param error The optional axlError to be used to report errors.
                   2954:  * 
                   2955:  * @return axl_true if the validity test is passed, axl_false if not.
                   2956:  */
                   2957: axl_bool test_15 (axlError ** error) 
                   2958: {
                   2959:        axlDoc  * doc  = NULL;
                   2960:        axlDtd  * dtd  = NULL;
                   2961: 
                   2962:        /* parse common DTD file */
                   2963:        dtd = axl_dtd_parse_from_file ("xml-rpc.dtd", error);
                   2964:        if (dtd == NULL)
                   2965:                return axl_false;
                   2966: 
                   2967:        /* parse a file that must not be valid */
                   2968:        doc = axl_doc_parse_from_file ("test01.xdl", error);
                   2969:        if (doc == NULL)
                   2970:                return axl_false;
                   2971: 
                   2972:        /* the following validation must fail */
                   2973:        if (axl_dtd_validate (doc, dtd, error)) {
                   2974:                axl_error_new (-1, "A validation was produced when expected a failure", NULL, error);
                   2975:                return axl_false;
                   2976:        }
                   2977: 
                   2978:        /* because a failure was expected, release memory allocated by
                   2979:         * axl_error_new */
                   2980:        axl_error_free (*error);
                   2981: 
                   2982:        /* free the document */
                   2983:        axl_doc_free (doc);
                   2984: 
                   2985:        /* parse the next file that must be valid */
                   2986:        doc = axl_doc_parse_from_file ("test02.xdl", error);
                   2987:        if (doc == NULL)
                   2988:                return axl_false;
                   2989: 
                   2990:        /* the following validation should successed */
                   2991:        if (! axl_dtd_validate (doc, dtd, error))
                   2992:                return axl_false;
                   2993: 
                   2994:        /* release the document */
                   2995:        axl_doc_free (doc);
                   2996:        
                   2997:        /* release DTD reference */
                   2998:        axl_dtd_free (dtd);
                   2999: 
                   3000:        return axl_true;
                   3001: }
                   3002: 
                   3003: /** 
                   3004:  * @brief A more complex DTD parsing example
                   3005:  * 
                   3006:  * @param error The optional axlError to be used to report errors.
                   3007:  * 
                   3008:  * @return axl_true if the validity test is passed, axl_false if not.
                   3009:  */
                   3010: axl_bool test_14 (axlError ** error) 
                   3011: {
                   3012:        axlDoc  * doc  = NULL;
                   3013:        axlNode * node = NULL;
                   3014:        
                   3015:        char    * xml_document;
                   3016:        char    * value;
                   3017:        int       size = 0;
                   3018:        int       document_size;
                   3019:        
                   3020: 
                   3021:        /* create an emtpy document */
                   3022:        doc = axl_doc_create ("1.0", NULL, axl_false);
                   3023: 
                   3024:        /* create the root node */
                   3025:        node = axl_node_create ("test");
                   3026:        axl_node_set_content (node, "This is a test (') (\") (>) (<) (&), more data###", -1);
                   3027:        
                   3028:        axl_doc_set_root (doc, node);
                   3029: 
                   3030:        /* dump the document */
                   3031:        axl_doc_dump (doc, &xml_document, &document_size);
                   3032:        
                   3033:        if (!axl_cmp ("<?xml version='1.0' ?><test>This is a test (&apos;) (&quot;) (&gt;) (&lt;) (&amp;), more data###</test>",
                   3034:                      xml_document)) {
                   3035:                axl_error_new (-1, "Found dump mismatch that shows entities are not handled properly", NULL, error);
                   3036:                return axl_false;
                   3037:        }
                   3038: 
                   3039:        /* free memory dump */
                   3040:        axl_free (xml_document);
                   3041: 
                   3042:        /* get the content translated */
                   3043:        value = axl_node_get_content_copy (node, &size);
                   3044: 
                   3045:        if (size != 68) {
                   3046:                axl_error_new (-1, "Found a document size mismatch while dumping entity content", NULL, error);
                   3047:                return axl_false;
                   3048:        }
                   3049:        
                   3050:        /* free the content received */
                   3051:        axl_free (value);
                   3052: 
                   3053:        /* get the content translated */
                   3054:        value = axl_node_get_content_trans (node, &size);
                   3055: 
                   3056:        if (size != 48) {
                   3057:                axl_error_new (-1, "Found a document size mismatch while dumping entity content (already translated)", NULL, error);
                   3058:                return axl_false;
                   3059:        }
                   3060: 
                   3061:        /* check node content returned */
                   3062:        if (!axl_cmp (value, "This is a test (\') (\") (>) (<) (&), more data###")) {
                   3063:                axl_error_new (-1, "Found an string mismatch while checking a node content which was translated", NULL, error);
                   3064:                return axl_false;
                   3065:        }
                   3066: 
                   3067:        /* free the content translated */
                   3068:        axl_free (value);
                   3069: 
                   3070:        /* free document */
                   3071:        axl_doc_free (doc);
                   3072: 
                   3073:        doc = axl_doc_parse ("<?xml version='1.0' ?><test></test>", 37, error);
                   3074:        if (doc == NULL) {
                   3075:                printf ("Expected to parse a document but it fails, error was: %s\n", axl_error_get (*error));
                   3076:                return axl_false;
                   3077:        }
                   3078: 
                   3079:        /* get the content */
                   3080:        node = axl_doc_get (doc, "/test");
                   3081:        if (node == NULL) {
                   3082:                axl_error_new (-1, "Expected to find a node reference not found (/test)\n", NULL, error);
                   3083:                return axl_false;               
                   3084:        }
                   3085: 
                   3086:        /* get the content */
                   3087:        size  = 11;
                   3088:        value = (char*) axl_node_get_content (node, &size);
                   3089:        if (size != 0) {
                   3090:                axl_error_new (-1, "Expected to find a node content with 0 bytes but it 11 (/test)\n", NULL, error);
                   3091:                return axl_false;
                   3092:        }
                   3093: 
                   3094:        /* get the content copy */
                   3095:        size  = 13;
                   3096:        value = axl_node_get_content_copy (node, &size);
                   3097:        if (size != 0) {
                   3098:                axl_error_new (-1, "Expected to find a node content with 0 bytes but it 13 (/test)\n", NULL, error);
                   3099:                return axl_false;
                   3100:        }
                   3101:        axl_free (value);
                   3102: 
                   3103:        /* get content copy trans */
                   3104:        size  = 14;
                   3105:        value = axl_node_get_content_trans (node, &size);
                   3106:        if (size != 0) {
                   3107:                axl_error_new (-1, "Expected to find a node content with 0 bytes but it 14 (/test)\n", NULL, error);
                   3108:                return axl_false;
                   3109:        }
                   3110:        axl_free (value);
                   3111: 
                   3112:        /* get content trimmed */
                   3113:        size  = 15;
                   3114:        value = axl_node_get_content_trim (node, &size);
                   3115:        if (size != 0) {
                   3116:                axl_error_new (-1, "Expected to find a node content with 0 bytes but it 15 (/test)\n", NULL, error);
                   3117:                return axl_false;
                   3118:        }
                   3119: 
                   3120:        /* free the document */
                   3121:        axl_doc_free (doc);
                   3122: 
                   3123:        return axl_true;
                   3124: }
                   3125: 
                   3126: /** 
                   3127:  * @brief Memory dump operation checks.
                   3128:  * 
                   3129:  * @param error The optional axlError to be used to report errors.
                   3130:  * 
                   3131:  * @return axl_true if the validity test is passed, axl_false if not.
                   3132:  */
                   3133: axl_bool test_13 (axlError ** error) 
                   3134: {
                   3135:        axlDoc  * doc  = NULL;
                   3136:        axlDoc  * doc2 = NULL;
                   3137:        axlDoc  * doc3 = NULL;
                   3138:        
                   3139:        axlNode * node = NULL;
                   3140:        char    * content;
                   3141:        int       size;
                   3142:        
                   3143:        doc = axl_doc_parse_from_file ("test13.xml", error);
                   3144:        if (doc == NULL)
                   3145:                return axl_false;
                   3146: 
                   3147:        /* dump xml document */
                   3148:        axl_doc_dump (doc, &content, &size);
                   3149: 
                   3150:        doc2 = axl_doc_parse (content, size, error);
                   3151:        if (doc2 == NULL)
                   3152:                return axl_false;
                   3153: 
                   3154:        /* check if both documents are equals */
                   3155:        if (! axl_doc_are_equal (doc, doc2)) {
                   3156:                axl_error_new (-1, "Expected to dump an equivalent xml document, but found an error", NULL, error);
                   3157:                return axl_false;
                   3158:        }
                   3159: 
                   3160:        /* free dump */
                   3161:        axl_free (content);
                   3162:           
                   3163:        /* free axl document */
                   3164:        axl_doc_free (doc);
                   3165: 
                   3166:        /* free axl document */
                   3167:        axl_doc_free (doc2);
                   3168: 
                   3169:        doc = axl_doc_parse_from_file ("test_13c.xml", error);
                   3170:        if (doc == NULL)
                   3171:                return axl_false;
                   3172: 
                   3173:        if (! axl_doc_dump_pretty (doc, &content, &size, 4)) {
                   3174:                axl_error_new (-1, "Failed to dump pretty print, while expected a proper execution", NULL, error);
                   3175:                return axl_false;
                   3176:        }
                   3177: 
                   3178:        doc2 = axl_doc_parse (content, size, error);
                   3179:        if (doc2 == NULL)
                   3180:                return axl_false;
                   3181: 
                   3182:        /* free content */
                   3183:        axl_free (content);
                   3184: 
                   3185:        if (! axl_doc_are_equal (doc, doc2)) {
                   3186:                axl_error_new (-1, "Expected to find documents to be equal.", NULL, error);
                   3187:                return axl_false;
                   3188:        }
                   3189: 
                   3190:        /* free both document references */
                   3191:        axl_doc_free (doc);
                   3192:        axl_doc_free (doc2);
                   3193: 
                   3194:        /* check pretty printing function */
                   3195:        doc = axl_doc_parse_from_file ("test_13b.xml", error);
                   3196:        if (doc == NULL) 
                   3197:                return axl_false;
                   3198: 
                   3199:        if (! axl_doc_dump_pretty (doc, &content, &size, 4)) {
                   3200:                axl_error_new (-1, "Failed to dump pretty print, while expected a proper execution", NULL, error);
                   3201:                return axl_false;
                   3202:        }
                   3203: 
                   3204:        doc2 = axl_doc_parse (content, size, error);
                   3205:        if (doc2 == NULL)
                   3206:                return axl_false;
                   3207: 
                   3208:        if (! axl_doc_are_equal (doc, doc2)) {
                   3209:                axl_error_new (-1, "Expected to find documents to be equal.", NULL, error);
                   3210:                return axl_false;
                   3211:        }
                   3212: 
                   3213:        /* free content */
                   3214:        axl_free (content);
                   3215: 
                   3216:        /* free both document references */
                   3217:        axl_doc_free (doc);
                   3218:        axl_doc_free (doc2);
                   3219: 
                   3220:        /* reopen document to dump nodes */
                   3221:        doc = axl_doc_parse_from_file ("test_13c.xml", error);
                   3222:        if (doc == NULL)
                   3223:                return axl_false;
                   3224: 
                   3225:        /* get a reference to the first root child node: <test> */
                   3226:        node = axl_doc_get_root (doc);
                   3227:        node = axl_node_get_first_child (node);
                   3228:        if (! NODE_CMP_NAME (node, "test")) {
                   3229:                axl_error_new (-1, "Expected to find a child node called: <test>", NULL, error);
                   3230:                return axl_false;
                   3231:        } /* end if */
                   3232: 
                   3233:        /* dump the content */
                   3234:        if (! axl_node_dump (node, &content, &size)) {
                   3235:                axl_error_new (-1, "Expected to find a proper dump operation", NULL, error);
                   3236:                return axl_false;
                   3237:        } /* end if */
                   3238: 
                   3239:        /* parse the content dumped, to check it is really the result
                   3240:         * expected */
                   3241:        doc2 = axl_doc_parse (content, size, NULL);
                   3242:        if (doc2 == NULL) {
                   3243:                axl_error_new (-1, "Expected to parse properly dumped content from a node, but a failure was found", NULL, error);
                   3244:                return axl_false;
                   3245:        } /* end if */
                   3246: 
                   3247:        doc3 = axl_doc_parse_from_file ("test_13d.xml", NULL);
                   3248:        if (doc3 == NULL) {
                   3249:                axl_error_new (-1, "Expected to parse properly a reference file but an error was found", NULL, error);
                   3250:                return axl_false;
                   3251:        } /* end if */
                   3252: 
                   3253:        /* check result */
                   3254:        if (! axl_doc_are_equal (doc2, doc3)) {
                   3255:                axl_error_new (-1, "Expected to find equal document to reference, at node dump operations, but not found", NULL, error);
                   3256:                return axl_false;
                   3257:        } /* end if */
                   3258: 
                   3259:        /* free the content */
                   3260:        axl_free (content);
                   3261: 
                   3262:        /* free the document */
                   3263:        axl_doc_free (doc);
                   3264:        axl_doc_free (doc2);
                   3265:        axl_doc_free (doc3);
                   3266: 
                   3267:        /* load test_13e.xml document */
                   3268:        doc = axl_doc_parse_from_file ("test_13e.xml", NULL);
                   3269:        if (doc == NULL) {
                   3270:                axl_error_new (-1, "Expected to find parseable document, but an error was found..", NULL, error);
                   3271:                return axl_false;
                   3272:        }
                   3273: 
                   3274:        /* now dump the document */
                   3275:        if (!axl_doc_dump_pretty_to_file (doc, "test_13e.xml.test", 4)) {
                   3276:                axl_error_new (-1, "Expected to perform a proper dump operation but an error was found..", NULL, error);
                   3277:                return axl_false;
                   3278:        }
                   3279: 
                   3280:        /* now open the content produced and check both results */
                   3281:        doc2 = axl_doc_parse_from_file ("test_13e.xml.test", NULL);
                   3282:        if (doc2 == NULL) {
                   3283:                axl_error_new (-1, "Failed to open document that was expected to be opened", NULL, error);
                   3284:                return axl_false;
                   3285:        } /* end if */
                   3286:        
                   3287:        /* check both document */
                   3288:        if (! axl_doc_are_equal (doc, doc2)) {
                   3289:                axl_error_new (-1, "Expected to find equal documents before dump operation, but it wasn't found", NULL, error);
                   3290:                return axl_false;
                   3291:        }
                   3292: 
                   3293:        /* free both documents */
                   3294:        axl_doc_free (doc2);
                   3295:        axl_doc_free (doc);
                   3296: 
                   3297:        /* load test_13e.xml document */
                   3298:        doc = axl_doc_parse_from_file ("test_13f.xml", NULL);
                   3299:        if (doc == NULL) {
                   3300:                axl_error_new (-1, "Expected to find parseable document, but an error was found..", NULL, error);
                   3301:                return axl_false;
                   3302:        }
                   3303: 
                   3304:        /* dump to memory */
                   3305:        if (! axl_doc_dump_pretty (doc, &content, &size, 4)) {
                   3306:                axl_error_new (-1, "Expected to find proper dump operation not found", NULL, error);
                   3307:                return axl_false;
                   3308:        } /* end if */
                   3309: 
                   3310:        /* now check content dumped against the predefined value */
                   3311:        if (size != 1262 || ! axl_cmp (content, "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n\
                   3312: <common-unit-translate>\n\
                   3313:     <!-- Translations for the module and its attributes -->\n\
                   3314:     <translate module='issued_invoice' as='Facturas emitidas' norma='no'>\n\
                   3315:         <translate attr='All Columns' as='Todas las columnas' norma='no'>Value1</translate>\n\
                   3316:         <translate attr='invoice_number' as='Número' norma='no'>Value1</translate>\n\
                   3317:         <translate attr='date' as='Fecha' norma='no'>Value1</translate>\n\
                   3318:         <translate attr='amount' as='Importe' norma='no'>Value1</translate>\n\
                   3319:         <translate attr='year' as='Año' norma='no'>Value1</translate>\n\
                   3320:         <translate attr='tax' as='IVA' norma='no'>Value1</translate>\n\
                   3321:         <translate attr='amount_with_tax' as='Total' norma='no'>Value1</translate>\n\
                   3322:         <translate attr='cur_state' as='Estado' norma='no'>Value1</translate>\n\
                   3323:     </translate>\n\
                   3324:     <!-- Translations for enum declarations -->\n\
                   3325:     <translate enum='IssuedInvoiceState' as='Estado factura' norma='no'>\n\
                   3326:         <translate value='Valid' as='Valida' norma='no'>Value1</translate>\n\
                   3327:         <translate value='Cancelled' as='Anulada' norma='no'>Value1</translate>\n\
                   3328:         <translate value='NegativeInvoice' as='Negativa' norma='no'>Value1</translate>\n\
                   3329:     </translate>\n\
                   3330: </common-unit-translate>\n")) {
                   3331:                printf ("Content lenght found: %d and size=%d..\n", (int) strlen (content), size);
                   3332:                axl_error_new (-1, "Failed to check dump content, expected different values", NULL, error);
                   3333:                return axl_false;
                   3334:        } /* end if */
                   3335: 
                   3336:        axl_free (content);
                   3337: 
                   3338:        /* free document */
                   3339:        axl_doc_free (doc);
                   3340: 
                   3341:        
                   3342:        return axl_true;
                   3343: }
                   3344: 
                   3345: /** 
                   3346:  * @brief A more complex DTD parsing example
                   3347:  * 
                   3348:  * @param error The optional axlError to be used to report errors.
                   3349:  * 
                   3350:  * @return axl_true if the validity test is passed, axl_false if not.
                   3351:  */
                   3352: axl_bool test_12 (axlError ** error) 
                   3353: {
                   3354:        axlDoc * doc = NULL;
                   3355:        axlDtd * dtd = NULL;
                   3356: 
                   3357:        /* parse gmovil file (an af-arch xml chunk) */
                   3358:        doc = axl_doc_parse_from_file ("channel.xml", error); 
                   3359:        if (doc == NULL) 
                   3360:                return axl_false;
                   3361: 
                   3362:        /* parse af-arch DTD */
                   3363:        dtd = axl_dtd_parse_from_file ("channel.dtd", error);
                   3364:        if (dtd == NULL)
                   3365:                return axl_false;
                   3366: 
                   3367:        /* perform DTD validation */
                   3368:        if (! axl_dtd_validate (doc, dtd, error)) {
                   3369:                return axl_false;
                   3370:        }
                   3371: 
                   3372:        /* free doc reference */
                   3373:        axl_doc_free (doc); 
                   3374: 
                   3375:        /* parse gmovil file (an af-arch xml chunk) */
                   3376:        doc = axl_doc_parse_from_file ("channel2.xml", error); 
                   3377:        if (doc == NULL) 
                   3378:                return axl_false;
                   3379: 
                   3380:        /* perform DTD validation */
                   3381:        if (! axl_dtd_validate (doc, dtd, error)) {
                   3382:                return axl_false;
                   3383:        }
                   3384: 
                   3385:        /* free doc reference */
                   3386:        axl_doc_free (doc); 
                   3387: 
                   3388:        /* parse gmovil file (an af-arch xml chunk) */
                   3389:        doc = axl_doc_parse_from_file ("channel3.xml", error); 
                   3390:        if (doc == NULL) 
                   3391:                return axl_false;
                   3392: 
                   3393:        /* perform DTD validation */
                   3394:        if (! axl_dtd_validate (doc, dtd, error)) {
                   3395:                return axl_false;
                   3396:        }
                   3397: 
                   3398:        /* free doc reference */
                   3399:        axl_doc_free (doc); 
                   3400: 
                   3401:        /* parse gmovil file (an af-arch xml chunk) */
                   3402:        doc = axl_doc_parse_from_file ("channel4.xml", error); 
                   3403:        if (doc == NULL) 
                   3404:                return axl_false;
                   3405: 
                   3406:        /* perform DTD validation */
                   3407:        if (! axl_dtd_validate (doc, dtd, error)) {
                   3408:                return axl_false;
                   3409:        }
                   3410: 
                   3411:        /* free doc reference */
                   3412:        axl_doc_free (doc); 
                   3413:        
                   3414:        /* free dtd reference */
                   3415:        axl_dtd_free (dtd);
                   3416: 
                   3417:        /* parse a BEEP greetins example */
                   3418:        doc = axl_doc_parse_from_file ("channel5.xml", error);
                   3419:        if (doc == NULL)
                   3420:                return axl_false;
                   3421: 
                   3422:        /* parse the TLS dtd file */
                   3423:        dtd = axl_dtd_parse_from_file ("channel.dtd", error);
                   3424:        if (dtd == NULL)
                   3425:                return axl_false;
                   3426: 
                   3427:        /* perform DTD validation */
                   3428:        if (! axl_dtd_validate (doc, dtd, error)) {
                   3429:                return axl_false;
                   3430:        }
                   3431: 
                   3432:        /* free doc reference */
                   3433:        axl_doc_free (doc); 
                   3434:        
                   3435:        /* free dtd reference */
                   3436:        axl_dtd_free (dtd);
                   3437:        
                   3438: 
                   3439:        /* test end */
                   3440:        return axl_true;
                   3441: }
                   3442: 
                   3443: /** 
                   3444:  * @brief A more complex DTD parsing example
                   3445:  * 
                   3446:  * @param error The optional axlError to be used to report errors.
                   3447:  * 
                   3448:  * @return axl_true if the validity test is passed, axl_false if not.
                   3449:  */
                   3450: axl_bool test_11 (axlError ** error) 
                   3451: {
                   3452:        axlDoc * doc = NULL;
                   3453:        axlDtd * dtd = NULL;
                   3454: 
                   3455:        /* parse gmovil file (an af-arch xml chunk) */
                   3456:        doc = axl_doc_parse_from_file ("gmovil2.xml", error); 
                   3457:        if (doc == NULL) 
                   3458:                return axl_false;
                   3459: 
                   3460:        /* parse af-arch DTD */
                   3461:        dtd = axl_dtd_parse_from_file ("fact.dtd", error);
                   3462:        if (dtd == NULL)
                   3463:                return axl_false;
                   3464: 
                   3465:        /* perform DTD validation */
                   3466:        if (! axl_dtd_validate (doc, dtd, error)) {
                   3467:                return axl_false;
                   3468:        }
                   3469: 
                   3470:        /* free doc reference */
                   3471:        axl_doc_free (doc); 
                   3472:        
                   3473:        /* free dtd reference */
                   3474:        axl_dtd_free (dtd);
                   3475: 
                   3476:        /* test end */
                   3477:        return axl_true;
                   3478: }
                   3479: 
                   3480: /** 
                   3481:  * @brief A more complex DTD parsing example
                   3482:  * 
                   3483:  * @param error The optional axlError to be used to report errors.
                   3484:  * 
                   3485:  * @return axl_true if the validity test is passed, axl_false if not.
                   3486:  */
                   3487: axl_bool test_10 (axlError ** error) 
                   3488: {
                   3489:        axlDoc                * doc      = NULL;
                   3490:        axlDtd                * dtd      = NULL;
                   3491:        axlDtdElement         * element  = NULL;
                   3492:        axlDtdElementList     * itemList = NULL;
                   3493: 
                   3494:        /* parse gmovil file (an af-arch xml chunk) */
                   3495:        doc = axl_doc_parse_from_file ("test5.xml", error); 
                   3496:        if (doc == NULL) 
                   3497:                return axl_false;
                   3498: 
                   3499:        /* parse af-arch DTD */
                   3500:        dtd = axl_dtd_parse_from_file ("test5.dtd", error);
                   3501:        if (dtd == NULL)
                   3502:                return axl_false;
                   3503: 
                   3504:        /* get the dtd element representation */
                   3505:        element = axl_dtd_get_element (dtd, "choices");
                   3506: 
                   3507:        /* get the item list inside */
                   3508:        itemList = axl_dtd_get_item_list (element);
                   3509:        if (axl_dtd_item_list_count (itemList) != 4) {
                   3510:                axl_error_new (-1, "expected to receive an item list with 4 item nodes inside", NULL, error);
                   3511:                return axl_false;
                   3512:        }
                   3513: 
                   3514:        if (axl_dtd_item_list_type (itemList) != CHOICE) {
                   3515:                axl_error_new (-1, "expected to receive a choice item list", NULL, error);
                   3516:                return axl_false;
                   3517:        }
                   3518: 
                   3519:        if (axl_dtd_item_list_repeat (itemList) != ZERO_OR_MANY) {
                   3520:                axl_log ("test-01", AXL_LEVEL_DEBUG, "received a different repeat configuration: %d != %d",
                   3521:                         ZERO_OR_MANY, axl_dtd_item_list_repeat (itemList));
                   3522:                axl_error_new (-1, "expected to receive an item list with (*) zero or many spec", NULL, error);
                   3523:                return axl_false;
                   3524:        }
                   3525:        
                   3526: 
                   3527:        /* perform DTD validation */
                   3528:        if (! axl_dtd_validate (doc, dtd, error)) { 
                   3529:                return axl_false; 
                   3530:        } 
                   3531: 
                   3532:        /* free dtd reference */
                   3533:        axl_dtd_free (dtd);
                   3534: 
                   3535: 
                   3536:        /* parse af-arch DTD */
                   3537:        dtd = axl_dtd_parse_from_file ("test5.1.dtd", error);
                   3538:        if (dtd == NULL)
                   3539:                return axl_false;
                   3540:        
                   3541:        /* perform DTD validation */
                   3542:        if (axl_dtd_validate (doc, dtd, error)) { 
                   3543:                axl_error_new (-1, "A validation failure was expected.", NULL, error);
                   3544:                return axl_false; 
                   3545:        } 
                   3546: 
                   3547:        /* because a failure was expected, release memory allocated by
                   3548:         * axl_error_new */
                   3549:        axl_error_free (*error);
                   3550:        
                   3551:        /* free doc reference */
                   3552:        axl_doc_free (doc); 
                   3553:        
                   3554:        /* free dtd reference */
                   3555:        axl_dtd_free (dtd);
                   3556: 
                   3557:        /* test end */
                   3558:        return axl_true;
                   3559: }
                   3560: 
                   3561: /** 
                   3562:  * @brief A more complex DTD parsing example
                   3563:  * 
                   3564:  * @param error The optional axlError to be used to report errors.
                   3565:  * 
                   3566:  * @return axl_true if the validity test is passed, axl_false if not.
                   3567:  */
                   3568: axl_bool test_09 (axlError ** error) 
                   3569: {
                   3570:        axlDoc                * doc      = NULL;
                   3571:        axlDtd                * dtd      = NULL;
                   3572:        axlDtdElement         * element  = NULL;
                   3573:        axlDtdElementList     * itemList = NULL;
                   3574:        axlDtdElementListNode * itemNode = NULL;
                   3575:        
                   3576: 
                   3577:        /* parse gmovil file (an af-arch xml chunk) */
                   3578:        doc = axl_doc_parse_from_file ("test4.xml", error); 
                   3579:        if (doc == NULL) 
                   3580:                return axl_false;
                   3581: 
                   3582:        /* parse af-arch DTD */
                   3583:        dtd = axl_dtd_parse_from_file ("test4.dtd", error);
                   3584:        if (dtd == NULL)
                   3585:                return axl_false;
                   3586: 
                   3587:        
                   3588:        /* get dtd element */
                   3589:        element = axl_dtd_get_element (dtd, "nodes");
                   3590:        if (element == NULL) {
                   3591:                axl_error_new (-1, "unable to find expected DTD element", NULL, error);
                   3592:                return axl_false;
                   3593:        }
                   3594: 
                   3595:        /* get the item list */
                   3596:        itemList = axl_dtd_get_item_list (element);
                   3597:        if (axl_dtd_item_list_count (itemList) != 8) {
                   3598:                axl_log ("test-01", AXL_LEVEL_CRITICAL, "found item list size: %d != 8",
                   3599:                         axl_dtd_item_list_count (itemList));
                   3600:                axl_error_new (-1, "expected to find an item list definition with 8 elements", NULL, error);
                   3601:                return axl_false;
                   3602:        }
                   3603: 
                   3604:        /* check <first> node spec */
                   3605:        itemNode = axl_dtd_item_list_get_node (itemList, 0);
                   3606:        if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
                   3607:                axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
                   3608:                return axl_false;
                   3609:        }
                   3610:        
                   3611:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "first")) {
                   3612:                axl_error_new (-1, "expected to find an item node name (first) definition, not found", NULL, error);
                   3613:                return axl_false;
                   3614:        }
                   3615: 
                   3616:        if (axl_dtd_item_node_get_repeat (itemNode) != ONE_OR_MANY) {
                   3617:                axl_error_new (-1, "expected to find an item node definition with one or many repeat def (+), not found", NULL, error);
                   3618:                return axl_false;
                   3619:        }
                   3620: 
                   3621:        /* check <second> node spec */
                   3622:        itemNode = axl_dtd_item_list_get_node (itemList, 1);
                   3623:        if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
                   3624:                axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
                   3625:                return axl_false;
                   3626:        }
                   3627:        
                   3628:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "second")) {
                   3629:                axl_error_new (-1, "expected to find an item node name (second) definition, not found", NULL, error);
                   3630:                return axl_false;
                   3631:        }
                   3632: 
                   3633:        if (axl_dtd_item_node_get_repeat (itemNode) != ONE_AND_ONLY_ONE) {
                   3634:                axl_error_new (-1, "expected to find an item node definition with one and only one repeat def (), not found", NULL, error);
                   3635:                return axl_false;
                   3636:        }
                   3637: 
                   3638:        /* check <third> node spec */
                   3639:        itemNode = axl_dtd_item_list_get_node (itemList, 2);
                   3640:        if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
                   3641:                axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
                   3642:                return axl_false;
                   3643:        }
                   3644:        
                   3645:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "third")) {
                   3646:                axl_error_new (-1, "expected to find an item node name (third) definition, not found", NULL, error);
                   3647:                return axl_false;
                   3648:        }
                   3649: 
                   3650:        if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_ONE) {
                   3651:                axl_error_new (-1, "expected to find an item node definition with zero or one repeat def (?), not found", NULL, error);
                   3652:                return axl_false;
                   3653:        }
                   3654: 
                   3655:        /* check <fourth> node spec */
                   3656:        itemNode = axl_dtd_item_list_get_node (itemList, 3);
                   3657:        if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
                   3658:                axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
                   3659:                return axl_false;
                   3660:        }
                   3661:        
                   3662:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "fourth")) {
                   3663:                axl_error_new (-1, "expected to find an item node name (fourth) definition, not found", NULL, error);
                   3664:                return axl_false;
                   3665:        }
                   3666: 
                   3667:        if (axl_dtd_item_node_get_repeat (itemNode) != ONE_AND_ONLY_ONE) {
                   3668:                axl_error_new (-1, "expected to find an item node definition with one and only one repeat def (), not found", NULL, error);
                   3669:                return axl_false;
                   3670:        }
                   3671: 
                   3672:        /* check <fifth> node spec */
                   3673:        itemNode = axl_dtd_item_list_get_node (itemList, 4);
                   3674:        if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
                   3675:                axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
                   3676:                return axl_false;
                   3677:        }
                   3678:        
                   3679:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "fifth")) {
                   3680:                axl_error_new (-1, "expected to find an item node name (fifth) definition, not found", NULL, error);
                   3681:                return axl_false;
                   3682:        }
                   3683: 
                   3684:        if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_MANY) {
                   3685:                axl_error_new (-1, "expected to find an item node definition with zero to many repeat def (*), not found", NULL, error);
                   3686:                return axl_false;
                   3687:        }
                   3688: 
                   3689:        /* check <fourth> node spec */
                   3690:        itemNode = axl_dtd_item_list_get_node (itemList, 5);
                   3691:        if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_NODE) {
                   3692:                axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
                   3693:                return axl_false;
                   3694:        }
                   3695:        
                   3696:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "fourth")) {
                   3697:                axl_error_new (-1, "expected to find an item node name (fourth) definition, not found", NULL, error);
                   3698:                return axl_false;
                   3699:        }
                   3700: 
                   3701:        if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_MANY) {
                   3702:                axl_error_new (-1, "expected to find an item node definition with zero to many repeat def (*), not found", NULL, error);
                   3703:                return axl_false;
                   3704:        }
                   3705: 
                   3706:        /* check repetition pattern for node spec 6 */
                   3707:        itemNode = axl_dtd_item_list_get_node (itemList, 6);
                   3708:        if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_LIST) {
                   3709:                axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
                   3710:                return axl_false;
                   3711:        }
                   3712:        
                   3713:        if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_ONE) {
                   3714:                axl_log ("test-01", AXL_LEVEL_DEBUG, "repeat configuration was different: %d != %d",
                   3715:                         axl_dtd_item_node_get_repeat (itemNode), ZERO_OR_ONE);
                   3716:                axl_error_new (-1, "expected to find an item node definition with zero or one repeat def (?), not found", NULL, error);
                   3717:                return axl_false;
                   3718:        }
                   3719: 
                   3720:        /* check repetition pattern for node spec 7 */
                   3721:        itemNode = axl_dtd_item_list_get_node (itemList, 7);
                   3722:        if (axl_dtd_item_node_get_type (itemNode) != AXL_ELEMENT_LIST) {
                   3723:                axl_error_new (-1, "expected to find an item node definition, not found", NULL, error);
                   3724:                return axl_false;
                   3725:        }
                   3726:        
                   3727:        if (axl_dtd_item_node_get_repeat (itemNode) != ZERO_OR_MANY) {
                   3728:                axl_log ("test-01", AXL_LEVEL_DEBUG, "repeat configuration was different: %d != %d",
                   3729:                         axl_dtd_item_node_get_repeat (itemNode), ZERO_OR_MANY);
                   3730:                axl_error_new (-1, "expected to find an item node definition with zero or one repeat def (*), not found", NULL, error);
                   3731:                return axl_false;
                   3732:        }
                   3733: 
                   3734: 
                   3735:        /* perform DTD validation */
                   3736:        if (! axl_dtd_validate (doc, dtd, error)) { 
                   3737:                return axl_false; 
                   3738:        } 
                   3739: 
                   3740:        /* free doc reference */
                   3741:        axl_doc_free (doc); 
                   3742:        
                   3743:        /* free dtd reference */
                   3744:        axl_dtd_free (dtd);
                   3745: 
                   3746:        /* test end */
                   3747:        return axl_true;
                   3748: }
                   3749: 
                   3750: /** 
                   3751:  * @brief Perform a loading for a large file.
                   3752:  * 
                   3753:  * @param error The optional axlError to be used to report errors.
                   3754:  * 
                   3755:  * @return axl_true if the validity test is passed, axl_false if not.
                   3756:  */
                   3757: axl_bool test_08 (axlError ** error)
                   3758: {
                   3759:        /* top level definitions */
                   3760:        axlDoc            * doc = NULL;
                   3761: 
                   3762:        /* get current doc reference */
                   3763:        doc = axl_doc_parse_from_file ("large.xml", error);
                   3764:        if (doc == NULL)
                   3765:                return axl_false;
                   3766: 
                   3767:        /* release the document */
                   3768:        axl_doc_free (doc);
                   3769: 
                   3770:        return axl_true;
                   3771: }
                   3772: 
                   3773: 
                   3774: /** 
                   3775:  * @brief A bit more complex DTD parsing checkings
                   3776:  * 
                   3777:  * @param error The optional axlError to be used to report errors.
                   3778:  * 
                   3779:  * @return axl_true if the validity test is passed, axl_false if not.
                   3780:  */
                   3781: axl_bool test_07 (axlError ** error)
                   3782: {
                   3783:        /* top level definitions */
                   3784:        axlDoc            * doc = NULL;
                   3785:        axlDtd            * dtd = NULL;
                   3786: 
                   3787:        /* get current doc reference */
                   3788:        doc = axl_doc_parse_from_file ("test3.xml", error);
                   3789:        if (doc == NULL)
                   3790:                return axl_false;
                   3791: 
                   3792:        /* load DTD */
                   3793:        dtd = axl_dtd_parse_from_file ("test3.dtd", error);
                   3794:        if (dtd == NULL)
                   3795:                return axl_false;
                   3796: 
                   3797:        /* validate the xml document */
                   3798:        if (! axl_dtd_validate (doc, dtd, error)) {
                   3799:                return  axl_false;
                   3800:        }
                   3801:        
                   3802:        /* free document */
                   3803:        axl_doc_free (doc);
                   3804: 
                   3805:        /* free dtd document */
                   3806:        axl_dtd_free (dtd);
                   3807: 
                   3808:        return axl_true;
                   3809: }
                   3810: 
                   3811: /** 
                   3812:  * @brief A bit more complex DTD parsing checkings
                   3813:  * 
                   3814:  * @param error The optional axlError to be used to report errors.
                   3815:  * 
                   3816:  * @return axl_true if the validity test is passed, axl_false if not.
                   3817:  */
                   3818: axl_bool test_06 (axlError ** error)
                   3819: {
                   3820:        /* top level definitions */
                   3821:        axlDoc            * doc = NULL;
                   3822:        axlDtd            * dtd = NULL;
                   3823: 
                   3824:        /* dtd iteration variables */
                   3825:        axlDtdElement         * element;
                   3826:        axlDtdElementList     * itemList;
                   3827:        axlDtdElementListNode * itemNode;
                   3828:        
                   3829:        /* get current doc reference */
                   3830:        doc = axl_doc_parse_from_file ("test3.xml", error);
                   3831:        if (doc == NULL)
                   3832:                return axl_false;
                   3833: 
                   3834:        /* load DTD */
                   3835:        dtd = axl_dtd_parse_from_file ("test3.dtd", error);
                   3836:        if (dtd == NULL)
                   3837:                return axl_false;
                   3838: 
                   3839:        /* get the DTD element reference and check it */
                   3840:        element = axl_dtd_get_root (dtd);
                   3841:        if (element == NULL) {
                   3842:                axl_error_new (-1, "Expected to receive a root DTD node, not found", NULL, error);
                   3843:                return axl_false;
                   3844:        }
                   3845: 
                   3846:        /* check expected DTD root content */
                   3847:        if (! axl_cmp (axl_dtd_get_element_name (element), "complex")) {
                   3848:                axl_error_new (-1, "Expected to receive a root DTD node name, not found", NULL, error);
                   3849:                return axl_false;
                   3850:        }
                   3851: 
                   3852:        if (axl_dtd_get_element_type (element) != ELEMENT_TYPE_CHILDREN) {
                   3853:                axl_error_new (-1, "Expected to receive a root DTD node selection type (Children), not found", NULL, error);
                   3854:                return axl_false;
                   3855:        }
                   3856: 
                   3857:        /* get content specification */
                   3858:        itemList = axl_dtd_get_item_list (element);
                   3859:        if (axl_dtd_item_list_count (itemList) != 1) {
                   3860:                axl_log ("test-01", AXL_LEVEL_DEBUG, "item count %d != %d item spected",
                   3861:                         axl_dtd_item_list_count (itemList), 1);
                   3862:                axl_error_new (-1, "Expected to receive an item list specification with only one node, not found", NULL, error);
                   3863:                return axl_false;
                   3864:        }
                   3865: 
                   3866:        /* get times configuration */
                   3867:        if (axl_dtd_item_list_repeat (itemList) != ONE_AND_ONLY_ONE) {
                   3868:                axl_error_new (-1, "Expected to receive a repetition configuration (one and only one) but not found", NULL, error);
                   3869:                return axl_false;
                   3870:        }
                   3871: 
                   3872:        /* get the child node reference */
                   3873:        itemNode = axl_dtd_item_list_get_node (itemList, 0);
                   3874:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "data")) {
                   3875:                axl_log ("test-01", AXL_LEVEL_CRITICAL, "found item name: '%s' != data",
                   3876:                         axl_dtd_item_node_get_value (itemNode));
                   3877:                axl_error_new (-1, "Expected to receive an item node but, not found", NULL, error);
                   3878:                return axl_false;
                   3879:        }
                   3880: 
                   3881:        /* get the DTD element which represents the provided data */
                   3882:        element = axl_dtd_get_element (dtd, "data");
                   3883:        if ((element == NULL) || (!axl_cmp (axl_dtd_get_element_name (element), "data"))) {
                   3884:                axl_error_new (-1, "Expected to receive a DTD element definition but NULL was found or a different DTD name, not found", NULL, error);
                   3885:                return axl_false;
                   3886:        }
                   3887:        
                   3888:        /* get content specification */
                   3889:        itemList = axl_dtd_get_item_list (element);
                   3890:        if (axl_dtd_item_list_count (itemList) != 3) {
                   3891:                axl_log ("test-01", AXL_LEVEL_DEBUG, "item count %d != %d item spected",
                   3892:                         axl_dtd_item_list_count (itemList), 3);
                   3893:                axl_error_new (-1, "Expected to receive an item list specification with only one node, not found", NULL, error);
                   3894:                return axl_false;
                   3895:        }
                   3896: 
                   3897:        /* get item list especification */
                   3898:        if (axl_dtd_item_list_type (itemList) != SEQUENCE) {
                   3899:                axl_log ("test-01", AXL_LEVEL_DEBUG, "item count %d != %d item spected",
                   3900:                         axl_dtd_item_list_count (itemList), 3);
                   3901:                axl_error_new (-1, "Expected to receive an item list specification as a sequence type, not found", NULL, error);
                   3902:                return axl_false;
                   3903:        }
                   3904: 
                   3905:        /* check item nodes found inside the item list */
                   3906:        itemNode = axl_dtd_item_list_get_node (itemList, 0);
                   3907:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "row")) {
                   3908:                axl_error_new (-1, "Expected to receive an item node (row) but, not found", NULL, error);
                   3909:                return axl_false;
                   3910:        }
                   3911: 
                   3912:        /* get the child node reference */
                   3913:        itemNode = axl_dtd_item_list_get_node (itemList, 1);
                   3914:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "column")) {
                   3915:                axl_error_new (-1, "Expected to receive an item node (column) but, not found", NULL, error);
                   3916:                return axl_false;
                   3917:        }
                   3918: 
                   3919:        /* get current configuration for repetition value for the
                   3920:         * provided content particule */
                   3921:        if (axl_dtd_item_node_get_repeat (itemNode) != ONE_AND_ONLY_ONE) {
                   3922:                axl_error_new (-1, "Expected to receive an item node repeat configuration but, not found", NULL, error);
                   3923:                return axl_false;
                   3924:        }
                   3925:                
                   3926: 
                   3927:        /* get the child node reference */
                   3928:        itemNode = axl_dtd_item_list_get_node (itemList, 2);
                   3929:        if (! axl_cmp (axl_dtd_item_node_get_value (itemNode), "value")) {
                   3930:                axl_error_new (-1, "Expected to receive an item node (value) but, not found", NULL, error);
                   3931:                return axl_false;
                   3932:        }
                   3933: 
                   3934:        /* now work with the choice element */
                   3935:        element = axl_dtd_get_element (dtd, "column");
                   3936:        if ((element == NULL) || (!axl_cmp (axl_dtd_get_element_name (element), "column"))) {
                   3937:                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);
                   3938:                return axl_false;
                   3939:        }
                   3940:        
                   3941:        /* get content specification */
                   3942:        itemList = axl_dtd_get_item_list (element);
                   3943:        if (axl_dtd_item_list_count (itemList) != 4) {
                   3944:                axl_log ("test-01", AXL_LEVEL_DEBUG, "item count %d != %d item spected",
                   3945:                         axl_dtd_item_list_count (itemList), 4);
                   3946:                axl_error_new (-1, "Expected to receive an item list specification with only one node, not found", NULL, error);
                   3947:                return axl_false;
                   3948:        }
                   3949: 
                   3950:        /* get item list especification */
                   3951:        if (axl_dtd_item_list_type (itemList) != CHOICE) {
                   3952:                axl_error_new (-1, "Expected to receive an item list specification as a CHOICE type, not found", NULL, error);
                   3953:                return axl_false;
                   3954:        }
                   3955: 
                   3956:        /* get the DTD element which represents the provided data */
                   3957:        element = axl_dtd_get_element (dtd, "data");
                   3958:        if ((element == NULL) || (!axl_cmp (axl_dtd_get_element_name (element), "data"))) {
                   3959:                axl_error_new (-1, "Expected to receive a DTD element definition but NULL was found or a different DTD name, not found", NULL, error);
                   3960:                return axl_false;
                   3961:        }
                   3962: 
                   3963:        /* free document */
                   3964:        axl_doc_free (doc);
                   3965: 
                   3966:        /* free dtd document */
                   3967:        axl_dtd_free (dtd);
                   3968: 
                   3969:        return axl_true;
                   3970: }
                   3971: 
                   3972: /** 
                   3973:  * @brief DTD operations. Checks that DTD support works, reading
                   3974:  * simple DTD definitions, and ensuring elements are properly read.
                   3975:  * 
                   3976:  * @param error The axlError reference to be filled if the function
                   3977:  * returns axl_false.
                   3978:  * 
                   3979:  * @return axl_true if the validity test is passed, axl_false if not.
                   3980:  */
                   3981: axl_bool test_05 (axlError ** error)
                   3982: {
                   3983: 
                   3984:        axlDoc * doc;
                   3985:        axlNode * node;
                   3986:        axlDtd  * dtd;
                   3987: 
                   3988:        /* parse the document found */
                   3989:        doc = axl_doc_parse_from_file ("test.xml", error);
                   3990:        if (doc == NULL)
                   3991:                return axl_false;
                   3992: 
                   3993:        node = axl_doc_get (doc, "/complex/data/row/td");
                   3994:        if (node == NULL) {
                   3995:                axl_error_new (-1, "Expected to receive a node, not found", NULL, error);
                   3996:                axl_doc_free (doc);
                   3997:                return axl_false;
                   3998:        }
                   3999: 
                   4000:        if (! axl_cmp (axl_node_get_content (node, NULL), "10")) {
                   4001:                axl_error_new (-1, "Expected to receive a node content, not found", NULL, error);
                   4002:                axl_doc_free (doc);
                   4003:                return axl_false;
                   4004:        }
                   4005: 
                   4006:        /* free previous document */
                   4007:        axl_doc_free (doc);
                   4008: 
                   4009:        /* parse the document found */
                   4010:        doc = axl_doc_parse_from_file ("test2.xml", error);
                   4011:        if (doc == NULL)
                   4012:                return axl_false;
                   4013:        
                   4014:        
                   4015:        dtd = axl_dtd_parse_from_file ("test.dtd", error);
                   4016:        if (dtd == NULL)
                   4017:                return axl_false;
                   4018: 
                   4019:        /* now validate the document */
                   4020:        if (! axl_dtd_validate (doc, dtd, error)) {
                   4021:                return axl_false;
                   4022:        }
                   4023: 
                   4024:        /* release memory used by the parser */
                   4025:        axl_doc_free (doc);
                   4026:        
                   4027:        /* release memory used by the DTD element */
                   4028:        axl_dtd_free (dtd);
                   4029: 
                   4030:        return axl_true;
                   4031:        
                   4032: }
                   4033: 
                   4034: /** 
                   4035:  * @brief Perform some additional checks for a more extended xml
                   4036:  * documents, that includes attributes inside node definitions.
                   4037:  *
                   4038:  * @param error The axlError where failures will be reported 
                   4039:  *
                   4040:  * @return The \ref axl_true if test is passed, axl_false if not.
                   4041:  */
                   4042: axl_bool test_04 (axlError ** error)
                   4043: {
                   4044:        axlDoc  * doc;
                   4045:        axlNode * node;
                   4046: 
                   4047:        /* parse the document */
                   4048:        doc = axl_doc_parse_strings (error, 
                   4049:                                     "<?xml version='1.0' ?>",
                   4050:                                     "  <?test \"my content\" ?>",
                   4051:                                     "  <complex>",
                   4052:                                     "    <data>",
                   4053:                                     "       <row>",
                   4054:                                     "         <!-- A comment inside the middle of the document ",
                   4055:                                     " more comments ... ",
                   4056:                                     " more comments \n \r <td>..</td> -->",
                   4057:                                     "          <td>10</td>",
                   4058:                                     "          <test />",
                   4059:                                     " \n \n \r     <?test \"my content\" ?>     \n    \n",
                   4060:                                     "  <?test \"my content\" ?>",
                   4061:                                     "          <more>",
                   4062:                                     "              <test3 attr='2.0' />",
                   4063:                                     "          </more>",
                   4064:                                     "       </row>",
                   4065:                                     "       <test2 />",
                   4066:                                     "       <non-xml-document>",
                   4067:                                     "                             \n \r \n \t",
                   4068:                                     "         <![CDATA[<xml><<<<<<>>>>>><<<>>>><<<<<<>>>]]>"
                   4069:                                     "          \r \n \r \t",
                   4070:                                     "       </non-xml-document>",
                   4071:                                     "    </data>",
                   4072:                                     " <!--   <data>",
                   4073:                                     "       <row>",
                   4074:                                     "         A comment inside the middle of the document ",
                   4075:                                     " more comments ... ",
                   4076:                                     " more comments \n \r <td>..</td> ",
                   4077:                                     "          <td>10</td>",
                   4078:                                     "          <test />",
                   4079:                                     "          <more>",
                   4080:                                     "              <test2 attr='2.0' attr2='3.0' attr4='4.0'/>",
                   4081:                                     "          </more>",
                   4082:                                     "       </row>",
                   4083:                                     "       <test2 />",
                   4084:                                     "    </data> -->",
                   4085:                                     "  </complex>",
                   4086:                                     NULL);
                   4087:        /* check the result returned */
                   4088:        if (doc == NULL)
                   4089:                return axl_false;
                   4090: 
                   4091:        /* get the node <td> value */
                   4092:        node = axl_doc_get (doc, "/complex/data/row/td");
                   4093:        if (! axl_cmp (axl_node_get_content (node, NULL), "10")) {
                   4094:                axl_log ("test-04", AXL_LEVEL_DEBUG, "found a different content than the expected ('10' != '%s')",
                   4095:                         axl_node_get_content (node, NULL));
                   4096:                axl_error_new (-1, "Expected to receive a 10 value, but not found", NULL, error);
                   4097:                return axl_false;
                   4098:        }
                   4099: 
                   4100:        /* get a reference to the test2 node */
                   4101:        node = axl_doc_get (doc, "/complex/data/row/more/test3");
                   4102:        if (node == NULL) {
                   4103:                axl_error_new (-1, "Expected to find a test3 node at the given location", NULL, error);
                   4104:                return axl_false;
                   4105:        }
                   4106: 
                   4107:        /* check the attribute */
                   4108:        if (! axl_node_has_attribute (node, "attr")) {
                   4109:                axl_error_new (-1, "Expected to find an attribute called 'attr' inside test3 node at the given location", NULL, error);
                   4110:                return axl_false;
                   4111:        }
                   4112: 
                   4113:        /* check the attribute value */
                   4114:        if (! axl_cmp (axl_node_get_attribute_value (node, "attr"), "2.0")) {
                   4115:                axl_error_new (-1, "Expected to find an attribute value equal '2.0' inside test2 node at the given location", NULL, error);
                   4116:                return axl_false;
                   4117:        }
                   4118: 
                   4119:        /* add here Pi instruction checking */
                   4120:        if (! axl_doc_has_pi_target (doc, "test")) {
                   4121:                axl_error_new (-1, "failed to get expected PI target 'test'", NULL, error);
                   4122:                return axl_false;
                   4123:        }
                   4124: 
                   4125:        if (! axl_cmp (axl_doc_get_pi_target_content (doc, "test"), "\"my content\"")) {
                   4126:                axl_error_new (-1, "expected to receive a PI content not found", NULL, error);
                   4127:                return axl_false;
                   4128:        }
                   4129: 
                   4130:        node = axl_doc_get (doc, "/complex/data/row");
                   4131:        if (node == NULL) {
                   4132:                axl_error_new (-1, "unable to get expected node to check node PI support", NULL, error);
                   4133:                return axl_false;
                   4134:        }
                   4135: 
                   4136:        if (! axl_node_has_pi_target (node, "test")) {
                   4137:                axl_error_new (-1, "failed to get expected PI target 'test' for the node", NULL, error);
                   4138:                return axl_false;
                   4139:        }
                   4140: 
                   4141:        
                   4142:        node = axl_doc_get (doc, "/complex/data/non-xml-document");
                   4143:        if (node == NULL) {
                   4144:                axl_error_new (-1, "Expected to receive the CDATA node, not found", NULL, error);
                   4145:                return axl_false;
                   4146:        }
                   4147: 
                   4148:        if (! axl_cmp (axl_node_get_content (node, NULL), "<xml><<<<<<>>>>>><<<>>>><<<<<<>>>")) {
                   4149:                printf ("Content doesn't match: %s != %s\n", 
                   4150:                        axl_node_get_content (node, NULL), "<xml><<<<<<>>>>>><<<>>>><<<<<<>>>");
                   4151:                axl_error_new (-1, "Expected to recevie CDATA content, not found or not match", NULL, error);
                   4152:                return axl_false;
                   4153:        }
                   4154: 
                   4155:                                     
                   4156:        /* free the memory */
                   4157:        axl_doc_free (doc);
                   4158:        
                   4159:        return axl_true;
                   4160: }
                   4161: 
                   4162: /** 
                   4163:  * @brief Checks a more extended and complex xml documents
                   4164:  * 
                   4165:  * @param error The axlError where failures will be reported.
                   4166:  * 
                   4167:  * @return \ref axl_true if test is passed, axl_false if not.
                   4168:  */
                   4169: axl_bool test_03 (axlError ** error)
                   4170: {
                   4171: 
                   4172:        axlDoc  * doc;
                   4173:        axlNode * node;
                   4174: 
                   4175:        /* parse the xml document provided */
                   4176:        doc = axl_doc_parse ("<?xml version='1.0' ?>\n\
                   4177: <complex>\n\
                   4178:   <data>\n\
                   4179:     <row>10</row><row>20</row><row>30</row><row>40</row>\n\
                   4180:   </data>\n\
                   4181:   <data2>\n\
                   4182:     <td> 23  </td>\n\
                   4183:   </data2>\n\
                   4184: </complex>", -1, error);
                   4185:        if (doc == NULL)
                   4186:                return axl_false;
                   4187: 
                   4188:        /* get the root node */
                   4189:        node = axl_doc_get_root (doc);
                   4190:        if (! NODE_CMP_NAME (node, "complex")) {
                   4191:                axl_error_new (-2, "Root node returned from the document is not the one excepted", NULL, error);
                   4192:                axl_doc_free (doc);
                   4193:                return axl_false;
                   4194:        }
                   4195: 
                   4196:        /* test get node function */
                   4197:        node = axl_doc_get (doc, "/complex/data2/td");
                   4198:        if (node == NULL) {
                   4199:                axl_error_new (-2, "Unable to find a node due to a path selection", NULL, error);
                   4200:                axl_doc_free (doc);
                   4201:                return axl_false;
                   4202:        }
                   4203: 
                   4204:        /* check the node returned */
                   4205:        if (! NODE_CMP_NAME (node, "td")) {
                   4206:                axl_error_new (-2, "The node for the node looked up doesn't match ", NULL, error);
                   4207:                axl_doc_free (doc);
                   4208:                return axl_false;
                   4209:        }
                   4210: 
                   4211:        /* check for returning bad nodes */
                   4212:        node = axl_doc_get (doc, "/complex/data3/td");
                   4213:        if (node != NULL) {
                   4214:                axl_error_new (-2, "Returned a node that should be NULL", NULL, error);
                   4215:                axl_doc_free (doc);
                   4216:                return axl_false;
                   4217:        }
                   4218: 
                   4219:        node = axl_doc_get (doc, "/complex/data2/td");
                   4220:        if (!axl_cmp (axl_node_get_content (node, NULL), " 23  ")) {
                   4221:                axl_log ("test-03", AXL_LEVEL_DEBUG, "expected to receive a node content: ' 23  ' but received '%s'",
                   4222:                         axl_node_get_content (node, NULL));
                   4223:                axl_error_new (-2, "Node content have failed, expected a different value", NULL, error);
                   4224:                return axl_false;
                   4225:        }
                   4226: 
                   4227:        node = axl_doc_get (doc, "complex/data3/td");
                   4228:        if (node != NULL) {
                   4229:                axl_error_new (-2, "Parsed a path that is invalid", NULL, error);
                   4230:                return axl_false;
                   4231:        }
                   4232:        
                   4233:        /* release memory allocated by the document */
                   4234:        axl_doc_free (doc);
                   4235: 
                   4236:        return axl_true;
                   4237: }
                   4238: 
                   4239: axl_bool test_02_always_fail (axlStream * stream, const char ** detected, axlPointer user_data, axlError ** error)
                   4240: {
                   4241:        /* always return axl_false to check how behave the library */
                   4242:        return axl_false;
                   4243: }
                   4244: 
                   4245: 
                   4246: /** 
                   4247:  * @brief Checks xml document error for basic parsing.
                   4248:  * 
                   4249:  * @param error The axlError where failures are returned.
                   4250:  * 
                   4251:  * @return axl_true if test are properly run. axl_false if not.
                   4252:  */
                   4253: axl_bool test_02 (axlError ** error) 
                   4254: {
                   4255:        axlDoc * doc;
                   4256:        
                   4257:        doc = axl_doc_parse ("<? xml >", 8, error);
                   4258:        if (doc != NULL) {
                   4259:                axl_error_new (-1, "Failed to detect wrong xml header", NULL, error);
                   4260:                return axl_false;
                   4261:        }
                   4262:        axl_error_free (* error);
                   4263:        (*error) = NULL;
                   4264: 
                   4265:        doc = axl_doc_parse ("<?xml >", 7, error);
                   4266:        if (doc != NULL) {
                   4267:                
                   4268:                axl_error_new (-1, "Failed to detect wrong xml trailing header", NULL, error);
                   4269:                return axl_false;
                   4270:        }
                   4271:        axl_error_free (* error);
                   4272:        (*error) = NULL;
                   4273: 
                   4274:        /* configure an encoding function that fails to detect */
                   4275:        axl_doc_set_detect_codification_func (test_02_always_fail, NULL);
                   4276: 
                   4277:        doc = axl_doc_parse ("<this />", 8, error);
                   4278:        if (doc != NULL) {
                   4279:                axl_error_new (-1, "Failed to detect wrong xml trailing header", NULL, error);
                   4280:                return axl_false;
                   4281:        }
                   4282:        axl_error_free (* error);
                   4283:        (*error) = NULL;
                   4284:        /* uninstall detect codification */
                   4285:        axl_doc_set_detect_codification_func (NULL, NULL);
                   4286: 
                   4287:        
                   4288:        /* wrong closed document comment */
                   4289:        doc = axl_doc_parse ("<document><this><!-- this not closed --</document>", 50, error);
                   4290:        if (doc != NULL) {
                   4291:                axl_error_new (-1, "Failed to detect wrong balanced xml document", NULL, error);
                   4292:                return axl_false;
                   4293:        }
                   4294:        axl_error_free (* error);
                   4295:        (*error) = NULL;
                   4296: 
                   4297:        /* opening an unbalanced document */
                   4298:        doc = axl_doc_parse ("<document><this><!-- this not closed --></document>", 51, error);
                   4299:        if (doc != NULL) {
                   4300:                axl_error_new (-1, "Failed to detect wrong balanced xml document", NULL, error);
                   4301:                return axl_false;
                   4302:        }
                   4303:        axl_error_free (* error);
                   4304:        (*error) = NULL;
                   4305: 
                   4306:        /* opening an unbalanced document with all nodes called the same */
                   4307:        printf ("Test 02: unbalanced document called with same nodes..\n");
                   4308:        doc = axl_doc_parse ("<document><document><!-- this not closed --></document>", 55, error);
                   4309:        if (doc != NULL) {
                   4310:                axl_error_new (-1, "Failed to detect wrong balanced xml document", NULL, error);
                   4311:                return axl_false;
                   4312:        }
                   4313:        axl_error_free (* error);
                   4314:        (*error) = NULL;
                   4315: 
                   4316:        return axl_true;
                   4317: }
                   4318: 
                   4319: 
                   4320: /** 
                   4321:  * @brief Parse an initial document, with an xml header with
                   4322:  * version=1.0 and no more header.
                   4323:  * 
                   4324:  * 
                   4325:  * @return axl_false if the function fails to parse the
                   4326:  * document. axl_true if the test was properly executed.
                   4327:  */
                   4328: axl_bool test_01 (axlError ** error) 
                   4329: {
                   4330:        /* axl document representation */
                   4331:        axlDoc   * doc;
                   4332:        
                   4333: 
                   4334:        /* parse the given string */
                   4335:        doc = axl_doc_parse ("<?xml version='1.0' ?><axldoc />", 32, error);
                   4336:        if (doc == NULL) {
                   4337:                return axl_false;
                   4338:        }
                   4339:        axl_doc_free (doc);
                   4340: 
                   4341:        doc = axl_doc_parse ("<?xml      version='1.0'            ?>      <another />", 55, error);
                   4342:        if (doc == NULL) {
                   4343:                return axl_false;
                   4344:        }
                   4345:        
                   4346:        /* release document parsed */
                   4347:        axl_doc_free (doc);
                   4348: 
                   4349:        doc = axl_doc_parse ("<?xml    \n   \t \n \r version='1.0' ?>    <doc />", 50, error);
                   4350:        if (doc == NULL) {
                   4351:                return axl_false;
                   4352:        }
                   4353: 
                   4354:        /* release document parsed */
                   4355:        axl_doc_free (doc);
                   4356: 
                   4357:        doc = axl_doc_parse ("<?xml  version=\"1.0\"        ?>   \r \t \n<another />", 54, error);
                   4358:        if (doc == NULL) {
                   4359:                return axl_false;
                   4360:        }
                   4361: 
                   4362:        /* release document parsed */
                   4363:        axl_doc_free (doc);
                   4364: 
                   4365:        doc = axl_doc_parse ("<?xml  version=\"1.0\" \t \n \r encoding='utf-8\"   ?> <data />", 63, error);
                   4366:        if (doc == NULL) {
                   4367:                return axl_false;
                   4368:        }
                   4369: 
                   4370:        if (strcmp ("utf-8", axl_doc_get_encoding (doc))) {
                   4371:                printf ("ERROR: encoding read from the document differs from the expected (got %s, expected %s)!\n",
                   4372:                        axl_doc_get_encoding (doc), "utf-8");
                   4373:                axl_error_new (-1, "ERROR: encoding read from the document differs from the expected!", NULL, error);
                   4374:                return axl_false;
                   4375:        }
                   4376: 
                   4377:        /* release document parsed */
                   4378:        axl_doc_free (doc);
                   4379: 
                   4380:        doc = axl_doc_parse ("<?xml version='1.0' encoding='utf-8' standalone='yes' ?>  <data/>", 65, error);
                   4381:        if (doc == NULL) {
                   4382:                return axl_false;
                   4383:        }
                   4384: 
                   4385:        if (!axl_doc_get_standalone (doc)) {
                   4386:                printf ("ERROR: Expected to receive a true standalone configuration but axl_false was found\n");
                   4387:                return axl_false;
                   4388:        }
                   4389: 
                   4390:        /* release document parsed */
                   4391:        axl_doc_free (doc);
                   4392:        
                   4393: 
                   4394:        return axl_true;
                   4395: }
                   4396: 
                   4397: /** 
                   4398:  * @brief Axl stream boundary checks.
                   4399:  * 
                   4400:  * 
                   4401:  * @return axl_false if the function fails to parse the
                   4402:  * document. axl_true if the test was properly executed.
                   4403:  */
                   4404: axl_bool test_01a (axlError ** error) 
                   4405: {
                   4406:        axlStream * stream;
                   4407:        char      * value;
                   4408:        int         chunk_matched = -2;
                   4409: 
                   4410:        /* parse the string */
                   4411:        stream = axl_stream_new ("customer", -1, NULL, -1, error);
                   4412:        if (stream == NULL) 
                   4413:                return axl_false;
                   4414: 
                   4415:        /* get the value */
                   4416:        value = axl_stream_get_until (stream, NULL, &chunk_matched, axl_true, 2, "[", ".");
                   4417:        if (value != NULL) {
                   4418:                /* free the stream */
                   4419:                axl_stream_free (stream);
                   4420: 
                   4421:                /* fill an error */
                   4422:                axl_error_new (-1, "expected to find a null value while parsing content", NULL, error);
                   4423:                
                   4424:                return axl_false;
                   4425:        }
                   4426: 
                   4427:        if (chunk_matched != -1) {
                   4428:                /* free the stream */
                   4429:                axl_stream_free (stream);
                   4430: 
                   4431:                /* fill an error */
                   4432:                axl_error_new (-1, "expected to chunk matched value equal to -1", NULL, error);
                   4433:                
                   4434:                return axl_false;
                   4435:        }
                   4436: 
                   4437:        /* parse the stream using zero support */
                   4438: 
                   4439:        /* get the value */
                   4440:        value = axl_stream_get_until_zero (stream, NULL, &chunk_matched, axl_true, 2, "[", ".");
                   4441:        if (value == NULL) {
                   4442:                /* free the stream */
                   4443:                axl_stream_free (stream);
                   4444: 
                   4445:                /* fill an error */
                   4446:                axl_error_new (-1, "expected to find a defined value while parsing content", NULL, error);
                   4447:                
                   4448:                return axl_false;
                   4449:        }
                   4450: 
                   4451:        if (chunk_matched != -2) {
                   4452:                /* free the stream */
                   4453:                axl_stream_free (stream);
                   4454: 
                   4455:                /* fill an error */
                   4456:                axl_error_new (-1, "expected to chunk matched value equal to -2", NULL, error);
                   4457:                
                   4458:                return axl_false;
                   4459:        }
                   4460: 
                   4461:        /* zero string found (in the current stream) */
                   4462:        if (! axl_cmp (value, "customer")) {
                   4463:                printf ("Found values: '%s' != 'customer'\n", value);
                   4464:                
                   4465:                /* fill an error */
                   4466:                axl_error_new (-1, "expected to find a string not found", NULL, error);
                   4467: 
                   4468:                return axl_false;
                   4469:        }
                   4470: 
                   4471:        /* free the stream */
                   4472:        axl_stream_free (stream);
                   4473: 
                   4474:        /* parse the string */
                   4475:        stream = axl_stream_new ("customer", -1, NULL, -1, error);
                   4476:        if (stream == NULL) 
                   4477:                return axl_false;
                   4478: 
                   4479:        axl_stream_push (stream, "provider ", 9);
                   4480:        if (! (axl_stream_peek (stream, "provider", 8) > 0)) {
                   4481:                axl_error_new (-1, "failed to check expected input at the stream after push operation", NULL, error);
                   4482:                return axl_false;
                   4483:        } /* end if */
                   4484: 
                   4485:        if (axl_stream_get_size (stream) != 17) {
                   4486:                axl_error_new (-1, "Found unexpected stream buffer size, while expecting 17", NULL, error);
                   4487:                return axl_false;
                   4488:        } /* end if */
                   4489: 
                   4490:        axl_stream_inspect (stream, "pro", 3);
                   4491: 
                   4492:        if (! (axl_stream_inspect (stream, "vider ", 6) > 0)) {
                   4493:                axl_error_new (-1, "Expected to find an string value.. ('vider ') not found", NULL, error);
                   4494:                return axl_false;
                   4495:        } /* end if */
                   4496: 
                   4497:        axl_stream_free (stream);
                   4498: 
                   4499:        return axl_true;
                   4500: }
                   4501: 
                   4502: 
                   4503: 
                   4504: 
                   4505: axl_bool test_01b_show_node_found (axlNode * node,
                   4506:                               axlNode * parent,
                   4507:                               axlDoc  * doc,
                   4508:                               axl_bool    * was_removed,
                   4509:                               axlPointer ptr, 
                   4510:                               axlPointer ptr2)
                   4511: {
                   4512:        int * iterator = ptr;
                   4513: 
                   4514:        /* show node found  */
                   4515:        switch (*iterator) {
                   4516:        case 0:
                   4517:                /* <document> case */
                   4518:                if (! NODE_CMP_NAME (node, "document")) {
                   4519: 
                   4520:                        /* fill the error */
                   4521:                        axl_error_new (-1, "Expected to find a document node not found <document>", NULL, (axlError **) ptr2);
                   4522: 
                   4523:                        /* stop iterating */
                   4524:                        return axl_false;
                   4525:                }
                   4526: 
                   4527:                break;
                   4528:        case 1:
                   4529:                /* <child1> case */
                   4530:                if (! NODE_CMP_NAME (node, "child1")) {
                   4531:                        /* fill the error */
                   4532:                        axl_error_new (-1, "Expected to find a document node not found <child1>", NULL, (axlError **) ptr2);
                   4533: 
                   4534:                        /* stop iterating */
                   4535:                        return axl_false;
                   4536:                }
                   4537: 
                   4538:                if (! NODE_CMP_NAME (parent, "document")) {
                   4539:                        /* fill the error */
                   4540:                        axl_error_new (-1, "Expected to find parent node <document> for child1", NULL, (axlError **) ptr2);
                   4541: 
                   4542:                        /* stop iterating */
                   4543:                        return axl_false;
                   4544:                }
                   4545: 
                   4546:                break;
                   4547:        case 2:
                   4548:                /* <child2> case */
                   4549:                if (! NODE_CMP_NAME (node, "child2")) {
                   4550:                        /* fill the error */
                   4551:                        axl_error_new (-1, "Expected to find a document node not found <child2>", NULL, (axlError **) ptr2);
                   4552: 
                   4553:                        /* stop iterating */
                   4554:                        return axl_false;
                   4555:                }
                   4556: 
                   4557:                if (! NODE_CMP_NAME (parent, "document")) {
                   4558:                        /* fill the error */
                   4559:                        axl_error_new (-1, "Expected to find parent node <document> for child2", NULL, (axlError **) ptr2);
                   4560: 
                   4561:                        /* stop iterating */
                   4562:                        return axl_false;
                   4563:                }
                   4564: 
                   4565:                break;
                   4566:        case 3:
                   4567:                /* <child3> case */
                   4568:                if (! NODE_CMP_NAME (node, "child3")) {
                   4569:                        /* fill the error */
                   4570:                        axl_error_new (-1, "Expected to find a document node not found <child3>", NULL, (axlError **) ptr2);
                   4571: 
                   4572:                        /* stop iterating */
                   4573:                        return axl_false;
                   4574:                }
                   4575: 
                   4576:                if (! NODE_CMP_NAME (parent, "document")) {
                   4577:                        /* fill the error */
                   4578:                        axl_error_new (-1, "Expected to find parent node <document> for child3", NULL, (axlError **) ptr2);
                   4579: 
                   4580:                        /* stop iterating */
                   4581:                        return axl_false;
                   4582:                }
                   4583: 
                   4584:                break;
                   4585:        case 4:
                   4586:                /* <a> case */
                   4587:                if (! NODE_CMP_NAME (node, "a")) {
                   4588:                        /* fill the error */
                   4589:                        axl_error_new (-1, "Expected to find a document node not found <a>", NULL, (axlError **) ptr2);
                   4590: 
                   4591:                        /* stop iterating */
                   4592:                        return axl_false;
                   4593:                }
                   4594: 
                   4595:                if (! NODE_CMP_NAME (parent, "child3")) {
                   4596:                        /* fill the error */
                   4597:                        axl_error_new (-1, "Expected to find parent node <child3> for a", NULL, (axlError **) ptr2);
                   4598: 
                   4599:                        /* stop iterating */
                   4600:                        return axl_false;
                   4601:                }
                   4602: 
                   4603:                break;
                   4604:        case 5:
                   4605:                /* <b> case */
                   4606:                if (! NODE_CMP_NAME (node, "b")) {
                   4607:                        /* fill the error */
                   4608:                        axl_error_new (-1, "Expected to find a document node not found <b>", NULL, (axlError **) ptr2);
                   4609: 
                   4610:                        /* stop iterating */
                   4611:                        return axl_false;
                   4612:                }
                   4613: 
                   4614:                if (! NODE_CMP_NAME (parent, "child3")) {
                   4615:                        /* fill the error */
                   4616:                        axl_error_new (-1, "Expected to find parent node <child3> for b", NULL, (axlError **) ptr2);
                   4617: 
                   4618:                        /* stop iterating */
                   4619:                        return axl_false;
                   4620:                }
                   4621: 
                   4622:                break;
                   4623:        case 6:
                   4624:                /* <c> case */
                   4625:                if (! NODE_CMP_NAME (node, "c")) {
                   4626:                        /* fill the error */
                   4627:                        axl_error_new (-1, "Expected to find a document node not found <c>", NULL, (axlError **) ptr2);
                   4628: 
                   4629:                        /* stop iterating */
                   4630:                        return axl_false;
                   4631:                }
                   4632: 
                   4633:                if (! NODE_CMP_NAME (parent, "child3")) {
                   4634:                        /* fill the error */
                   4635:                        axl_error_new (-1, "Expected to find parent node <child3> for c", NULL, (axlError **) ptr2);
                   4636: 
                   4637:                        /* stop iterating */
                   4638:                        return axl_false;
                   4639:                }
                   4640: 
                   4641:                break;
                   4642:        case 7:
                   4643:                /* <d> case */
                   4644:                if (! NODE_CMP_NAME (node, "d")) {
                   4645:                        /* fill the error */
                   4646:                        axl_error_new (-1, "Expected to find a document node not found <d>", NULL, (axlError **) ptr2);
                   4647: 
                   4648:                        /* stop iterating */
                   4649:                        return axl_false;
                   4650:                }
                   4651: 
                   4652:                if (! NODE_CMP_NAME (parent, "c")) {
                   4653:                        /* fill the error */
                   4654:                        axl_error_new (-1, "Expected to find parent node <c> for d", NULL, (axlError **) ptr2);
                   4655: 
                   4656:                        /* stop iterating */
                   4657:                        return axl_false;
                   4658:                }
                   4659: 
                   4660:                break;
                   4661:        case 8:
                   4662:                /* <e> case */
                   4663:                if (! NODE_CMP_NAME (node, "e")) {
                   4664:                        /* fill the error */
                   4665:                        axl_error_new (-1, "Expected to find a document node not found <e>", NULL, (axlError **) ptr2);
                   4666: 
                   4667:                        /* stop iterating */
                   4668:                        return axl_false;
                   4669:                }
                   4670: 
                   4671:                if (! NODE_CMP_NAME (parent, "c")) {
                   4672:                        /* fill the error */
                   4673:                        axl_error_new (-1, "Expected to find parent node <c> for e", NULL, (axlError **) ptr2);
                   4674: 
                   4675:                        /* stop iterating */
                   4676:                        return axl_false;
                   4677:                }
                   4678: 
                   4679:                break;
                   4680:        case 9:
                   4681:                /* <e> case */
                   4682:                if (! NODE_CMP_NAME (node, "f")) {
                   4683:                        /* fill the error */
                   4684:                        axl_error_new (-1, "Expected to find a document node not found <f>", NULL, (axlError **) ptr2);
                   4685: 
                   4686:                        /* stop iterating */
                   4687:                        return axl_false;
                   4688:                }
                   4689: 
                   4690:                if (! NODE_CMP_NAME (parent, "child3")) {
                   4691:                        /* fill the error */
                   4692:                        axl_error_new (-1, "Expected to find parent node <child3> for f", NULL, (axlError **) ptr2);
                   4693: 
                   4694:                        /* stop iterating */
                   4695:                        return axl_false;
                   4696:                }
                   4697: 
                   4698:                break;
                   4699:        case 10:
                   4700:                /* <g> case */
                   4701:                if (! NODE_CMP_NAME (node, "g")) {
                   4702:                        /* fill the error */
                   4703:                        axl_error_new (-1, "Expected to find a document node not found <g>", NULL, (axlError **) ptr2);
                   4704: 
                   4705:                        /* stop iterating */
                   4706:                        return axl_false;
                   4707:                }
                   4708: 
                   4709:                if (! NODE_CMP_NAME (parent, "child3")) {
                   4710:                        /* fill the error */
                   4711:                        axl_error_new (-1, "Expected to find parent node <chile3> for g", NULL, (axlError **) ptr2);
                   4712: 
                   4713:                        /* stop iterating */
                   4714:                        return axl_false;
                   4715:                }
                   4716: 
                   4717:                break;
                   4718:        case 11:
                   4719:                /* <child4> case */
                   4720:                if (! NODE_CMP_NAME (node, "child4")) {
                   4721:                        /* fill the error */
                   4722:                        axl_error_new (-1, "Expected to find a document node not found <child4>", NULL, (axlError **) ptr2);
                   4723: 
                   4724:                        /* stop iterating */
                   4725:                        return axl_false;
                   4726:                }
                   4727: 
                   4728:                if (! NODE_CMP_NAME (parent, "document")) {
                   4729:                        /* fill the error */
                   4730:                        axl_error_new (-1, "Expected to find parent node <document> for child4", NULL, (axlError **) ptr2);
                   4731: 
                   4732:                        /* stop iterating */
                   4733:                        return axl_false;
                   4734:                }
                   4735:                break;
                   4736:        case 12:
                   4737:                /* <child5> case */
                   4738:                if (! NODE_CMP_NAME (node, "child5")) {
                   4739:                        /* fill the error */
                   4740:                        axl_error_new (-1, "Expected to find a document node not found <child5>", NULL, (axlError **) ptr2);
                   4741: 
                   4742:                        /* stop iterating */
                   4743:                        return axl_false;
                   4744:                }
                   4745: 
                   4746:                if (! NODE_CMP_NAME (parent, "document")) {
                   4747:                        /* fill the error */
                   4748:                        axl_error_new (-1, "Expected to find parent node <document> for child4", NULL, (axlError **) ptr2);
                   4749: 
                   4750:                        /* stop iterating */
                   4751:                        return axl_false;
                   4752:                }
                   4753: 
                   4754:                break;
                   4755:        }
                   4756: 
                   4757:        /* update count */
                   4758:        (*iterator)++;
                   4759: 
                   4760:        /* keep iterating */
                   4761:        return axl_true;
                   4762: }
                   4763: 
                   4764: 
                   4765: axl_bool test_01b_show_node_found2 (axlNode * node, 
                   4766:                                axlNode * parent,
                   4767:                                axlDoc  * doc,  
                   4768:                                axl_bool    * was_removed,
                   4769:                                axlPointer ptr, axlPointer ptr2)
                   4770: {
                   4771:        int * iterator = ptr;
                   4772: 
                   4773:        /* show node found  */
                   4774:        switch (*iterator) {
                   4775:        case 0:
                   4776:                /* <document> case */
                   4777:                if (! NODE_CMP_NAME (node, "document")) {
                   4778:                        /* fill the error */
                   4779:                        axl_error_new (-1, "Expected to find a document node not found <document>", NULL, (axlError **) ptr2);
                   4780: 
                   4781:                        /* stop iterating */
                   4782:                        return axl_false;
                   4783:                }
                   4784:                break;
                   4785:        case 1:
                   4786:                /* <child1> case */
                   4787:                if (! NODE_CMP_NAME (node, "child1")) {
                   4788:                        /* fill the error */
                   4789:                        axl_error_new (-1, "Expected to find a document node not found <child1>", NULL, (axlError **) ptr2);
                   4790: 
                   4791:                        /* stop iterating */
                   4792:                        return axl_false;
                   4793:                }
                   4794:                break;
                   4795:        case 2:
                   4796:                /* <child2> case */
                   4797:                if (! NODE_CMP_NAME (node, "child2")) {
                   4798:                        /* fill the error */
                   4799:                        axl_error_new (-1, "Expected to find a document node not found <child2>", NULL, (axlError **) ptr2);
                   4800: 
                   4801:                        /* stop iterating */
                   4802:                        return axl_false;
                   4803:                }
                   4804:                break;
                   4805:        case 3:
                   4806:                /* <child3> case */
                   4807:                if (! NODE_CMP_NAME (node, "child3")) {
                   4808:                        /* fill the error */
                   4809:                        axl_error_new (-1, "Expected to find a document node not found <child3>", NULL, (axlError **) ptr2);
                   4810: 
                   4811:                        /* stop iterating */
                   4812:                        return axl_false;
                   4813:                }
                   4814:                break;
                   4815:        case 4:
                   4816:                /* <child4> case */
                   4817:                if (! NODE_CMP_NAME (node, "child4")) {
                   4818:                        /* fill the error */
                   4819:                        axl_error_new (-1, "Expected to find a document node not found <child4>", NULL, (axlError **) ptr2);
                   4820: 
                   4821:                        /* stop iterating */
                   4822:                        return axl_false;
                   4823:                }
                   4824:                break;
                   4825:        case 5:
                   4826:                /* <child5> case */
                   4827:                if (! NODE_CMP_NAME (node, "child5")) {
                   4828:                        /* fill the error */
                   4829:                        axl_error_new (-1, "Expected to find a document node not found <child5>", NULL, (axlError **) ptr2);
                   4830: 
                   4831:                        /* stop iterating */
                   4832:                        return axl_false;
                   4833:                }
                   4834:                break;
                   4835:        case 6:
                   4836:                /* <a> case */
                   4837:                if (! NODE_CMP_NAME (node, "a")) {
                   4838:                        /* fill the error */
                   4839:                        axl_error_new (-1, "Expected to find a document node not found <a>", NULL, (axlError **) ptr2);
                   4840: 
                   4841:                        /* stop iterating */
                   4842:                        return axl_false;
                   4843:                }
                   4844:                break;
                   4845:        case 7:
                   4846:                /* <b> case */
                   4847:                if (! NODE_CMP_NAME (node, "b")) {
                   4848:                        /* fill the error */
                   4849:                        axl_error_new (-1, "Expected to find a document node not found <b>", NULL, (axlError **) ptr2);
                   4850: 
                   4851:                        /* stop iterating */
                   4852:                        return axl_false;
                   4853:                }
                   4854:                break;
                   4855:        case 8:
                   4856:                /* <c> case */
                   4857:                if (! NODE_CMP_NAME (node, "c")) {
                   4858:                        /* fill the error */
                   4859:                        axl_error_new (-1, "Expected to find a document node not found <c>", NULL, (axlError **) ptr2);
                   4860: 
                   4861:                        /* stop iterating */
                   4862:                        return axl_false;
                   4863:                }
                   4864:                break;
                   4865:        case 9:
                   4866:                /* <f> case */
                   4867:                if (! NODE_CMP_NAME (node, "f")) {
                   4868:                        /* fill the error */
                   4869:                        axl_error_new (-1, "Expected to find a document node not found <f>", NULL, (axlError **) ptr2);
                   4870: 
                   4871:                        /* stop iterating */
                   4872:                        return axl_false;
                   4873:                }
                   4874:                break;
                   4875:        case 10:
                   4876:                /* <g> case */
                   4877:                if (! NODE_CMP_NAME (node, "g")) {
                   4878:                        /* fill the error */
                   4879:                        axl_error_new (-1, "Expected to find a document node not found <g>", NULL, (axlError **) ptr2);
                   4880: 
                   4881:                        /* stop iterating */
                   4882:                        return axl_false;
                   4883:                }
                   4884:                break;
                   4885:        case 11:
                   4886:                /* <d> case */
                   4887:                if (! NODE_CMP_NAME (node, "d")) {
                   4888:                        /* fill the error */
                   4889:                        axl_error_new (-1, "Expected to find a document node not found <d>", NULL, (axlError **) ptr2);
                   4890: 
                   4891:                        /* stop iterating */
                   4892:                        return axl_false;
                   4893:                }
                   4894:                break;
                   4895:        case 12:
                   4896:                /* <e> case */
                   4897:                if (! NODE_CMP_NAME (node, "e")) {
                   4898:                        /* fill the error */
                   4899:                        axl_error_new (-1, "Expected to find a document node not found <e>", NULL, (axlError **) ptr2);
                   4900: 
                   4901:                        /* stop iterating */
                   4902:                        return axl_false;
                   4903:                }
                   4904:                break;
                   4905:        }
                   4906: 
                   4907:        /* update count */
                   4908:        (*iterator)++;
                   4909: 
                   4910:        /* keep iterating */
                   4911:        return axl_true;
                   4912: }
                   4913: 
                   4914: 
                   4915: 
                   4916: 
                   4917: /** 
                   4918:  * @brief Axl stream boundary checks.
                   4919:  * 
                   4920:  * 
                   4921:  * @return axl_false if the function fails to parse the
                   4922:  * document. axl_true if the test was properly executed.
                   4923:  */
                   4924: axl_bool test_01b (axlError ** error)  
                   4925: {
                   4926:        axlDoc   * doc;
                   4927:        axlNode  * node;
                   4928:        int        test_01b_id;
                   4929:        
                   4930:        /* parse document */
                   4931:        doc = axl_doc_parse_from_file ("test_01b.xml", error);
                   4932:        if (doc == NULL) 
                   4933:                return axl_false;
                   4934: 
                   4935:        /* get document root */
                   4936:        node = axl_doc_get_root (doc);
                   4937:        if (! NODE_CMP_NAME (node, "document")) {
                   4938:                axl_error_new (-1, "Expected to find root <document>, but it wasn't found", NULL, error);
                   4939:                return axl_false;
                   4940:        }
                   4941: 
                   4942:        /* get first child node */
                   4943:        node = axl_node_get_first_child (node);
                   4944:        if (! NODE_CMP_NAME (node, "child1")) {
                   4945:                axl_error_new (-1, "Expected to find child node <child1>, but it wasn't found", NULL, error);
                   4946:                return axl_false;
                   4947:        }
                   4948: 
                   4949:        /* get sibling node */
                   4950:        node = axl_node_get_next (node);
                   4951:        if (! NODE_CMP_NAME (node, "child2")) {
                   4952:                axl_error_new (-1, "Expected to find child node <child2>, but it wasn't found", NULL, error);
                   4953:                return axl_false;
                   4954:        }
                   4955: 
                   4956:        /* now iterate over all nodes inside the document */
                   4957:        test_01b_id = 0;
                   4958:        if (! axl_doc_iterate_full (doc, DEEP_ITERATION, test_01b_show_node_found, &test_01b_id, error))
                   4959:                return axl_false;
                   4960: 
                   4961:        /* now iterate over all nodes inside (wide mode) the document */
                   4962:        test_01b_id = 0;
                   4963:        if (! axl_doc_iterate_full (doc, WIDE_ITERATION, test_01b_show_node_found2, &test_01b_id, error))
                   4964:                return axl_false; 
                   4965: 
                   4966:        /* test ok */
                   4967:        axl_doc_free (doc);
                   4968:        return axl_true;
                   4969: }
                   4970: 
                   4971: /** 
                   4972:  * @brief Axl stream boundary checks.
                   4973:  * 
                   4974:  * 
                   4975:  * @return axl_false if the function fails to parse the
                   4976:  * document. axl_true if the test was properly executed.
                   4977:  */
                   4978: axl_bool test_01c (axlError ** error)  
                   4979: {
                   4980:        axlDoc   * doc;
                   4981:        axlNode  * node;
                   4982:        axlNode  * parent;
                   4983:        
                   4984:        /* parse document (uses the same xml document as test_01b) */
                   4985:        doc = axl_doc_parse_from_file ("test_01b.xml", error);
                   4986:        if (doc == NULL) 
                   4987:                return axl_false;
                   4988: 
                   4989:        /* get document root */
                   4990:        node = axl_doc_get_root (doc);
                   4991:        if (! NODE_CMP_NAME (node, "document")) {
                   4992:                axl_error_new (-1, "Expected to find root <document>, but it wasn't found", NULL, error);
                   4993:                return axl_false;
                   4994:        }
                   4995: 
                   4996:        /* get first child */
                   4997:        node = axl_node_get_first_child (node);
                   4998:        
                   4999:        if (! NODE_CMP_NAME (node, "child1")) {
                   5000:                axl_error_new (-1, "Expected to find <child1>, but it wasn't found", NULL, error);
                   5001:                return axl_false;
                   5002:        }
                   5003: 
                   5004:        /* check parent */
                   5005:        parent = axl_node_get_parent (node);
                   5006:        if (! NODE_CMP_NAME (parent, "document")) {
                   5007:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5008:                return axl_false;
                   5009:        }
                   5010:        
                   5011:        node = axl_node_get_next (node);
                   5012:        if (! NODE_CMP_NAME (node, "child2")) {
                   5013:                axl_error_new (-1, "Expected to find <child2>, but it wasn't found", NULL, error);
                   5014:                return axl_false;
                   5015:        }
                   5016: 
                   5017:        /* check parent */
                   5018:        parent = axl_node_get_parent (node);
                   5019:        if (! NODE_CMP_NAME (parent, "document")) {
                   5020:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5021:                return axl_false;
                   5022:        }
                   5023: 
                   5024:        node = axl_node_get_next (node);
                   5025:        if (! NODE_CMP_NAME (node, "child3")) {
                   5026:                axl_error_new (-1, "Expected to find <child3>, but it wasn't found", NULL, error);
                   5027:                return axl_false;
                   5028:        }
                   5029:        /* check parent */
                   5030:        parent = axl_node_get_parent (node);
                   5031:        if (! NODE_CMP_NAME (parent, "document")) {
                   5032:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5033:                return axl_false;
                   5034:        }
                   5035: 
                   5036:        node = axl_node_get_next (node);
                   5037:        if (! NODE_CMP_NAME (node, "child4")) {
                   5038:                axl_error_new (-1, "Expected to find <child4>, but it wasn't found", NULL, error);
                   5039:                return axl_false;
                   5040:        }
                   5041:        /* check parent */
                   5042:        parent = axl_node_get_parent (node);
                   5043:        if (! NODE_CMP_NAME (parent, "document")) {
                   5044:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5045:                return axl_false;
                   5046:        }
                   5047: 
                   5048:        node = axl_node_get_next (node);
                   5049:        if (! NODE_CMP_NAME (node, "child5")) {
                   5050:                axl_error_new (-1, "Expected to find <child5>, but it wasn't found", NULL, error);
                   5051:                return axl_false;
                   5052:        }
                   5053:        /* check parent */
                   5054:        parent = axl_node_get_parent (node);
                   5055:        if (! NODE_CMP_NAME (parent, "document")) {
                   5056:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5057:                return axl_false;
                   5058:        }
                   5059: 
                   5060:        if (axl_node_get_next (node) != NULL) {
                   5061:                axl_error_new (-1, "Expected to find NULL value while calling to axl_node_get_next, but it wasn't found", NULL, error);
                   5062:                return axl_false;
                   5063:        }
                   5064: 
                   5065:        node = axl_node_get_previous (node);
                   5066:        if (! NODE_CMP_NAME (node, "child4")) {
                   5067:                axl_error_new (-1, "Expected to find <child4>, but it wasn't found", NULL, error);
                   5068:                return axl_false;
                   5069:        }
                   5070:        /* check parent */
                   5071:        if (! NODE_CMP_NAME (parent, "document")) {
                   5072:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5073:                return axl_false;
                   5074:        }
                   5075: 
                   5076:        node = axl_node_get_previous (node);
                   5077:        if (! NODE_CMP_NAME (node, "child3")) {
                   5078:                axl_error_new (-1, "Expected to find <child3>, but it wasn't found", NULL, error);
                   5079:                return axl_false;
                   5080:        }
                   5081:        /* check parent */
                   5082:        if (! NODE_CMP_NAME (parent, "document")) {
                   5083:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5084:                return axl_false;
                   5085:        }
                   5086: 
                   5087:        node = axl_node_get_previous (node);
                   5088:        if (! NODE_CMP_NAME (node, "child2")) {
                   5089:                axl_error_new (-1, "Expected to find <child2>, but it wasn't found", NULL, error);
                   5090:                return axl_false;
                   5091:        }
                   5092:        /* check parent */
                   5093:        if (! NODE_CMP_NAME (parent, "document")) {
                   5094:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5095:                return axl_false;
                   5096:        }
                   5097: 
                   5098:        node = axl_node_get_previous (node);
                   5099:        if (! NODE_CMP_NAME (node, "child1")) {
                   5100:                axl_error_new (-1, "Expected to find <child1>, but it wasn't found", NULL, error);
                   5101:                return axl_false;
                   5102:        }
                   5103:        /* check parent */
                   5104:        parent = axl_node_get_parent (node);
                   5105:        if (! NODE_CMP_NAME (parent, "document")) {
                   5106:                axl_error_new (-1, "Expected to find parent <document>, but it wasn't found", NULL, error);
                   5107:                return axl_false;
                   5108:        }
                   5109: 
                   5110:        if (axl_node_get_previous (node) != NULL) {
                   5111:                axl_error_new (-1, "Expected to find NULL value while calling to axl_node_get_next, but it wasn't found", NULL, error);
                   5112:                return axl_false;
                   5113:        }
                   5114: 
                   5115:        /* check next called and previous called api */
                   5116:        node = axl_doc_get_root (doc);
                   5117:        node = axl_node_get_first_child (node);
                   5118:        
                   5119: 
                   5120:        /* get <child5> */
                   5121:        node = axl_node_get_next_called (node, "child5");
                   5122:        if (! NODE_CMP_NAME (node, "child5")) {
                   5123:                axl_error_new (-1, "Expected to find <child5> node while calling to axl_node_get_next_called, but it wasn't found", NULL, error);
                   5124:                return axl_false;
                   5125:        }
                   5126:        
                   5127:        /* check next empty */
                   5128:        if (axl_node_get_next_called (node, "child5") != NULL) {
                   5129:                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);
                   5130:                return axl_false;
                   5131:        }
                   5132: 
                   5133:        /* get <child1> */
                   5134:        node = axl_node_get_previous_called (node, "child1");
                   5135:        if (! NODE_CMP_NAME (node, "child1")) {
                   5136:                axl_error_new (-1, "Expected to find <child1> node while calling to axl_node_get_previous_called, but it wasn't found", NULL, error);
                   5137:                return axl_false;
                   5138:        }
                   5139: 
                   5140:        /* check next empty */
                   5141:        if (axl_node_get_previous_called (node, "child1") != NULL) {
                   5142:                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);
                   5143:                return axl_false;
                   5144:        }
                   5145: 
                   5146:        /* free document */
                   5147:        axl_doc_free (doc);
                   5148: 
                   5149:        return axl_true;
                   5150: }
                   5151: 
                   5152: /** 
                   5153:  * @brief Axl node nth access.
                   5154:  * 
                   5155:  * @return axl_false if the function fails to parse the
                   5156:  * document. axl_true if the test was properly executed.
                   5157:  */
                   5158: axl_bool test_01d (axlError ** error)  
                   5159: {
                   5160:        axlDoc   * doc;
                   5161:        axlNode  * node;
                   5162:        axlNode  * child;
                   5163:        
                   5164:        /* parse document */
                   5165:        doc = axl_doc_parse_from_file ("test_01d.xml", error);
                   5166:        if (doc == NULL) 
                   5167:                return axl_false;
                   5168: 
                   5169:        /* get document root */
                   5170:        node = axl_doc_get_root (doc);
                   5171:        
                   5172:        /* get the node at the 0 position */
                   5173:        child = axl_node_get_child_nth (node, 0);
                   5174:        if (! NODE_CMP_NAME (child, "child1")) {
                   5175:                axl_error_new (-1, "Expected to find node <child1> at 0, but it wasn't found", NULL, error);
                   5176:                return axl_false;
                   5177:        }
                   5178: 
                   5179:        /* get the node at the 1 position */
                   5180:        child = axl_node_get_child_nth (node, 1);
                   5181:        if (! NODE_CMP_NAME (child, "child2")) {
                   5182:                axl_error_new (-1, "Expected to find node <child2> at 1, but it wasn't found", NULL, error);
                   5183:                return axl_false;
                   5184:        }
                   5185: 
                   5186:        /* get the node at the 2 position */
                   5187:        child = axl_node_get_child_nth (node, 2);
                   5188:        if (! NODE_CMP_NAME (child, "child3")) {
                   5189:                axl_error_new (-1, "Expected to find node <child3> at 2, but it wasn't found", NULL, error);
                   5190:                return axl_false;
                   5191:        }
                   5192: 
                   5193:        /* get the node at the 3 position */
                   5194:        child = axl_node_get_child_nth (node, 3);
                   5195:        if (! NODE_CMP_NAME (child, "child4")) {
                   5196:                axl_error_new (-1, "Expected to find node <child4> at 3, but it wasn't found", NULL, error);
                   5197:                return axl_false;
                   5198:        }
                   5199: 
                   5200:        /* get the node at the 4 position */
                   5201:        child = axl_node_get_child_nth (node, 4);
                   5202:        if (! NODE_CMP_NAME (child, "child5")) {
                   5203:                axl_error_new (-1, "Expected to find node <child5> at 4, but it wasn't found", NULL, error);
                   5204:                return axl_false;
                   5205:        }
                   5206: 
                   5207:        /* now with <child3> childs *> */
                   5208:        node = axl_node_get_child_nth (node, 2);
                   5209:        
                   5210:        /* get the node at the 0 position */
                   5211:        child = axl_node_get_child_nth (node, 0);
                   5212:        if (! NODE_CMP_NAME (child, "a")) {
                   5213:                axl_error_new (-1, "Expected to find node <a> at 0, but it wasn't found", NULL, error);
                   5214:                return axl_false;
                   5215:        }
                   5216: 
                   5217:        /* get the node at the 1 position */
                   5218:        child = axl_node_get_child_nth (node, 1);
                   5219:        if (! NODE_CMP_NAME (child, "b")) {
                   5220:                axl_error_new (-1, "Expected to find node <b> at 1, but it wasn't found", NULL, error);
                   5221:                return axl_false;
                   5222:        }
                   5223:           
                   5224:        /* get the node at the 2 position */
                   5225:        child = axl_node_get_child_nth (node, 2);
                   5226:        if (! NODE_CMP_NAME (child, "c")) {
                   5227:                axl_error_new (-1, "Expected to find node <c> at 2, but it wasn't found", NULL, error);
                   5228:                return axl_false;
                   5229:        }
                   5230: 
                   5231:        /* get the node at the 3 position */
                   5232:        child = axl_node_get_child_nth (node, 3);
                   5233:        if (! NODE_CMP_NAME (child, "f")) {
                   5234:                axl_error_new (-1, "Expected to find node <f> at 3, but it wasn't found", NULL, error);
                   5235:                return axl_false;
                   5236:        }
                   5237: 
                   5238:        /* get the node at the 4 position */
                   5239:        child = axl_node_get_child_nth (node, 4);
                   5240:        if (! NODE_CMP_NAME (child, "g")) {
                   5241:                axl_error_new (-1, "Expected to find node <g> at 4, but it wasn't found", NULL, error);
                   5242:                return axl_false;
                   5243:        }
                   5244: 
                   5245:        /* test ok */
                   5246:        axl_doc_free (doc);
                   5247:        return axl_true;
                   5248: }
                   5249: 
                   5250: /** 
                   5251:  * @brief Check parsing document with huge node content.
                   5252:  * 
                   5253:  * @return axl_false if the function fails to parse the
                   5254:  * document. axl_true if the test was properly executed.
                   5255:  */
                   5256: axl_bool test_01e (axlError ** error)  
                   5257: {
                   5258:        axlDoc         * doc;
                   5259:        axlNode        * node;
                   5260:        const char     * content;
                   5261:        int              size;
                   5262:        
                   5263:        /* parse document */
                   5264:        doc = axl_doc_parse_from_file ("test_01e.xml", error);
                   5265:        if (doc == NULL) 
                   5266:                return axl_false;
                   5267:        
                   5268:        /* get root node */
                   5269:        node    = axl_doc_get_root (doc);
                   5270:        content = axl_node_get_content (node, &size);
                   5271:        
                   5272:        /* free document */
                   5273:        axl_doc_free (doc);
                   5274: 
                   5275:        return axl_true;
                   5276: } 
                   5277: 
                   5278: /** 
                   5279:  * @brief Check parsing document xml:space attribute.
                   5280:  * 
                   5281:  * @return axl_false if the function fails to parse the document. axl_true if
                   5282:  * the test was properly executed.
                   5283:  */
                   5284: axl_bool test_01f (axlError ** error)  
                   5285: {
                   5286:        axlDoc         * doc;
                   5287:        axlNode        * node;
                   5288:        const char     * content;
                   5289:        int              size;
                   5290:        
                   5291:        /* parse document */
                   5292:        doc = axl_doc_parse_from_file ("test_01f.xml", error);
                   5293:        if (doc == NULL) 
                   5294:                return axl_false;
                   5295:        
                   5296:        /* get root node */
                   5297:        node    = axl_doc_get_root (doc);
                   5298:        content = axl_node_get_content (node, &size);
                   5299: 
                   5300:        if (! axl_cmp (content, "     ")) {
                   5301:                printf ("found content '%s' but expected '%s'...\n", content, "     ");
                   5302:                axl_error_new (-1, "Expected to find content not found", NULL, error);
                   5303:                axl_free (doc);
                   5304:                return axl_false;
                   5305:        }
                   5306:        
                   5307:        /* free document */
                   5308:        axl_doc_free (doc);
                   5309: 
                   5310:        /* parse document */
                   5311:        doc = axl_doc_parse_from_file ("test_01f2.xml", error);
                   5312:        if (doc == NULL) 
                   5313:                return axl_false;
                   5314:        
                   5315:        /* get node <content/id> */
                   5316:        node    = axl_doc_get_root (doc);
                   5317:        node    = axl_node_get_child_called (node, "id");
                   5318:        content = axl_node_get_content (node, &size);
                   5319: 
                   5320:        if (! axl_cmp (content, "   ")) {
                   5321:                printf ("found content '%s' but expected '%s'...\n", content, "   ");
                   5322:                axl_error_new (-1, "Expected to find content not found", NULL, error);
                   5323:                axl_free (doc);
                   5324:                return axl_false;
                   5325:        }
                   5326: 
                   5327:        /* get node <content/id2> */
                   5328:        node    = axl_doc_get_root (doc);
                   5329:        node    = axl_node_get_child_called (node, "id2");
                   5330:        content = axl_node_get_content (node, &size);
                   5331: 
                   5332:        if (! axl_cmp (content, "")) {
                   5333:                printf ("found content '%s' but expected '%s'...\n", content, "");
                   5334:                axl_error_new (-1, "Expected to find content not found", NULL, error);
                   5335:                axl_free (doc);
                   5336:                return axl_false;
                   5337:        }
                   5338:        
                   5339:        /* free document */
                   5340:        axl_doc_free (doc);
                   5341: 
                   5342:        return axl_true;
                   5343: } 
                   5344: 
                   5345: /** 
                   5346:  * @brief Test current libaxl list implementation.
                   5347:  * 
                   5348:  * 
                   5349:  * @return axl_true if it works properly or axl_false if not.
                   5350:  */
                   5351: axl_bool test_01_01 () 
                   5352: {
                   5353:        axlList * list;
                   5354:        int       value;
                   5355: 
                   5356:        axlPointer ptr1;
                   5357:        axlPointer ptr2;
                   5358:        axlPointer ptr3;
                   5359:        axlPointer ptr4;
                   5360: 
                   5361:        /* create the list */
                   5362:        list = axl_list_new (axl_list_equal_string, NULL);
                   5363:        if (axl_list_length (list) != 0) {
                   5364:                printf ("Bad length returned by the list (%d != 0)\n",
                   5365:                        axl_list_length (list));
                   5366:                return axl_false;
                   5367:        }
                   5368: 
                   5369:        if (! axl_list_is_empty (list)) {
                   5370:                printf ("Expected to find empty list just after list created\n");
                   5371:                return axl_false;
                   5372:        } /* end if */
                   5373:        
                   5374:        /* add data */
                   5375:        axl_list_add (list, "test 1");
                   5376:        if (axl_list_length (list) != 1) {
                   5377:                printf ("Bad length returned by the list (%d != 1)\n",
                   5378:                        axl_list_length (list));
                   5379:                return axl_false;
                   5380:        }
                   5381: 
                   5382:        if (axl_list_is_empty (list)) {
                   5383:                printf ("Expected to find a non-empty list just after items added\n");
                   5384:                return axl_false;
                   5385:        } /* end if */
                   5386:        
                   5387:        axl_list_add (list, "test 2");
                   5388:        if (axl_list_length (list) != 2) {
                   5389:                printf ("Bad length returned by the list (%d != 2)\n",
                   5390:                        axl_list_length (list));
                   5391:                return axl_false;
                   5392:        }
                   5393: 
                   5394:        axl_list_add (list, "test 3");
                   5395:        if (axl_list_length (list) != 3) {
                   5396:                printf ("Bad length returned by the list (%d != 3)\n",
                   5397:                        axl_list_length (list));
                   5398:                return axl_false;
                   5399:        }
                   5400: 
                   5401:        /* remove data */
                   5402:        axl_list_remove (list, "test 1");
                   5403:        if (axl_list_length (list) != 2) {
                   5404:                printf ("Bad length returned by the list, seems that remove doesn't work (%d != 2)\n",
                   5405:                        axl_list_length (list));
                   5406:                return axl_false;
                   5407:        }
                   5408: 
                   5409:        axl_list_remove (list, "test 2");
                   5410:        if (axl_list_length (list) != 1) {
                   5411:                printf ("Bad length returned by the list, seems that remove doesn't work\n");
                   5412:                return axl_false;
                   5413:        }
                   5414: 
                   5415:        axl_list_remove (list, "test 3");
                   5416:        if (axl_list_length (list) != 0) {
                   5417:                printf ("Bad length returned by the list, seems that remove doesn't work\n");
                   5418:                return axl_false;
                   5419:        }
                   5420: 
                   5421:        /* add data again */
                   5422:        axl_list_add (list, "test 4");
                   5423:        axl_list_add (list, "test 5");
                   5424:        if (axl_list_length (list) != 2) {
                   5425:                printf ("Bad length returned by the list, seems that remove doesn't work\n");
                   5426:                return axl_false;
                   5427:        }
                   5428:        
                   5429:        axl_list_remove (list, "test 1");
                   5430:        if (axl_list_length (list) != 2) {
                   5431:                printf ("Bad length returned by the list, seems that remove doesn't work\n");
                   5432:                return axl_false;
                   5433:        }
                   5434: 
                   5435:        if (! axl_list_exists (list, "test 5")) {
                   5436:                printf ("Exist function have failed\n");
                   5437:                return axl_false;
                   5438:        }
                   5439: 
                   5440:        if (! axl_list_exists (list, "test 4")) {
                   5441:                printf ("Exist function have failed\n");
                   5442:                return axl_false;
                   5443:        }
                   5444:        
                   5445:        if (axl_list_exists (list, "test 1")) {
                   5446:                printf ("Exist function have failed\n");
                   5447:                return axl_false;
                   5448:        }
                   5449: 
                   5450:        if (! axl_list_exists_at (list, "test 4", 0)) {
                   5451:                printf ("\"Exists at\" functionality seems to not work (0)\n");
                   5452:                return axl_false;
                   5453:        }
                   5454: 
                   5455:        if (! axl_list_exists_at (list, "test 5", 1)) {
                   5456:                printf ("\"Exists at\" functionality seems to not work (1)\n");
                   5457:                return axl_false;
                   5458:        }
                   5459: 
                   5460:        axl_list_free (list);
                   5461: 
                   5462:        /* create a new list */
                   5463:        list = axl_list_new (axl_list_equal_string, NULL);
                   5464: 
                   5465:        axl_list_add (list, "test 1");
                   5466:        axl_list_add (list, "test 3");
                   5467:        axl_list_add (list, "test 5");
                   5468: 
                   5469:        axl_list_add_at (list, "test 0", 0);
                   5470:        axl_list_add_at (list, "test 2", 2);
                   5471:        axl_list_add_at (list, "test 4", 4);
                   5472:        axl_list_add_at (list, "test 6", 6);
                   5473: 
                   5474:        if (! axl_list_exists_at (list, "test 0", 0)) {
                   5475:                printf ("\"Exists at\" functionality seems to not work (0)\n");
                   5476:                return axl_false;
                   5477:        }
                   5478: 
                   5479:        if (! axl_list_exists_at (list, "test 1", 1)) {
                   5480:                printf ("\"Exists at\" functionality seems to not work (1)\n");
                   5481:                return axl_false;
                   5482:        }
                   5483: 
                   5484:        if (! axl_list_exists_at (list, "test 2", 2)) {
                   5485:                printf ("\"Exists at\" functionality seems to not work (2)\n");
                   5486:                return axl_false;
                   5487:        }
                   5488: 
                   5489:        if (! axl_list_exists_at (list, "test 3", 3)) {
                   5490:                printf ("\"Exists at\" functionality seems to not work (3)\n");
                   5491:                return axl_false;
                   5492:        }
                   5493: 
                   5494:        if (! axl_list_exists_at (list, "test 4", 4)) {
                   5495:                printf ("\"Exists at\" functionality seems to not work (4)\n");
                   5496:                return axl_false;
                   5497:        }
                   5498: 
                   5499:        if (! axl_list_exists_at (list, "test 5", 5)) {
                   5500:                printf ("\"Exists at\" functionality seems to not work (5)\n");
                   5501:                return axl_false;
                   5502:        }
                   5503: 
                   5504:        if (! axl_list_exists_at (list, "test 6", 6)) {
                   5505:                printf ("\"Exists at\" functionality seems to not work (6)\n");
                   5506:                return axl_false;
                   5507:        }
                   5508: 
                   5509:        /* free the list */
                   5510:        axl_list_free (list);
                   5511: 
                   5512:        /* create an integer list */
                   5513:        list = axl_list_new (axl_list_equal_int, NULL);
                   5514:        axl_list_add (list, INT_TO_PTR (1));
                   5515:        axl_list_add (list, INT_TO_PTR (3));
                   5516:        axl_list_add (list, INT_TO_PTR (3900));
                   5517:        axl_list_add (list, INT_TO_PTR (20230));
                   5518: 
                   5519:        if (axl_list_length (list) != 4) {
                   5520:                printf ("Expected to find 4 items inside an integer list");
                   5521:                return axl_false;
                   5522:        }
                   5523: 
                   5524:        /* remove one item */
                   5525:        axl_list_remove (list, INT_TO_PTR (1));
                   5526: 
                   5527:        if (axl_list_length (list) != 3) {
                   5528:                printf ("Expected to find 3 items inside an integer list");
                   5529:                return axl_false;
                   5530:        }
                   5531: 
                   5532:        /* remove one item */
                   5533:        axl_list_remove (list, INT_TO_PTR (1));
                   5534: 
                   5535:        if (axl_list_length (list) != 3) {
                   5536:                printf ("Expected to find 3 items inside an integer list");
                   5537:                return axl_false;
                   5538:        }
                   5539: 
                   5540:        /* remove one item */
                   5541:        axl_list_remove (list, INT_TO_PTR (3));
                   5542: 
                   5543:        if (axl_list_length (list) != 2) {
                   5544:                printf ("Expected to find 2 items inside an integer list");
                   5545:                return axl_false;
                   5546:        }
                   5547: 
                   5548:        /* remove one item */
                   5549:        axl_list_remove (list, INT_TO_PTR (3900));
                   5550: 
                   5551:        if (axl_list_length (list) != 1) {
                   5552:                printf ("Expected to find 1 items inside an integer list");
                   5553:                return axl_false;
                   5554:        }
                   5555: 
                   5556:        /* remove one item */
                   5557:        axl_list_remove (list, INT_TO_PTR (20230));
                   5558: 
                   5559:        if (axl_list_length (list) != 0) {
                   5560:                printf ("Expected to find 0 items inside an integer list");
                   5561:                return axl_false;
                   5562:        }
                   5563:        axl_list_free (list);
                   5564: 
                   5565:        /* create an integer list */
                   5566:        list = axl_list_new (axl_list_equal_int, NULL);
                   5567: 
                   5568:        /* add items */
                   5569:        axl_list_add (list, INT_TO_PTR (8));
                   5570:        axl_list_add (list, INT_TO_PTR (10));
                   5571:        axl_list_add (list, INT_TO_PTR (11));
                   5572:        axl_list_add (list, INT_TO_PTR (12));
                   5573:        axl_list_add (list, INT_TO_PTR (102));
                   5574:        axl_list_add (list, INT_TO_PTR (1123));
                   5575:        axl_list_add (list, INT_TO_PTR (412));
                   5576:        axl_list_add (list, INT_TO_PTR (122));
                   5577:        axl_list_add (list, INT_TO_PTR (148));
                   5578:        axl_list_add (list, INT_TO_PTR (670));
                   5579:        axl_list_add (list, INT_TO_PTR (2));
                   5580:        
                   5581:        if (axl_list_length (list) != 11) {
                   5582:                printf ("Expected to find 11 element, but found: %d\n", axl_list_length (list));
                   5583:                return axl_false;
                   5584:        }
                   5585: 
                   5586:        /* remove the third element */
                   5587:        axl_list_remove (list, INT_TO_PTR (11));
                   5588:        
                   5589:        if (axl_list_length (list) != 10) {
                   5590:                printf ("Expected to find 10 element, but found: %d\n", axl_list_length (list));
                   5591:                return axl_false;
                   5592:        }
                   5593: 
                   5594:        /* remove the third element */
                   5595:        axl_list_remove (list, INT_TO_PTR (122));
                   5596:        
                   5597:        if (axl_list_length (list) != 9) {
                   5598:                printf ("Expected to find 9 element, but found: %d\n", axl_list_length (list));
                   5599:                return axl_false;
                   5600:        }
                   5601: 
                   5602:        /* free the list */
                   5603:        axl_list_free (list);
                   5604:        
                   5605:        list = axl_list_new (axl_list_equal_int, NULL);
                   5606: 
                   5607:        axl_list_append (list, INT_TO_PTR (9));
                   5608:        axl_list_append (list, INT_TO_PTR (10));
                   5609:        axl_list_append (list, INT_TO_PTR (8));
                   5610:        axl_list_append (list, INT_TO_PTR (11));
                   5611:        
                   5612:        if (axl_list_length (list) != 4) {
                   5613:                printf ("Expected to find 4 element, but found: %d\n", axl_list_length (list));
                   5614:                return axl_false;
                   5615:        }
                   5616: 
                   5617:        /* remove */
                   5618:        axl_list_remove (list, INT_TO_PTR(8));
                   5619:        
                   5620:        if (axl_list_length (list) != 3) {
                   5621:                printf ("Expected to find 3 element, but found: %d\n", axl_list_length (list));
                   5622:                return axl_false;
                   5623:        }
                   5624:        
                   5625:        /* free the list */
                   5626:        axl_list_free (list);
                   5627: 
                   5628:        list = axl_list_new (axl_list_equal_int, NULL);
                   5629: 
                   5630:        axl_list_append (list, INT_TO_PTR (8));
                   5631:        axl_list_append (list, INT_TO_PTR (10));
                   5632:        axl_list_append (list, INT_TO_PTR (11));
                   5633:        axl_list_append (list, INT_TO_PTR (9));
                   5634:        
                   5635:        if (axl_list_length (list) != 4) {
                   5636:                printf ("Expected to find 4 element, but found: %d\n", axl_list_length (list));
                   5637:                return axl_false;
                   5638:        }
                   5639: 
                   5640:        axl_list_remove (list, INT_TO_PTR(10));
                   5641: 
                   5642:        if (axl_list_length (list) != 3) {
                   5643:                printf ("Expected to find 3 element, but found: %d\n", axl_list_length (list));
                   5644:                return axl_false;
                   5645:        }
                   5646: 
                   5647:        /* free the list */
                   5648:        axl_list_free (list);
                   5649: 
                   5650:        list = axl_list_new (axl_list_equal_int, NULL);
                   5651: 
                   5652:        axl_list_append (list, INT_TO_PTR (9));
                   5653:        axl_list_append (list, INT_TO_PTR (8));
                   5654:        axl_list_append (list, INT_TO_PTR (10));
                   5655:        axl_list_append (list, INT_TO_PTR (11));
                   5656:        
                   5657:        if (axl_list_length (list) != 4) {
                   5658:                printf ("Expected to find 4 element, but found: %d\n", axl_list_length (list));
                   5659:                return axl_false;
                   5660:        }
                   5661: 
                   5662:        /* remove */
                   5663:        axl_list_remove (list, INT_TO_PTR(8));
                   5664: 
                   5665:        /* remove */
                   5666:        axl_list_remove (list, INT_TO_PTR(10));
                   5667: 
                   5668:        if (axl_list_length (list) != 2) {
                   5669:                printf ("Expected to find 2 element, but found: %d\n", axl_list_length (list));
                   5670:                return axl_false;
                   5671:        }
                   5672:        
                   5673:        /* free the list */
                   5674:        axl_list_free (list);
                   5675: 
                   5676: 
                   5677:        /* create a list and check remove first/get first */
                   5678:        list = axl_list_new (axl_list_equal_int, NULL);
                   5679:        axl_list_add (list, INT_TO_PTR(1));
                   5680:        axl_list_add (list, INT_TO_PTR(2));
                   5681:        axl_list_add (list, INT_TO_PTR(3));
                   5682:        axl_list_add (list, INT_TO_PTR(4));
                   5683:        axl_list_add (list, INT_TO_PTR(5));
                   5684:        axl_list_add (list, INT_TO_PTR(6));
                   5685:        axl_list_add (list, INT_TO_PTR(7));
                   5686:        axl_list_add (list, INT_TO_PTR(8));
                   5687:        axl_list_add (list, INT_TO_PTR(9));
                   5688:        axl_list_add (list, INT_TO_PTR(10));
                   5689:        while (axl_list_length (list) > 0) {
                   5690:                
                   5691:                /* get the integer value */
                   5692:                value = PTR_TO_INT (axl_list_get_first (list));
                   5693:                
                   5694:                /* remove */
                   5695:                axl_list_unlink_first (list);
                   5696:        }
                   5697:        if (axl_list_length (list) != 0) {
                   5698:                printf ("Expected to find 0 length list..\n");
                   5699:                return axl_false;
                   5700:        }
                   5701: 
                   5702:        axl_list_free (list);
                   5703: 
                   5704:        /* create an empty list and destroy */
                   5705:        list = axl_list_new (axl_list_equal_int, NULL);
                   5706: 
                   5707:        /* add one item */
                   5708:        axl_list_add (list, INT_TO_PTR (1));
                   5709:        if (axl_list_length (list) != 1) {
                   5710:                printf ("Expected to find 1 length length..\n");
                   5711:                return axl_false;
                   5712:        }
                   5713: 
                   5714:        axl_list_add (list, INT_TO_PTR (2));
                   5715:        if (axl_list_length (list) != 2) {
                   5716:                printf ("Expected to find 2 length length..\n");
                   5717:                return axl_false;
                   5718:        }
                   5719: 
                   5720:        axl_list_unlink (list, INT_TO_PTR (1));
                   5721:        if (axl_list_length (list) != 1) {
                   5722:                printf ("Expected to find 1 length length..\n");
                   5723:                return axl_false;
                   5724:        }
                   5725: 
                   5726:        axl_list_unlink (list, INT_TO_PTR (2));
                   5727:        if (axl_list_length (list) != 0) {
                   5728:                printf ("Expected to find 0 length length..\n");
                   5729:                return axl_false;
                   5730:        }
                   5731: 
                   5732:        axl_list_free (list);
                   5733: 
                   5734:        /* remove by pointer */
                   5735:        list = axl_list_new (axl_list_always_return_1, axl_free);
                   5736: 
                   5737:        /* add items */
                   5738:        ptr1 = axl_new (char, 4);
                   5739:        ptr2 = axl_new (char, 4);
                   5740:        ptr3 = axl_new (char, 4);
                   5741:        ptr4 = axl_new (char, 4);
                   5742: 
                   5743:        /* store items */
                   5744:        axl_list_add (list, ptr1);
                   5745:        axl_list_add (list, ptr2);
                   5746:        axl_list_add (list, ptr3);
                   5747:        axl_list_add (list, ptr4);
                   5748: 
                   5749:        /* check lengths */
                   5750:        if (axl_list_length (list) != 4) {
                   5751:                printf ("Expected to find a 4 item list...but found: %d..\n",
                   5752:                        axl_list_length (list));
                   5753:                return axl_false;
                   5754:        }
                   5755: 
                   5756:        /* remove items */
                   5757:        axl_list_remove_ptr (list, ptr1);
                   5758: 
                   5759:        if (axl_list_length (list) != 3) {
                   5760:                printf ("Expected to find a 3 item list...but found: %d..\n",
                   5761:                        axl_list_length (list));
                   5762:                return axl_false;
                   5763:        }
                   5764: 
                   5765:        /* remove items */
                   5766:        axl_list_remove_ptr (list, ptr2);
                   5767:        axl_list_remove_ptr (list, ptr3);
                   5768:        axl_list_remove_ptr (list, ptr4);
                   5769: 
                   5770:        if (axl_list_length (list) != 0) {
                   5771:                printf ("Expected to find a 0 item list...but found: %d..\n",
                   5772:                        axl_list_length (list));
                   5773:                return axl_false;
                   5774:        }
                   5775: 
                   5776:        axl_list_free (list);
                   5777: 
                   5778:        /* add and remove item 0 */
                   5779:        list = axl_list_new (axl_list_equal_int, NULL);
                   5780:        axl_list_append (list, INT_TO_PTR (0));
                   5781:        axl_list_append (list, INT_TO_PTR (0));
                   5782:        axl_list_append (list, INT_TO_PTR (0));
                   5783:        axl_list_append (list, INT_TO_PTR (0));
                   5784:        
                   5785:        if (axl_list_length (list) != 4) {
                   5786:                printf ("Expected to find 4 items stored in the list.., but found: %d..\n",
                   5787:                        axl_list_length (list));
                   5788:                return axl_false;
                   5789:        } /* end if */
                   5790: 
                   5791:        axl_list_remove (list, INT_TO_PTR (0));
                   5792: 
                   5793:        if (axl_list_length (list) != 3) {
                   5794:                printf ("Expected to find 3 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_ptr (list, INT_TO_PTR (0));
                   5800: 
                   5801:        if (axl_list_length (list) != 2) {
                   5802:                printf ("Expected to find 2 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_first (list);
                   5808: 
                   5809:        if (axl_list_length (list) != 1) {
                   5810:                printf ("Expected to find 1 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_last (list);
                   5816: 
                   5817:        if (axl_list_length (list) != 0) {
                   5818:                printf ("Expected to find 0 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_free (list);
                   5824: 
                   5825:        /* add and remove item 0 */
                   5826:        list = axl_list_new (axl_list_always_return_1, NULL);
                   5827:        axl_list_append (list, INT_TO_PTR (0));
                   5828:        axl_list_append (list, INT_TO_PTR (0));
                   5829:        axl_list_append (list, INT_TO_PTR (0));
                   5830:        axl_list_append (list, INT_TO_PTR (0));
                   5831:        
                   5832:        if (axl_list_length (list) != 4) {
                   5833:                printf ("Expected to find 4 items stored in the list.., but found: %d..\n",
                   5834:                        axl_list_length (list));
                   5835:                return axl_false;
                   5836:        } /* end if */
                   5837: 
                   5838:        axl_list_remove_ptr (list, INT_TO_PTR (0));
                   5839: 
                   5840:        if (axl_list_length (list) != 3) {
                   5841:                printf ("Expected to find 3 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_first (list);
                   5847: 
                   5848:        if (axl_list_length (list) != 2) {
                   5849:                printf ("Expected to find 2 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_last (list);
                   5855: 
                   5856:        if (axl_list_length (list) != 1) {
                   5857:                printf ("Expected to find 1 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_free (list);
                   5863: 
                   5864:        list = axl_list_new (axl_list_always_return_1, NULL);
                   5865:        axl_list_append (list, INT_TO_PTR (0));
                   5866: 
                   5867:        if (axl_list_length (list) != 1) {
                   5868:                printf ("Expected to find 1 items stored in the list.., but found: %d..\n",
                   5869:                        axl_list_length (list));
                   5870:                return axl_false;
                   5871:        } /* end if */
                   5872: 
                   5873:        axl_list_prepend (list, INT_TO_PTR (0));
                   5874: 
                   5875:        if (axl_list_length (list) != 2) {
                   5876:                printf ("Expected to find 2 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_free (list);
                   5882: 
                   5883:        return axl_true;
                   5884: }
                   5885: 
                   5886: axl_bool test_01_02_foreach (axlPointer stack_data, 
                   5887:                         axlPointer user_data, 
                   5888:                         axlPointer user_data2)
                   5889: {
                   5890:        int * iterator = user_data;
                   5891: 
                   5892:        if ((*iterator == 0) && axl_cmp ((char*) stack_data, "test 3")) {
                   5893:                (*iterator)++;
                   5894:                return axl_false;
                   5895:        } else if ((*iterator == 1) && axl_cmp ((char*) stack_data, "test 2")) {
                   5896:                (*iterator)++;
                   5897:                return axl_false;
                   5898:        } else if ((*iterator == 2) && axl_cmp ((char*) stack_data, "test 1")) {
                   5899:                (*iterator)++;
                   5900:                return axl_false;
                   5901:        }
                   5902:        
                   5903:        /* return axl_true to stop operations */
                   5904:        return axl_true;
                   5905: }
                   5906: 
                   5907: /** 
                   5908:  * @brief Checks current configuration for the stack implementation
                   5909:  * based on the axlList.
                   5910:  * 
                   5911:  * 
                   5912:  * @return axl_true if the stack works properly, otherwise axl_false
                   5913:  * is returned.
                   5914:  */
                   5915: axl_bool test_01_02 () 
                   5916: {
                   5917:        axlStack * stack;
                   5918:        char     * value;
                   5919:        int        iterator = 0;
                   5920: 
                   5921:        /* create the stack */
                   5922:        stack = axl_stack_new (NULL);
                   5923: 
                   5924:        axl_stack_push (stack, "test 1");
                   5925:        axl_stack_push (stack, "test 2");
                   5926:        axl_stack_push (stack, "test 3");
                   5927: 
                   5928:        /* check foreach function */
                   5929:        axl_stack_foreach (stack, test_01_02_foreach, &iterator, NULL);
                   5930: 
                   5931:        if (iterator != 3) {
                   5932:                printf ("Wrong value expected while using the foreach function\n");
                   5933:                return axl_false;
                   5934:        }
                   5935: 
                   5936:        if (axl_stack_size (stack) != 3) {
                   5937:                printf ("Wrong stack size expected ..\n");
                   5938:                return axl_false;
                   5939:        }
                   5940:        
                   5941:        value = axl_stack_pop (stack);
                   5942:        if (! axl_stream_cmp (value, "test 3", 6)) {
                   5943:                printf ("Wrong pop value returned (%s != %s)..\n", value, "test 3");
                   5944:                return axl_false;
                   5945:        }
                   5946: 
                   5947:        value = axl_stack_pop (stack);
                   5948:        if (! axl_stream_cmp (value, "test 2", 6)) {
                   5949:                printf ("Wrong pop value returned (%s != %s)..\n", value, "test 2");
                   5950:                return axl_false;
                   5951:        }
                   5952: 
                   5953:        value = axl_stack_pop (stack);
                   5954:        if (! axl_stream_cmp (value, "test 1", 6)) {
                   5955:                printf ("Wrong pop value returned (%s != %s)..\n", value, "test 1");
                   5956:                return axl_false;
                   5957:        }
                   5958: 
                   5959:        if (axl_stack_size (stack) != 0) {
                   5960:                printf ("Wrong stack size before operating..\n");
                   5961:                return axl_false;
                   5962:        }
                   5963: 
                   5964:        if (! axl_stack_is_empty (stack)) {
                   5965:                printf ("Wrong stack emptyness value received..\n");
                   5966:                return axl_false;
                   5967:        }
                   5968: 
                   5969:        /* destroy the stack */
                   5970:        axl_stack_free (stack);
                   5971: 
                   5972:        return axl_true;
                   5973: }
                   5974: 
                   5975: axl_bool test_01_03_vargs (const char * format, ...)
                   5976: {
                   5977:        va_list args;
                   5978: 
                   5979:        va_start (args, format);
                   5980: 
                   5981:        /* get the result */
                   5982:        if (axl_stream_vprintf_len (format, args) != 8)
                   5983:                return axl_false;
                   5984: 
                   5985:        va_end (args);
                   5986:        va_start (args, format);
                   5987: 
                   5988:        if (axl_stream_vprintf_len (format, args) != 8)
                   5989:                return axl_false;
                   5990: 
                   5991:        va_end (args);
                   5992:        va_start (args, format);
                   5993: 
                   5994:        if (axl_stream_vprintf_len (format, args) != 8)
                   5995:                return axl_false;
                   5996: 
                   5997:        va_end (args);
                   5998: 
                   5999:        return axl_true;
                   6000: }
                   6001: 
                   6002: /** 
                   6003:  *
                   6004:  * @brief Checks some internal functions that the library provides to
                   6005:  * manage strings.
                   6006:  *
                   6007:  * @return The function must return axl_true if everything is
                   6008:  * ok. Otherwise axl_false is returned.
                   6009:  */
                   6010: axl_bool test_01_03 () 
                   6011: {
                   6012:        char  * string;
                   6013:        char ** result;
                   6014:        char  * join;
                   6015:        int     res;
                   6016:        int     real_size;
                   6017:        int     trimmed;
                   6018: 
                   6019:        /* check that axl_stream_split works */
                   6020:        result = axl_stream_split ("value/value1/value3/value4", 1, "/");
                   6021:        if (result == NULL) {
                   6022:                printf ("Something have failed while using splitting functions\n");
                   6023:                return axl_false;
                   6024:        }
                   6025: 
                   6026:        if (axl_stream_strv_num (result) != 4) {
                   6027:                printf ("Something have failed while getting current number of pieces inside the split result (%d != %d)\n", 
                   6028:                        axl_stream_strv_num (result),4);
                   6029:                return axl_false;
                   6030:        }
                   6031:        
                   6032:        if (! axl_cmp (result[0], "value")) {
                   6033:                printf ("Failed to get the first element: (%s != %s)\n", result[0], "value");
                   6034:                return axl_false;
                   6035:        }
                   6036: 
                   6037:        if (! axl_cmp (result[1], "value1")) {
                   6038:                printf ("Failed to get the second element: (%s != %s)\n", result[1], "value1");
                   6039:                return axl_false;
                   6040:        }
                   6041: 
                   6042:        if (! axl_cmp (result[2], "value3")) {
                   6043:                printf ("Failed to get the third element (%s != %s)\n", result[2], "value3");
                   6044:                return axl_false;
                   6045:        }
                   6046: 
                   6047:        if (! axl_cmp (result[3], "value4")) {
                   6048:                printf ("Failed to get the fourth element (%s != %s)\n", result[3], "value4");
                   6049:                return axl_false;
                   6050:        }
                   6051: 
                   6052:        /* release memory used */
                   6053:        axl_stream_freev (result);
                   6054: 
                   6055:        result = axl_stream_split ("value1, value2/ value3* ", 3, ", ", "/ ", "* ");
                   6056:        if (result == NULL) {
                   6057:                printf ("Something have failed while using splitting functions (2)\n");
                   6058:                return axl_false;
                   6059:        }
                   6060: 
                   6061:        if (axl_stream_strv_num (result) != 4) {
                   6062:                printf ("Something have failed while getting current number of pieces inside the split result (%d != %d) (2)\n", 
                   6063:                        axl_stream_strv_num (result), 4);
                   6064:                return axl_false;
                   6065:        }
                   6066: 
                   6067:        if (! axl_cmp (result[0], "value1")) {
                   6068:                printf ("Failed to get the second element: (%s != %s)\n", result[0], "value1");
                   6069:                return axl_false;
                   6070:        }
                   6071: 
                   6072:        if (! axl_cmp (result[1], "value2")) {
                   6073:                printf ("Failed to get the third element (%s != %s)\n", result[1], "value2");
                   6074:                return axl_false;
                   6075:        }
                   6076: 
                   6077:        if (! axl_cmp (result[2], "value3")) {
                   6078:                printf ("Failed to get the fourth element (%s != %s)\n", result[2], "value3");
                   6079:                return axl_false;
                   6080:        }
                   6081: 
                   6082:        if (! axl_cmp (result[3], "")) {
                   6083:                printf ("Failed to get the fourth element ('%s' != '%s')\n", result[3], "");
                   6084:                return axl_false;
                   6085:        }
                   6086: 
                   6087:        
                   6088: 
                   6089:        /* release memory used */
                   6090:        axl_stream_freev (result);
                   6091: 
                   6092:        /* check empty cases */
                   6093:        result = axl_stream_split ("///", 1, "/");
                   6094:        if (result == NULL) {
                   6095:                printf ("Something have failed while using splitting functions (3)\n");
                   6096:                return axl_false;
                   6097:        }
                   6098: 
                   6099:        if (axl_stream_strv_num (result) != 4) {
                   6100:                printf ("Something have failed while getting current number of pieces inside the split result (%d != %d) (3)\n", 
                   6101:                        axl_stream_strv_num (result), 4);
                   6102:                return axl_false;
                   6103:        }
                   6104: 
                   6105:        /* release memory used */
                   6106:        axl_stream_freev (result);
                   6107: 
                   6108: 
                   6109:        /* now check the join string support */
                   6110:        result = axl_stream_split ("some test AND some test AND some test", 1, "AND");
                   6111:        
                   6112:        /* now join the data */
                   6113:        join   = axl_stream_join (result, "AND");
                   6114:        
                   6115:        if (! axl_cmp (join, "some test AND some test AND some test")) {
                   6116:                printf ("Join operation failed, expected different values '%s' != '%s'",
                   6117:                        join, "some test AND some test AND some test");
                   6118:                return axl_false;
                   6119:        }
                   6120:        axl_free (join);
                   6121:        axl_stream_freev (result);
                   6122: 
                   6123:        /* now check the join string support */
                   6124:        result = axl_stream_split ("some test", 1, "AND");
                   6125:        
                   6126:        /* now join the data */
                   6127:        join   = axl_stream_join (result, "AND");
                   6128:        
                   6129:        if (! axl_cmp (join, "some test")) {
                   6130:                printf ("Join operation failed, expected different values '%s' != '%s'",
                   6131:                        join, "some test");
                   6132:                return axl_false;
                   6133:        }
                   6134:        axl_free (join);
                   6135:        axl_stream_freev (result);
                   6136: 
                   6137:        /* now check the join string support */
                   6138:        result = axl_stream_split ("some test AND some test AND some test AND", 1, "AND");
                   6139:        
                   6140:        /* now join the data */
                   6141:        join   = axl_stream_join (result, "AND");
                   6142:        
                   6143:        if (! axl_cmp (join, "some test AND some test AND some test AND")) {
                   6144:                printf ("Join operation failed, expected different values '%s' != '%s'",
                   6145:                        join, "some test AND some test AND some test AND");
                   6146:                return axl_false;
                   6147:        }
                   6148:        axl_free (join);
                   6149:        axl_stream_freev (result);
                   6150: 
                   6151:        string = axl_strdup ("AxBcA");
                   6152:        if (! axl_cmp (axl_stream_to_upper (string), "AXBCA")) {
                   6153:                /* report error found */
                   6154:                printf ("failed to upper case letters\n");
                   6155:                return axl_false;
                   6156:        }
                   6157:        axl_free (string);
                   6158: 
                   6159:        string = axl_strdup ("AxBcA");
                   6160:        if (! axl_cmp (axl_stream_to_lower (string), "axbca")) {
                   6161:                /* report error found */
                   6162:                printf ("failed to lower case letters, result found: %s != %s\n", string, "axbca");
                   6163:                return axl_false;
                   6164:        }
                   6165:        axl_free (string);
                   6166: 
                   6167: 
                   6168:        string = axl_strdup ("\t \n   \r  value  \n \r \t \t  ");
                   6169:        axl_stream_trim (string);
                   6170: 
                   6171:        if (! axl_cmp (string, "value")) {
                   6172:                printf ("failed to trim the string received, expected '%s' == '%s'\n", 
                   6173:                        string, "value");
                   6174:                return axl_false;
                   6175:        }
                   6176: 
                   6177:        /* release memory */
                   6178:        axl_free (string);
                   6179: 
                   6180:        string = axl_strdup ("   value    ");
                   6181:        axl_stream_trim_with_size (string, &trimmed);
                   6182:        if (trimmed != 7) {
                   6183:                printf ("failed, expected to find a trimmed size of 7 but found %d (%s)\n", 
                   6184:                        trimmed, string);
                   6185:                return axl_false;
                   6186:        }
                   6187: 
                   6188:        /* check axl_stream_vprintf_len implementation */
                   6189:        if (axl_stream_printf_len (NULL, NULL) != 0) {
                   6190:                printf ("failed, expected to find an string value of 0, but it wasn't found\n");
                   6191:                return axl_false;
                   6192:        } /* end if */
                   6193: 
                   6194:        if (axl_stream_printf_len (" this is a test", NULL) != 16) {
                   6195:                printf ("failed, expected to find an string value of 16, but it wasn't found\n");
                   6196:                return axl_false;
                   6197:        }
                   6198: 
                   6199:        if (axl_stream_printf_len (" this %% is a %% test", NULL) != 20) {
                   6200:                printf ("failed, expected to find an string value of 20, but it wasn't found\n");
                   6201:                return axl_false;
                   6202:        }
                   6203: 
                   6204:        if (axl_stream_printf_len ("", NULL) != 1) {
                   6205:                printf ("failed, expected to find an string value of 1, but it wasn't found\n");
                   6206:                return axl_false;
                   6207:        }
                   6208: 
                   6209:        if (axl_stream_printf_len ("%%", NULL) != 2) {
                   6210:                printf ("failed, expected to find an string value of 2, but it wasn't found\n");
                   6211:                return axl_false;
                   6212:        }
                   6213: 
                   6214:        if (axl_stream_printf_len ("\"", NULL) != 2) {
                   6215:                printf ("failed, expected to find an string value of 2, but it wasn't found\n");
                   6216:                return axl_false;
                   6217:        }
                   6218: 
                   6219:        if (axl_stream_printf_len ("\"", NULL) != 2) {
                   6220:                printf ("failed, expected to find an string value of 2, but it wasn't found\n");
                   6221:                return axl_false;
                   6222:        }
                   6223: 
                   6224:        if (axl_stream_printf_len (" this is a test \r \t \n  asdf", NULL) != 28) {
                   6225:                printf ("failed, expected to find an string value of 28, but it wasn't found\n");
                   6226:                return axl_false;
                   6227:        } /* end if */
                   6228: 
                   6229:        res = axl_stream_printf_len ("%s", "This is a test");
                   6230:        if ( res != 15) {
                   6231:                printf ("failed, expected to find an string value of 15, but it was found (%d)\n", res);
                   6232:                return axl_false;
                   6233:        }
                   6234: 
                   6235:        res = axl_stream_printf_len (" adfasdf %s asdfasdf", "This is a test");
                   6236:        if ( res != 33) {
                   6237:                printf ("failed, expected to find an string value of 33, but it was found (%d)\n", res);
                   6238:                return axl_false;
                   6239:        }
                   6240: 
                   6241:        res = axl_stream_printf_len (" adfasdf %s asdfasdf %s", "This is a test", "fk2");
                   6242:        if ( res != 37) {
                   6243:                printf ("failed, expected to find an string value of 37, but it was found (%d)\n", res);
                   6244:                return axl_false;
                   6245:        }
                   6246: 
                   6247:        res = axl_stream_printf_len ("%% adfasdf %s asdfasdf %s", "This is a test", "fk2");
                   6248:        if ( res != 38) {
                   6249:                printf ("failed, expected to find an string value of 38, but it was found (%d)\n", res);
                   6250:                return axl_false;
                   6251:        }
                   6252: 
                   6253:        res = axl_stream_printf_len ("%d", 1);
                   6254:        if ( res != 2) {
                   6255:                printf ("failed, expected to find an string value of 2, but it was found (%d)\n", res);
                   6256:                return axl_false;
                   6257:        }
                   6258: 
                   6259:        res = axl_stream_printf_len ("%d", 10);
                   6260:        if ( res != 3) {
                   6261:                printf ("failed, expected to find an string value of 3, but it was found (%d)\n", res);
                   6262:                return axl_false;
                   6263:        }
                   6264: 
                   6265:        res = axl_stream_printf_len ("%d", -1);
                   6266:        if ( res != 3) {
                   6267:                printf ("failed, expected to find an string value of 3, but it was found (%d)\n", res);
                   6268:                return axl_false;
                   6269:        }
                   6270: 
                   6271:        res = axl_stream_printf_len ("%d", -10);
                   6272:        if ( res != 4) {
                   6273:                printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res);
                   6274:                return axl_false;
                   6275:        }
                   6276: 
                   6277:        res = axl_stream_printf_len ("%d", -100);
                   6278:        if ( res != 5) {
                   6279:                printf ("failed, expected to find an string value of 5, but it was found (%d)\n", res);
                   6280:                return axl_false;
                   6281:        }
                   6282: 
                   6283:        res = axl_stream_printf_len ("%d", -10012);
                   6284:        if ( res != 7) {
                   6285:                printf ("failed, expected to find an string value of 7, but it was found (%d)\n", res);
                   6286:                return axl_false;
                   6287:        }
                   6288: 
                   6289:        res = axl_stream_printf_len ("This is a number %d", -10012);
                   6290:        if ( res != 24) {
                   6291:                printf ("failed, expected to find an string value of 24, but it was found (%d)\n", res);
                   6292:                return axl_false;
                   6293:        }
                   6294: 
                   6295:        res = axl_stream_printf_len ("This is a number %d with content ", -10012);
                   6296:        if ( res != 38) {
                   6297:                printf ("failed, expected to find an string value of 38, but it was found (%d)\n", res);
                   6298:                return axl_false;
                   6299:        }
                   6300: 
                   6301:        res = axl_stream_printf_len ("This is a number %d with content %s", -10012, "This more content");
                   6302:        if ( res != 55) {
                   6303:                printf ("failed, expected to find an string value of 55, but it was found (%d)\n", res);
                   6304:                return axl_false;
                   6305:        }
                   6306: 
                   6307:        res = axl_stream_printf_len ("%c", 1);
                   6308:        if ( res != 2) {
                   6309:                printf ("failed, expected to find an string value of 2, but it was found (%d)\n", res);
                   6310:                return axl_false;
                   6311:        }
                   6312: 
                   6313:        res = axl_stream_printf_len (" %c ", 1);
                   6314:        if ( res != 4) {
                   6315:                printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res);
                   6316:                return axl_false;
                   6317:        }
                   6318: 
                   6319:        res = axl_stream_printf_len ("\x0D");
                   6320:        if ( res != 2) {
                   6321:                printf ("failed, expected to find an string value of 2, but it was found (%d)\n", res);
                   6322:                return axl_false;
                   6323:        }
                   6324: 
                   6325:        res = axl_stream_printf_len ("\x0D\x0A");
                   6326:        if ( res != 3) {
                   6327:                printf ("failed, expected to find an string value of 3, but it was found (%d)\n", res);
                   6328:                return axl_false;
                   6329:        }
                   6330: 
                   6331:        res = axl_stream_printf_len ("%ld", 182);
                   6332:        if ( res != 4) {
                   6333:                printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res);
                   6334:                return axl_false;
                   6335:        }
                   6336: 
                   6337:        res = axl_stream_printf_len ("%lu", (unsigned long int) 182);
                   6338:        if ( res != 4) {
                   6339:                printf ("failed, expected to find an string value of 4, but it was found (%d)\n", res);
                   6340:                return axl_false;
                   6341:        }
                   6342: 
                   6343:        res = axl_stream_printf_len ("%6d", 182);
                   6344:        if ( res != 7) {
                   6345:                printf ("failed (%%6d), expected to find an string value of 7, but it was found (%d)\n", res);
                   6346:                return axl_false;
                   6347:        } 
                   6348: 
                   6349:        res = axl_stream_printf_len ("%f", 182.0);
                   6350:        if ( res != 11) {
                   6351:                printf ("failed (%%f,182), expected to find an string value of 11, but it was found (%d)\n", res);
                   6352:                return axl_false;
                   6353:        } 
                   6354: 
                   6355:        res = axl_stream_printf_len ("%.2f", 18228.0);
                   6356:        if ( res != 9) {
                   6357:                printf ("failed (%%.2f), expected to find an string value of 7, but it was found (%d)\n", res);
                   6358:                return axl_false;
                   6359:        } 
                   6360: 
                   6361:        res = axl_stream_printf_len ("%8.2f", 182);
                   6362:        if ( res != 9) {
                   6363:                printf ("failed (%%8.2f), expected to find an string value of 12, but it was found (%d)\n", res);
                   6364:                return axl_false;
                   6365:        } 
                   6366: 
                   6367:        res = axl_stream_printf_len ("%.5f", 182.10);
                   6368:        if ( res != 10) {
                   6369:                printf ("failed (%%.5f), expected to find an string value of 10, but it was found (%d)\n", res);
                   6370:                return axl_false;
                   6371:        } 
                   6372: 
                   6373:        res = axl_stream_printf_len ("%g", (double) 182.23);
                   6374:        if ( res != 7) {
                   6375:                printf ("failed (%%g,182.23), expected to find an string value of 7, but it was found (%d)\n", res);
                   6376:                return axl_false;
                   6377:        } 
                   6378: 
                   6379:        res = axl_stream_printf_len ("%g", 182.39);
                   6380:        if ( res != 7) {
                   6381:                printf ("failed (%%g,182.39), expected to find an string value of 7, but it was found (%d)\n", res);
                   6382:                return axl_false;
                   6383:        } 
                   6384: 
                   6385:        res = axl_stream_printf_len ("%g", 182.1);
                   6386:        if ( res != 6) {
                   6387:                printf ("failed (%%g,182.1), expected to find an string value of 6, but it was found (%d)\n", res);
                   6388:                return axl_false;
                   6389:        } 
                   6390: 
                   6391:        res = axl_stream_printf_len ("%g", 182.102);
                   6392:        if ( res != 8) {
                   6393:                printf ("failed (%%g,182.1), expected to find an string value of 6, but it was found (%d)\n", res);
                   6394:                return axl_false;
                   6395:        } 
                   6396: 
                   6397:        if (! test_01_03_vargs ("%g", 182.102)) {
                   6398:                printf ("failed to reuse vargs..\n");
                   6399:                return axl_false;
                   6400:        }
                   6401:        
                   6402: 
                   6403:        /* release the memory */
                   6404:        axl_free (string);
                   6405:        
                   6406:        /* case cmp comparisions */
                   6407:        if (! axl_stream_casecmp ("Content-Type: ", "Content-Type: ", 14)) {
                   6408:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6409:                return axl_false;
                   6410:        }
                   6411:        
                   6412:        if (! axl_stream_casecmp ("CONTENT-Type: ", "Content-Type: ", 14)) {
                   6413:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6414:                return axl_false;
                   6415:        }
                   6416: 
                   6417:        if (! axl_stream_casecmp ("CONTENT-Type: ", "Content-TYPE: ", 14)) {
                   6418:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6419:                return axl_false;
                   6420:        }
                   6421: 
                   6422:        if (! axl_stream_casecmp ("CoNtENT-type: ", "Content-TYPE: ", 14)) {
                   6423:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6424:                return axl_false;
                   6425:        }
                   6426: 
                   6427:        /* check axl_casecmp */
                   6428:        if (! axl_casecmp ("Content-Type: ", "Content-Type: ")) {
                   6429:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6430:                return axl_false;
                   6431:        }
                   6432:        
                   6433:        if (! axl_casecmp ("CONTENT-Type: ", "Content-Type: ")) {
                   6434:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6435:                return axl_false;
                   6436:        }
                   6437: 
                   6438:        if (! axl_casecmp ("CONTENT-Type: ", "Content-TYPE: ")) {
                   6439:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6440:                return axl_false;
                   6441:        }
                   6442: 
                   6443:        if (! axl_casecmp ("CoNtENT-type: ", "Content-TYPE: ")) {
                   6444:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6445:                return axl_false;
                   6446:        }
                   6447: 
                   6448:        /* check with additional content not scanned */
                   6449:        if (! axl_stream_casecmp ("Content-Type: ", "Content-Type: asdf", 14)) {
                   6450:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6451:                return axl_false;
                   6452:        }
                   6453:        
                   6454:        if (! axl_stream_casecmp ("CONTENT-Type: ", "Content-Type: asdf", 14)) {
                   6455:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6456:                return axl_false;
                   6457:        }
                   6458: 
                   6459:        if (! axl_stream_casecmp ("CONTENT-Type: ", "Content-TYPE: qwer12343", 14)) {
                   6460:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6461:                return axl_false;
                   6462:        }
                   6463: 
                   6464:        if (! axl_stream_casecmp ("CoNtENT-type: ", "Content-TYPE: 23141234", 14)) {
                   6465:                printf ("Expected to find equal comparision for case insensitive check..\n");
                   6466:                return axl_false;
                   6467:        }
                   6468: 
                   6469:        /* check axl_casecmp */
                   6470:        if (axl_casecmp ("Content-Type: ", "Content-Type: 12321")) {
                   6471:                printf ("Expected to not find equal comparision for case insensitive check..\n");
                   6472:                return axl_false;
                   6473:        }
                   6474:        
                   6475:        if (axl_casecmp ("CONTENT-Type: ", "Content-Type: awdf21")) {
                   6476:                printf ("Expected to not find equal comparision for case insensitive check..\n");
                   6477:                return axl_false;
                   6478:        }
                   6479: 
                   6480:        if (axl_casecmp ("CONTENT-Type: ", "Content-TYPE: adsfasdf")) {
                   6481:                printf ("Expected to not find equal comparision for case insensitive check..\n");
                   6482:                return axl_false;
                   6483:        }
                   6484: 
                   6485:        if (axl_casecmp ("CoNtENT-type: ", "Content-TYPE: asdf21")) {
                   6486:                printf ("Expected to not find equal comparision for case insensitive check..\n");
                   6487:                return axl_false;
                   6488:        }
                   6489: 
                   6490:        /* check remove function */
                   6491:        string = axl_strdup ("iso-8859-15");
                   6492:        axl_stream_remove (string, "-", axl_false);
                   6493:        if (! axl_cmp (string, "iso885915")) {
                   6494:                printf ("Expected %s value but found %s...\n", 
                   6495:                        string, "iso885915");
                   6496:                return axl_false;
                   6497:        } /* end if */
                   6498:        axl_free (string);
                   6499: 
                   6500:        string = axl_strdup ("iso885915");
                   6501:        axl_stream_remove (string, "-", axl_false);
                   6502:        if (! axl_cmp (string, "iso885915")) {
                   6503:                printf ("Expected %s value but found %s...\n", 
                   6504:                        string, "iso885915");
                   6505:                return axl_false;
                   6506:        } /* end if */
                   6507:        axl_free (string);
                   6508: 
                   6509:        string = axl_strdup ("--iso885915---");
                   6510:        axl_stream_remove (string, "-", axl_false);
                   6511:        if (! axl_cmp (string, "iso885915")) {
                   6512:                printf ("Expected %s value but found %s...\n", 
                   6513:                        "iso885915", string);
                   6514:                return axl_false;
                   6515:        } /* end if */
                   6516:        axl_free (string);
                   6517: 
                   6518:        string = axl_strdup_printf ("-----");
                   6519:        axl_stream_remove (string, "-", axl_false);
                   6520:        if (! axl_cmp (string, "")) {
                   6521:                printf ("Expected %s value but found %s...\n", 
                   6522:                        "", string);
                   6523:                return axl_false;
                   6524:        } /* end if */
                   6525:        axl_free (string);
                   6526: 
                   6527:        string = axl_strdup_printf ("iso-8859---------15");
                   6528:        axl_stream_remove (string, "-", axl_false);
                   6529:        if (! axl_cmp (string, "iso885915")) {
                   6530:                printf ("Expected %s value but found %s...\n", 
                   6531:                        "iso885915", string);
                   6532:                return axl_false;
                   6533:        } /* end if */
                   6534:        axl_free (string);
                   6535: 
                   6536:        string = axl_strdup_printf ("iso-8859---------15");
                   6537:        axl_stream_remove (string, "-", axl_true);
                   6538:        if (! axl_cmp (string, "iso8859---------15")) {
                   6539:                printf ("Expected %s value but found %s...\n", 
                   6540:                        "iso8859---------15", string);
                   6541:                return axl_false;
                   6542:        } /* end if */
                   6543:        axl_free (string);
                   6544: 
                   6545:        /* check printf buffer */
                   6546:        string = axl_new (char, 100);
                   6547:        string [21] = 'a';
                   6548:        res    = axl_stream_printf_buffer (string, 100, &real_size, "SEQ %d %d %d\x0D\x0A", 10, 1203020, 4096);
                   6549:        if (res  != strlen (string)) {
                   6550:                printf ("ERROR(1): expected to find string length %d but found %d..\n",
                   6551:                        res, (int) strlen (string));
                   6552:                return axl_false;
                   6553:        }
                   6554: 
                   6555:        if (res != 21) {
                   6556:                printf ("ERROR(2): expected to find string length %d but found %d..\n",
                   6557:                        res, 21);
                   6558:                return axl_false;
                   6559:        }
                   6560:        /* check string termination */
                   6561:        if (string [21] != '\0') {
                   6562:                printf ("ERROR(2.1): expected string termination at position %d..\n", 21);
                   6563:                return axl_false;
                   6564:        }
                   6565: 
                   6566:        /* check real size and returned value */
                   6567:        if (real_size != res) {
                   6568:                printf ("ERROR(2.2): expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
                   6569:                        real_size, res);
                   6570:                return axl_false;
                   6571:        }
                   6572: 
                   6573:        /* check content */
                   6574:        if (! axl_cmp (string, "SEQ 10 1203020 4096\x0D\x0A")) {
                   6575:                printf ("ERROR: expected to find '%s' but found '%s'..\n",
                   6576:                        string, "SEQ 10 1203020 4096\x0D\x0A");
                   6577:                return axl_false;
                   6578:        }
                   6579: 
                   6580:        /* check printf buffer */
                   6581:        string[70] = 'a';
                   6582:        res    = axl_stream_printf_buffer (string, 100, &real_size, "SEQ ###############################################3 %d %d %d\x0D\x0A", 10, 1203020, 4096);
                   6583:        /* printf ("Found string (size: %d, real: %d): %s..\n", res, real_size, string); */
                   6584:        
                   6585:        if (res  != strlen (string)) {
                   6586:                printf ("ERROR(3): expected to find string length %d but found %d..\n",
                   6587:                        res, (int) strlen (string));
                   6588:                return axl_false;
                   6589:        }
                   6590: 
                   6591:        if (res != 70) {
                   6592:                printf ("ERROR(4): expected to find string length %d but found %d..\n",
                   6593:                        res, 21);
                   6594:                return axl_false;
                   6595:        }
                   6596: 
                   6597:        /* check string termination */
                   6598:        if (string [70] != '\0') {
                   6599:                printf ("ERROR: expected string termination at position %d..\n", 21);
                   6600:                return axl_false;
                   6601:        }
                   6602: 
                   6603:        /* check real size and returned value */
                   6604:        if (real_size != res) {
                   6605:                printf ("ERROR: expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
                   6606:                        real_size, res);
                   6607:                return axl_false;
                   6608:        }
                   6609: 
                   6610:        /* check content */
                   6611:        if (! axl_cmp (string, "SEQ ###############################################3 10 1203020 4096\x0D\x0A")) {
                   6612:                printf ("ERROR: expected to find '%s' but found '%s'..\n",
                   6613:                        string, "SEQ ###############################################3 10 1203020 4096\x0D\x0A");
                   6614:                return axl_false;
                   6615:        }
                   6616: 
                   6617:        /* check printf buffer */
                   6618:        string[96] = 'a';
                   6619:        res    = axl_stream_printf_buffer (string, 100, &real_size, "SEQ ############################################asdfasdfasdfasdfasdfasdfas###3 %d %d %d\x0D\x0A", 10, 1203020, 4096);
                   6620:        /* printf ("Found string (size: %d, real: %d): %s..\n", res, real_size, string); */
                   6621: 
                   6622:        if (res != strlen (string)) {
                   6623:                printf ("ERROR(5): expected to find string length %d but found %d..\n", res, (int) strlen (string));
                   6624:                return axl_false;
                   6625:        }
                   6626: 
                   6627:        if (res != 96) {
                   6628:                printf ("ERROR(6): expected to find string length %d but found %d..\n", res, 96);
                   6629:                return axl_false;
                   6630:        }
                   6631: 
                   6632:        /* check string termination */
                   6633:        if (string [96] != '\0') {
                   6634:                printf ("ERROR: expected string termination at position %d..\n", 21);
                   6635:                return axl_false;
                   6636:        }
                   6637: 
                   6638:        /* check real size and returned value */
                   6639:        if (real_size != res) {
                   6640:                printf ("ERROR: expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
                   6641:                        real_size, res);
                   6642:                return axl_false;
                   6643:        }
                   6644: 
                   6645:        /* check content */
                   6646:        if (! axl_cmp (string, "SEQ ############################################asdfasdfasdfasdfasdfasdfas###3 10 1203020 4096\x0D\x0A")) {
                   6647:                printf ("ERROR: expected to find '%s' but found '%s'..\n",
                   6648:                        string, "SEQ ############################################asdfasdfasdfasdfasdfasdfas###3 10 1203020 4096\x0D\x0A");
                   6649:                return axl_false;
                   6650:        }
                   6651: 
                   6652:        /* check printf buffer */
                   6653:        string[99] = 'a';
                   6654:        res    = axl_stream_printf_buffer (string, 100, &real_size, "SEQ ###@@@#########################################asdfasdfasdfasdfasdfasdfas###3 %d %d %d\x0D\x0A", 
                   6655:                                           10, 1203020, 4096);
                   6656:        /* printf ("Found string (size: %d, real: %d): %s..\n", res, real_size, string); */
                   6657: 
                   6658:        if (res != strlen (string)) {
                   6659:                printf ("ERROR(7): expected to find string length %d but found %d (1)..\n", res, (int) strlen (string));
                   6660:                return axl_false;
                   6661:        }
                   6662: 
                   6663:        if (res != 99) {
                   6664:                printf ("ERROR(8): expected to find string length %d but found %d (2)..\n", res, 99);
                   6665:                return axl_false;
                   6666:        }
                   6667: 
                   6668:        /* check string termination */
                   6669:        if (string [99] != '\0') {
                   6670:                printf ("ERROR: expected string termination at position %d..\n", 21);
                   6671:                return axl_false;
                   6672:        }
                   6673: 
                   6674:        /* check real size and returned value */
                   6675:        if (real_size != res) {
                   6676:                printf ("ERROR: expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
                   6677:                        real_size, res);
                   6678:                return axl_false;
                   6679:        }
                   6680: 
                   6681:        /* check content */
                   6682:        if (! axl_cmp (string, "SEQ ###@@@#########################################asdfasdfasdfasdfasdfasdfas###3 10 1203020 4096\x0D\x0A")) {
                   6683:                printf ("ERROR: expected to find '%s' but found '%s'..\n",
                   6684:                        string, "SEQ ###@@@#########################################asdfasdfasdfasdfasdfasdfas###3 10 1203020 4096\x0D\x0A");
                   6685:                return axl_false;
                   6686:        }
                   6687: 
                   6688:        /* check printf buffer (out of space situation) */
                   6689:        string[99] = 'a';
                   6690:        res    = axl_stream_printf_buffer (string, 100, &real_size, 
                   6691:                                           "SEQ ###@@@##fffasdklfjasdlfkjasdlfkjadf#######################################asdfasdfasdfasdfasdfasdfas###3 %d %d %d\x0D\x0A", 
                   6692:                                           10, 1203020, 4096);
                   6693:        /* printf ("Found string (size: %d, real: %d): %s..\n", res, real_size, string);  */
                   6694: 
                   6695:        if (res != strlen (string)) {
                   6696:                printf ("ERROR(9): expected to find string length %d but found %d (1)..\n", res, (int) strlen (string));
                   6697:                return axl_false;
                   6698:        }
                   6699: 
                   6700:        if (res != 99) {
                   6701:                printf ("ERROR(10): expected to find string length %d but found %d (2)..\n", res, 99);
                   6702:                return axl_false;
                   6703:        }
                   6704: 
                   6705:        /* check string termination */
                   6706:        if (string [99] != '\0') {
                   6707:                printf ("ERROR: expected string termination at position %d..\n", 21);
                   6708:                return axl_false;
                   6709:        }
                   6710: 
                   6711:        /* check real size and returned value */
                   6712:        if (real_size != 126) {
                   6713:                printf ("ERROR: expected to find same value returned as real size (%d != %d) but it wasn't found..\n",
                   6714:                        real_size, 126);
                   6715:                return axl_false;
                   6716:        }
                   6717: 
                   6718:        /* check content */
                   6719:        if (! axl_cmp (string, "SEQ ###@@@##fffasdklfjasdlfkjasdlfkjadf#######################################asdfasdfasdfasdfasdfa")) {
                   6720:                printf ("ERROR: expected to find '%s' but found '%s'..\n",
                   6721:                        string, "SEQ ###@@@##fffasdklfjasdlfkjasdlfkjadf#######################################asdfasdfasdfasdfasdfa");
                   6722:                return axl_false;
                   6723:        }
                   6724: 
                   6725:        axl_free (string);
                   6726: 
                   6727: 
                   6728:        return axl_true;
                   6729: }
                   6730: 
                   6731: /** 
                   6732:  * @brief Intensive axl list implementation.
                   6733:  */
                   6734: axl_bool test_01_04 () {
                   6735:        int             iterator = 0;
                   6736:        int             value;
                   6737:        axlList       * list;
                   6738:        axlListCursor * cursor;
                   6739: 
                   6740:        /* create the list */
                   6741:        list = axl_list_new (axl_list_always_return_1, NULL);
                   6742: 
                   6743:        /* add items */
                   6744:        while (iterator < 10000) {
                   6745: 
                   6746:                /* add integers */
                   6747:                axl_list_add (list, INT_TO_PTR(iterator));
                   6748: 
                   6749:                /* update the iterator */
                   6750:                iterator++;
                   6751:        }
                   6752: 
                   6753:        /* get items using iterator */
                   6754:        cursor   = axl_list_cursor_new (list);
                   6755:        iterator = 0;
                   6756:        while (axl_list_cursor_has_item (cursor)) {
                   6757:                /* get the value */
                   6758:                value = PTR_TO_INT (axl_list_cursor_get (cursor));
                   6759: 
                   6760:                /* check value */
                   6761:                if (value != iterator) {
                   6762:                        printf ("Values miss match: %d != %d\n", value, iterator);
                   6763:                        return axl_false;
                   6764:                }
                   6765: 
                   6766:                /* get the next */
                   6767:                axl_list_cursor_next (cursor);
                   6768: 
                   6769:                /* update the iterator */
                   6770:                iterator++;
                   6771:                
                   6772:        } /* end while */
                   6773: 
                   6774:        /* remove all items */
                   6775:        axl_list_cursor_first (cursor);
                   6776:        iterator = 0;
                   6777:        while (axl_list_cursor_has_item (cursor)) {
                   6778: 
                   6779:                /* get the value */
                   6780:                value = PTR_TO_INT (axl_list_cursor_get (cursor));
                   6781: 
                   6782:                /* check value */
                   6783:                if (value != iterator) {
                   6784:                        printf ("Values miss match (2): %d != %d\n", value, iterator);
                   6785:                        return axl_false;
                   6786:                }
                   6787: 
                   6788:                /* remove */
                   6789:                axl_list_cursor_remove (cursor);
                   6790: 
                   6791:                if (axl_list_length (list) > 1) {
                   6792: 
                   6793:                        /* get the value */
                   6794:                        value = PTR_TO_INT (axl_list_cursor_get (cursor));
                   6795:                        
                   6796:                        /* check value */
                   6797:                        if (value != (iterator + 1)) {
                   6798:                                printf ("Values miss match (3): %d != %d\n", value, iterator + 1);
                   6799:                                return axl_false;
                   6800:                        }
                   6801:                }
                   6802: 
                   6803:                /* update the iterator */
                   6804:                iterator++;
                   6805:                
                   6806:        } /* end while */
                   6807: 
                   6808:        if (axl_list_length (list) != 0) {
                   6809:                printf ("List lengths mismatch: %d != 0\n", axl_list_length (list));
                   6810:                return axl_false;
                   6811:        }
                   6812: 
                   6813:        /* free cursor */
                   6814:        axl_list_cursor_free (cursor);
                   6815: 
                   6816:        /* release the list */
                   6817:        axl_list_free (list);
                   6818:        
                   6819:        /* axl_true */
                   6820:        return axl_true;
                   6821: }
                   6822: 
                   6823: /** 
                   6824:  * @brief Check axl list remove at API.
                   6825:  */
                   6826: axl_bool test_01_04_a () {
                   6827:        axlList       * list;
                   6828:        char          * value;
                   6829:        char          * value2;
                   6830:        char          * value3;
                   6831: 
                   6832:        /* create the list */
                   6833:        list = axl_list_new (axl_list_equal_string, axl_free);
                   6834: 
                   6835:        /* add tree items */
                   6836:        axl_list_add (list, axl_strdup ("this is a test 1"));
                   6837:        axl_list_add (list, axl_strdup ("this is a test 2"));
                   6838:        axl_list_add (list, axl_strdup ("this is a test 3"));
                   6839: 
                   6840:        /* remove second position */
                   6841:        axl_list_remove_at (list, 1);
                   6842:        if (axl_list_length (list) != 2) {
                   6843:                printf ("ERROR: Expected to find two items in a list after removal operation..");
                   6844:                return axl_false;
                   6845:        } /* end if */
                   6846: 
                   6847:        /* check content */
                   6848:        if (! axl_cmp ("this is a test 1", axl_list_get_nth (list, 0))) {
                   6849:                printf ("ERROR: Expected to find item '%s' but found '%s'\n",
                   6850:                        "this is a test 1", (char*) axl_list_get_nth (list, 0));
                   6851:                return axl_false;
                   6852:        } /* end if */
                   6853: 
                   6854:        /* now remove first position */
                   6855:        axl_list_remove_at (list, 0);
                   6856:        if (axl_list_length (list) != 1) {
                   6857:                printf ("ERROR: Expected to find one item in a list after removal operation..");
                   6858:                return axl_false;
                   6859:        } /* end if */
                   6860: 
                   6861:        /* check content */
                   6862:        if (! axl_cmp ("this is a test 3", axl_list_get_nth (list, 0))) {
                   6863:                printf ("ERROR: Expected to find item '%s' but found '%s'\n",
                   6864:                        "this is a test 1", (char*) axl_list_get_nth (list, 0));
                   6865:                return axl_false;
                   6866:        } /* end if */
                   6867: 
                   6868:        /* now remove first position */
                   6869:        axl_list_remove_at (list, 0);
                   6870:        if (axl_list_length (list) != 0) {
                   6871:                printf ("ERROR: Expected to find no item in a list after removal operation..");
                   6872:                return axl_false;
                   6873:        } /* end if */
                   6874: 
                   6875:        axl_list_free (list);
                   6876: 
                   6877:        /* now test unlink_at */
                   6878:        value  = axl_strdup ("Funky string");
                   6879:        value2 = axl_strdup ("Funky string 2");
                   6880:        value3 = axl_strdup ("Funky string 3");
                   6881: 
                   6882:        /* check axl_list_equal_string */
                   6883:        if (axl_list_equal_string (value, value2) == 0) {
                   6884:                printf ("ERROR: Expected to find different strings, but reported equal for '%s' == '%s'\n",
                   6885:                        value, value2);
                   6886:                return axl_false;
                   6887:        }
                   6888:        
                   6889:        /* create the list */
                   6890:        list = axl_list_new (axl_list_equal_string, axl_free);
                   6891: 
                   6892:        /* add items */
                   6893:        axl_list_add (list, value);
                   6894:        if (axl_list_length (list) != 1) {
                   6895:                printf ("ERROR: Expected to find a list with one item but found: %d\n", axl_list_length (list));
                   6896:                return axl_false;
                   6897:        }
                   6898:        axl_list_add (list, value2);
                   6899:        if (axl_list_length (list) != 2) {
                   6900:                printf ("ERROR: Expected to find a list with two item but found: %d\n", axl_list_length (list));
                   6901:                return axl_false;
                   6902:        }
                   6903:        axl_list_add (list, value3);
                   6904:        if (axl_list_length (list) != 3) {
                   6905:                printf ("ERROR: Expected to find a list with three item but found: %d\n", axl_list_length (list));
                   6906:                return axl_false;
                   6907:        }
                   6908: 
                   6909:        /* unlink items */
                   6910:        axl_list_unlink_at (list, 1);
                   6911:        if (axl_list_length (list) != 2) {
                   6912:                printf ("ERROR: Expected to find two items in a list after removal operation but found:..%d\n", axl_list_length (list));
                   6913:                return axl_false;
                   6914:        } /* end if */
                   6915: 
                   6916:        /* check content */
                   6917:        if (! axl_cmp ("Funky string", axl_list_get_nth (list, 0))) {
                   6918:                printf ("ERROR: Expected to find item '%s' but found '%s'\n",
                   6919:                        "Funky string", (char*) axl_list_get_nth (list, 0));
                   6920:                return axl_false;
                   6921:        } /* end if */
                   6922: 
                   6923:        /* now remove first position */
                   6924:        axl_list_unlink_at (list, 0);
                   6925:        if (axl_list_length (list) != 1) {
                   6926:                printf ("ERROR: Expected to find one item in a list after removal operation..");
                   6927:                return axl_false;
                   6928:        } /* end if */
                   6929: 
                   6930:        /* check content */
                   6931:        if (! axl_cmp ("Funky string 3", axl_list_get_nth (list, 0))) {
                   6932:                printf ("ERROR: Expected to find item '%s' but found '%s'\n",
                   6933:                        "Funky string 3", (char*) axl_list_get_nth (list, 0));
                   6934:                return axl_false;
                   6935:        } /* end if */
                   6936: 
                   6937:        /* now remove first position */
                   6938:        axl_list_unlink_at (list, 0);
                   6939:        if (axl_list_length (list) != 0) {
                   6940:                printf ("ERROR: Expected to find no item in a list after removal operation..");
                   6941:                return axl_false;
                   6942:        } /* end if */
                   6943: 
                   6944:        axl_list_free (list);
                   6945: 
                   6946:        /* now remove strings */
                   6947:        axl_free (value);
                   6948:        axl_free (value2);
                   6949:        axl_free (value3);
                   6950: 
                   6951:        return axl_true;
                   6952: }
                   6953: 
                   6954: /** 
                   6955:  * @brief Checks error reporting functions.
                   6956:  * 
                   6957:  * 
                   6958:  * @return \ref axl_true if ok, \ref axl_false on rainy days.
                   6959:  */
                   6960: axl_bool test_01_05 () 
                   6961: {
                   6962:        axlError * error = NULL;
                   6963: 
                   6964:        if (! axl_error_was_ok (error)) {
                   6965:                printf ("Error: expected to find ok on a non-initialized error\n");
                   6966:                return axl_false;
                   6967:        }
                   6968: 
                   6969:        axl_error_new (-1, "An error to report", NULL, &error);
                   6970: 
                   6971:        if (axl_error_was_ok (error)) {
                   6972:                printf ("Error: expected to find error reported on an initialized error\n");
                   6973:                return axl_false;
                   6974:        }
                   6975: 
                   6976:        axl_error_free (error);
                   6977: 
                   6978:        return axl_true;
                   6979: }
                   6980: 
                   6981: int lookups = 0;
                   6982: 
                   6983: void test_02_02_check_key (axlHash * hash, char * key)
                   6984: {
                   6985:        char * value = axl_hash_get (hash, key);        
                   6986:        
                   6987:        if (! axl_cmp (value, key)) {
                   6988:                printf ("ERROR: unable to find %s value, found %s in the hash!!!\n", key, value);
                   6989:                exit (-1);
                   6990:        }
                   6991: 
                   6992:        lookups++;
                   6993: 
                   6994:        return;
                   6995: }
                   6996: 
                   6997: /** 
                   6998:  * @brief Test current libaxl hash implementation.
                   6999:  *
                   7000:  * @return axl_true if it works properly or axl_false if not.
                   7001:  */
                   7002: axl_bool test_02_02 () 
                   7003: {
                   7004:        axlHash     * hash;
                   7005:        int           iterator;
                   7006:        const char  * value;
                   7007: 
                   7008:        /* create the hash */
                   7009:        hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
                   7010:        
                   7011:        /* insert data */
                   7012:        axl_hash_insert (hash, "sword", "sword"); 
                   7013:        axl_hash_insert (hash, "mace", "mace");
                   7014:        axl_hash_insert (hash, "axe", "axe");
                   7015:        axl_hash_insert (hash, "arrow", "arrow");
                   7016:        axl_hash_insert (hash, "shield", "shield");
                   7017:        axl_hash_insert (hash, "bag", "bag");
                   7018:        axl_hash_insert (hash, "stone", "stone");
                   7019:        axl_hash_insert (hash, "key", "key");
                   7020:        axl_hash_insert (hash, "skull", "skull");
                   7021:        axl_hash_insert (hash, "jar", "jar");
                   7022:        axl_hash_insert (hash, "bottle", "bottle");
                   7023:        axl_hash_insert (hash, "fairy", "fairy");
                   7024:        axl_hash_insert (hash, "potion", "potion");
                   7025:        axl_hash_insert (hash, "water", "water");
                   7026:        axl_hash_insert (hash, "spoon", "spoon");
                   7027:        axl_hash_insert (hash, "book", "book");
                   7028:        axl_hash_insert (hash, "spear", "spear");
                   7029:        axl_hash_insert (hash, "dagger", "dagger");
                   7030:        axl_hash_insert (hash, "katana", "katana");
                   7031:        axl_hash_insert (hash, "helmet", "helmet");
                   7032:        axl_hash_insert (hash, "chain", "chain");
                   7033:        axl_hash_insert (hash, "halberd", "halberd");
                   7034:        axl_hash_insert (hash, "pipe", "pipe");
                   7035:        axl_hash_insert (hash, "hat", "hat");
                   7036:        axl_hash_insert (hash, "eyeofnewt", "eyeofnewt");
                   7037:        axl_hash_insert (hash, "soup", "soup");
                   7038:        axl_hash_insert (hash, "wolfbane", "wolfbane");
                   7039:        axl_hash_insert (hash, "instantcoffee", "instantcoffee");
                   7040:        axl_hash_insert (hash, "bugspray", "bugspray");
                   7041:        axl_hash_insert (hash, "flint", "flint");
                   7042:        axl_hash_insert (hash, "soap", "soap");
                   7043:        axl_hash_insert (hash, "bones", "bones");
                   7044:        axl_hash_insert (hash, "orb", "orb");
                   7045:        axl_hash_insert (hash, "gold", "gold");
                   7046:        axl_hash_insert (hash, "silver", "silver");
                   7047:        axl_hash_insert (hash, "wine", "wine");
                   7048:        axl_hash_insert (hash, "bread", "bread");
                   7049: 
                   7050:        axl_hash_insert (hash, "sword01", "sword01"); 
                   7051:        axl_hash_insert (hash, "mace01", "mace01");
                   7052:        axl_hash_insert (hash, "axe01", "axe01");
                   7053:        axl_hash_insert (hash, "arrow01", "arrow01");
                   7054:        axl_hash_insert (hash, "shield01", "shield01");
                   7055:        axl_hash_insert (hash, "bag01", "bag01");
                   7056:        axl_hash_insert (hash, "stone01", "stone01");
                   7057:        axl_hash_insert (hash, "key01", "key01");
                   7058:        axl_hash_insert (hash, "skull01", "skull01");
                   7059:        axl_hash_insert (hash, "jar01", "jar01");
                   7060:        axl_hash_insert (hash, "bottle01", "bottle01");
                   7061:        axl_hash_insert (hash, "fairy01", "fairy01");
                   7062:        axl_hash_insert (hash, "potion01", "potion01");
                   7063:        axl_hash_insert (hash, "water01", "water01");
                   7064:        axl_hash_insert (hash, "spoon01", "spoon01");
                   7065:        axl_hash_insert (hash, "book01", "book01");
                   7066:        axl_hash_insert (hash, "spear01", "spear01");
                   7067:        axl_hash_insert (hash, "dagger01", "dagger01");
                   7068:        axl_hash_insert (hash, "katana01", "katana01");
                   7069:        axl_hash_insert (hash, "helmet01", "helmet01");
                   7070:        axl_hash_insert (hash, "chain01", "chain01");
                   7071:        axl_hash_insert (hash, "halberd01", "halberd01");
                   7072:        axl_hash_insert (hash, "pipe01", "pipe01");
                   7073:        axl_hash_insert (hash, "hat01", "hat01");
                   7074:        axl_hash_insert (hash, "eyeofnewt01", "eyeofnewt01");
                   7075:        axl_hash_insert (hash, "soup01", "soup01");
                   7076:        axl_hash_insert (hash, "wolfbane01", "wolfbane01");
                   7077:        axl_hash_insert (hash, "instantcoffee01", "instantcoffee01");
                   7078:        axl_hash_insert (hash, "bugspray01", "bugspray01");
                   7079:        axl_hash_insert (hash, "flint01", "flint01");
                   7080:        axl_hash_insert (hash, "soap01", "soap01");
                   7081:        axl_hash_insert (hash, "bones01", "bones01");
                   7082:        axl_hash_insert (hash, "orb01", "orb01");
                   7083:        axl_hash_insert (hash, "gold01", "gold01");
                   7084:        axl_hash_insert (hash, "silver01", "silver01");
                   7085:        axl_hash_insert (hash, "wine01", "wine01");
                   7086:        axl_hash_insert (hash, "bread01", "bread01");
                   7087: 
                   7088:        axl_hash_insert (hash, "sword02", "sword02"); 
                   7089:        axl_hash_insert (hash, "mace02", "mace02");
                   7090:        axl_hash_insert (hash, "axe02", "axe02");
                   7091:        axl_hash_insert (hash, "arrow02", "arrow02");
                   7092:        axl_hash_insert (hash, "shield02", "shield02");
                   7093:        axl_hash_insert (hash, "bag02", "bag02");
                   7094:        axl_hash_insert (hash, "stone02", "stone02");
                   7095:        axl_hash_insert (hash, "key02", "key02");
                   7096:        axl_hash_insert (hash, "skull02", "skull02");
                   7097:        axl_hash_insert (hash, "jar02", "jar02");
                   7098:        axl_hash_insert (hash, "bottle02", "bottle02");
                   7099:        axl_hash_insert (hash, "fairy02", "fairy02");
                   7100:        axl_hash_insert (hash, "potion02", "potion02");
                   7101:        axl_hash_insert (hash, "water02", "water02");
                   7102:        axl_hash_insert (hash, "spoon02", "spoon02");
                   7103:        axl_hash_insert (hash, "book02", "book02");
                   7104:        axl_hash_insert (hash, "spear02", "spear02");
                   7105:        axl_hash_insert (hash, "dagger02", "dagger02");
                   7106:        axl_hash_insert (hash, "katana02", "katana02");
                   7107:        axl_hash_insert (hash, "helmet02", "helmet02");
                   7108:        axl_hash_insert (hash, "chain02", "chain02");
                   7109:        axl_hash_insert (hash, "halberd02", "halberd02");
                   7110:        axl_hash_insert (hash, "pipe02", "pipe02");
                   7111:        axl_hash_insert (hash, "hat02", "hat02");
                   7112:        axl_hash_insert (hash, "eyeofnewt02", "eyeofnewt02");
                   7113:        axl_hash_insert (hash, "soup02", "soup02");
                   7114:        axl_hash_insert (hash, "wolfbane02", "wolfbane02");
                   7115:        axl_hash_insert (hash, "instantcoffee02", "instantcoffee02");
                   7116:        axl_hash_insert (hash, "bugspray02", "bugspray02");
                   7117:        axl_hash_insert (hash, "flint02", "flint02");
                   7118:        axl_hash_insert (hash, "soap02", "soap02");
                   7119:        axl_hash_insert (hash, "bones02", "bones02");
                   7120:        axl_hash_insert (hash, "orb02", "orb02");
                   7121:        axl_hash_insert (hash, "gold02", "gold02");
                   7122:        axl_hash_insert (hash, "silver02", "silver02");
                   7123:        axl_hash_insert (hash, "wine02", "wine02");
                   7124:        axl_hash_insert (hash, "bread02", "bread02");
                   7125: 
                   7126:        axl_hash_insert (hash, "sword03", "sword03"); 
                   7127:        axl_hash_insert (hash, "mace03", "mace03");
                   7128:        axl_hash_insert (hash, "axe03", "axe03");
                   7129:        axl_hash_insert (hash, "arrow03", "arrow03");
                   7130:        axl_hash_insert (hash, "shield03", "shield03");
                   7131:        axl_hash_insert (hash, "bag03", "bag03");
                   7132:        axl_hash_insert (hash, "stone03", "stone03");
                   7133:        axl_hash_insert (hash, "key03", "key03");
                   7134:        axl_hash_insert (hash, "skull03", "skull03");
                   7135:        axl_hash_insert (hash, "jar03", "jar03");
                   7136:        axl_hash_insert (hash, "bottle03", "bottle03");
                   7137:        axl_hash_insert (hash, "fairy03", "fairy03");
                   7138:        axl_hash_insert (hash, "potion03", "potion03");
                   7139:        axl_hash_insert (hash, "water03", "water03");
                   7140:        axl_hash_insert (hash, "spoon03", "spoon03");
                   7141:        axl_hash_insert (hash, "book03", "book03");
                   7142:        axl_hash_insert (hash, "spear03", "spear03");
                   7143:        axl_hash_insert (hash, "dagger03", "dagger03");
                   7144:        axl_hash_insert (hash, "katana03", "katana03");
                   7145:        axl_hash_insert (hash, "helmet03", "helmet03");
                   7146:        axl_hash_insert (hash, "chain03", "chain03");
                   7147:        axl_hash_insert (hash, "halberd03", "halberd03");
                   7148:        axl_hash_insert (hash, "pipe03", "pipe03");
                   7149:        axl_hash_insert (hash, "hat03", "hat03");
                   7150:        axl_hash_insert (hash, "eyeofnewt03", "eyeofnewt03");
                   7151:        axl_hash_insert (hash, "soup03", "soup03");
                   7152:        axl_hash_insert (hash, "wolfbane03", "wolfbane03");
                   7153:        axl_hash_insert (hash, "instantcoffee03", "instantcoffee03");
                   7154:        axl_hash_insert (hash, "bugspray03", "bugspray03");
                   7155:        axl_hash_insert (hash, "flint03", "flint03");
                   7156:        axl_hash_insert (hash, "soap03", "soap03");
                   7157:        axl_hash_insert (hash, "bones03", "bones03");
                   7158:        axl_hash_insert (hash, "orb03", "orb03");
                   7159:        axl_hash_insert (hash, "gold03", "gold03");
                   7160:        axl_hash_insert (hash, "silver03", "silver03");
                   7161:        axl_hash_insert (hash, "wine03", "wine03");
                   7162:        axl_hash_insert (hash, "bread03", "bread03");
                   7163: 
                   7164:        axl_hash_insert (hash, "sword04", "sword04"); 
                   7165:        axl_hash_insert (hash, "mace04", "mace04");
                   7166:        axl_hash_insert (hash, "axe04", "axe04");
                   7167:        axl_hash_insert (hash, "arrow04", "arrow04");
                   7168:        axl_hash_insert (hash, "shield04", "shield04");
                   7169:        axl_hash_insert (hash, "bag04", "bag04");
                   7170:        axl_hash_insert (hash, "stone04", "stone04");
                   7171:        axl_hash_insert (hash, "key04", "key04");
                   7172:        axl_hash_insert (hash, "skull04", "skull04");
                   7173:        axl_hash_insert (hash, "jar04", "jar04");
                   7174:        axl_hash_insert (hash, "bottle04", "bottle04");
                   7175:        axl_hash_insert (hash, "fairy04", "fairy04");
                   7176:        axl_hash_insert (hash, "potion04", "potion04");
                   7177:        axl_hash_insert (hash, "water04", "water04");
                   7178:        axl_hash_insert (hash, "spoon04", "spoon04");
                   7179:        axl_hash_insert (hash, "book04", "book04");
                   7180:        axl_hash_insert (hash, "spear04", "spear04");
                   7181:        axl_hash_insert (hash, "dagger04", "dagger04");
                   7182:        axl_hash_insert (hash, "katana04", "katana04");
                   7183:        axl_hash_insert (hash, "helmet04", "helmet04");
                   7184:        axl_hash_insert (hash, "chain04", "chain04");
                   7185:        axl_hash_insert (hash, "halberd04", "halberd04");
                   7186:        axl_hash_insert (hash, "pipe04", "pipe04");
                   7187:        axl_hash_insert (hash, "hat04", "hat04");
                   7188:        axl_hash_insert (hash, "eyeofnewt04", "eyeofnewt04");
                   7189:        axl_hash_insert (hash, "soup04", "soup04");
                   7190:        axl_hash_insert (hash, "wolfbane04", "wolfbane04");
                   7191:        axl_hash_insert (hash, "instantcoffee04", "instantcoffee04");
                   7192:        axl_hash_insert (hash, "bugspray04", "bugspray04");
                   7193:        axl_hash_insert (hash, "flint04", "flint04");
                   7194:        axl_hash_insert (hash, "soap04", "soap04");
                   7195:        axl_hash_insert (hash, "bones04", "bones04");
                   7196:        axl_hash_insert (hash, "orb04", "orb04");
                   7197:        axl_hash_insert (hash, "gold04", "gold04");
                   7198:        axl_hash_insert (hash, "silver04", "silver04");
                   7199:        axl_hash_insert (hash, "wine04", "wine04");
                   7200:        axl_hash_insert (hash, "bread04", "bread04");
                   7201: 
                   7202:        axl_hash_insert (hash, "sword05", "sword05"); 
                   7203:        axl_hash_insert (hash, "mace05", "mace05");
                   7204:        axl_hash_insert (hash, "axe05", "axe05");
                   7205:        axl_hash_insert (hash, "arrow05", "arrow05");
                   7206:        axl_hash_insert (hash, "shield05", "shield05");
                   7207:        axl_hash_insert (hash, "bag05", "bag05");
                   7208:        axl_hash_insert (hash, "stone05", "stone05");
                   7209:        axl_hash_insert (hash, "key05", "key05");
                   7210:        axl_hash_insert (hash, "skull05", "skull05");
                   7211:        axl_hash_insert (hash, "jar05", "jar05");
                   7212:        axl_hash_insert (hash, "bottle05", "bottle05");
                   7213:        axl_hash_insert (hash, "fairy05", "fairy05");
                   7214:        axl_hash_insert (hash, "potion05", "potion05");
                   7215:        axl_hash_insert (hash, "water05", "water05");
                   7216:        axl_hash_insert (hash, "spoon05", "spoon05");
                   7217:        axl_hash_insert (hash, "book05", "book05");
                   7218:        axl_hash_insert (hash, "spear05", "spear05");
                   7219:        axl_hash_insert (hash, "dagger05", "dagger05");
                   7220:        axl_hash_insert (hash, "katana05", "katana05");
                   7221:        axl_hash_insert (hash, "helmet05", "helmet05");
                   7222:        axl_hash_insert (hash, "chain05", "chain05");
                   7223:        axl_hash_insert (hash, "halberd05", "halberd05");
                   7224:        axl_hash_insert (hash, "pipe05", "pipe05");
                   7225:        axl_hash_insert (hash, "hat05", "hat05");
                   7226:        axl_hash_insert (hash, "eyeofnewt05", "eyeofnewt05");
                   7227:        axl_hash_insert (hash, "soup05", "soup05");
                   7228:        axl_hash_insert (hash, "wolfbane05", "wolfbane05");
                   7229:        axl_hash_insert (hash, "instantcoffee05", "instantcoffee05");
                   7230:        axl_hash_insert (hash, "bugspray05", "bugspray05");
                   7231:        axl_hash_insert (hash, "flint05", "flint05");
                   7232:        axl_hash_insert (hash, "soap05", "soap05");
                   7233:        axl_hash_insert (hash, "bones05", "bones05");
                   7234:        axl_hash_insert (hash, "orb05", "orb05");
                   7235:        axl_hash_insert (hash, "gold05", "gold05");
                   7236:        axl_hash_insert (hash, "silver05", "silver05");
                   7237:        axl_hash_insert (hash, "wine05", "wine05");
                   7238:        axl_hash_insert (hash, "bread05", "bread05");
                   7239: 
                   7240:        axl_hash_insert (hash, "sword06", "sword06"); 
                   7241:        axl_hash_insert (hash, "mace06", "mace06");
                   7242:        axl_hash_insert (hash, "axe06", "axe06");
                   7243:        axl_hash_insert (hash, "arrow06", "arrow06");
                   7244:        axl_hash_insert (hash, "shield06", "shield06");
                   7245:        axl_hash_insert (hash, "bag06", "bag06");
                   7246:        axl_hash_insert (hash, "stone06", "stone06");
                   7247:        axl_hash_insert (hash, "key06", "key06");
                   7248:        axl_hash_insert (hash, "skull06", "skull06");
                   7249:        axl_hash_insert (hash, "jar06", "jar06");
                   7250:        axl_hash_insert (hash, "bottle06", "bottle06");
                   7251:        axl_hash_insert (hash, "fairy06", "fairy06");
                   7252:        axl_hash_insert (hash, "potion06", "potion06");
                   7253:        axl_hash_insert (hash, "water06", "water06");
                   7254:        axl_hash_insert (hash, "spoon06", "spoon06");
                   7255:        axl_hash_insert (hash, "book06", "book06");
                   7256:        axl_hash_insert (hash, "spear06", "spear06");
                   7257:        axl_hash_insert (hash, "dagger06", "dagger06");
                   7258:        axl_hash_insert (hash, "katana06", "katana06");
                   7259:        axl_hash_insert (hash, "helmet06", "helmet06");
                   7260:        axl_hash_insert (hash, "chain06", "chain06");
                   7261:        axl_hash_insert (hash, "halberd06", "halberd06");
                   7262:        axl_hash_insert (hash, "pipe06", "pipe06");
                   7263:        axl_hash_insert (hash, "hat06", "hat06");
                   7264:        axl_hash_insert (hash, "eyeofnewt06", "eyeofnewt06");
                   7265:        axl_hash_insert (hash, "soup06", "soup06");
                   7266:        axl_hash_insert (hash, "wolfbane06", "wolfbane06");
                   7267:        axl_hash_insert (hash, "instantcoffee06", "instantcoffee06");
                   7268:        axl_hash_insert (hash, "bugspray06", "bugspray06");
                   7269:        axl_hash_insert (hash, "flint06", "flint06");
                   7270:        axl_hash_insert (hash, "soap06", "soap06");
                   7271:        axl_hash_insert (hash, "bones06", "bones06");
                   7272:        axl_hash_insert (hash, "orb06", "orb06");
                   7273:        axl_hash_insert (hash, "gold06", "gold06");
                   7274:        axl_hash_insert (hash, "silver06", "silver06");
                   7275:        axl_hash_insert (hash, "wine06", "wine06");
                   7276:        axl_hash_insert (hash, "bread06", "bread06");
                   7277: 
                   7278:        axl_hash_insert (hash, "sword07", "sword07"); 
                   7279:        axl_hash_insert (hash, "mace07", "mace07");
                   7280:        axl_hash_insert (hash, "axe07", "axe07");
                   7281:        axl_hash_insert (hash, "arrow07", "arrow07");
                   7282:        axl_hash_insert (hash, "shield07", "shield07");
                   7283:        axl_hash_insert (hash, "bag07", "bag07");
                   7284:        axl_hash_insert (hash, "stone07", "stone07");
                   7285:        axl_hash_insert (hash, "key07", "key07");
                   7286:        axl_hash_insert (hash, "skull07", "skull07");
                   7287:        axl_hash_insert (hash, "jar07", "jar07");
                   7288:        axl_hash_insert (hash, "bottle07", "bottle07");
                   7289:        axl_hash_insert (hash, "fairy07", "fairy07");
                   7290:        axl_hash_insert (hash, "potion07", "potion07");
                   7291:        axl_hash_insert (hash, "water07", "water07");
                   7292:        axl_hash_insert (hash, "spoon07", "spoon07");
                   7293:        axl_hash_insert (hash, "book07", "book07");
                   7294:        axl_hash_insert (hash, "spear07", "spear07");
                   7295:        axl_hash_insert (hash, "dagger07", "dagger07");
                   7296:        axl_hash_insert (hash, "katana07", "katana07");
                   7297:        axl_hash_insert (hash, "helmet07", "helmet07");
                   7298:        axl_hash_insert (hash, "chain07", "chain07");
                   7299:        axl_hash_insert (hash, "halberd07", "halberd07");
                   7300:        axl_hash_insert (hash, "pipe07", "pipe07");
                   7301:        axl_hash_insert (hash, "hat07", "hat07");
                   7302:        axl_hash_insert (hash, "eyeofnewt07", "eyeofnewt07");
                   7303:        axl_hash_insert (hash, "soup07", "soup07");
                   7304:        axl_hash_insert (hash, "wolfbane07", "wolfbane07");
                   7305:        axl_hash_insert (hash, "instantcoffee07", "instantcoffee07");
                   7306:        axl_hash_insert (hash, "bugspray07", "bugspray07");
                   7307:        axl_hash_insert (hash, "flint07", "flint07");
                   7308:        axl_hash_insert (hash, "soap07", "soap07");
                   7309:        axl_hash_insert (hash, "bones07", "bones07");
                   7310:        axl_hash_insert (hash, "orb07", "orb07");
                   7311:        axl_hash_insert (hash, "gold07", "gold07");
                   7312:        axl_hash_insert (hash, "silver07", "silver07");
                   7313:        axl_hash_insert (hash, "wine07", "wine07");
                   7314:        axl_hash_insert (hash, "bread07", "bread07");
                   7315: 
                   7316:        axl_hash_insert (hash, "sword08", "sword08"); 
                   7317:        axl_hash_insert (hash, "mace08", "mace08");
                   7318:        axl_hash_insert (hash, "axe08", "axe08");
                   7319:        axl_hash_insert (hash, "arrow08", "arrow08");
                   7320:        axl_hash_insert (hash, "shield08", "shield08");
                   7321:        axl_hash_insert (hash, "bag08", "bag08");
                   7322:        axl_hash_insert (hash, "stone08", "stone08");
                   7323:        axl_hash_insert (hash, "key08", "key08");
                   7324:        axl_hash_insert (hash, "skull08", "skull08");
                   7325:        axl_hash_insert (hash, "jar08", "jar08");
                   7326:        axl_hash_insert (hash, "bottle08", "bottle08");
                   7327:        axl_hash_insert (hash, "fairy08", "fairy08");
                   7328:        axl_hash_insert (hash, "potion08", "potion08");
                   7329:        axl_hash_insert (hash, "water08", "water08");
                   7330:        axl_hash_insert (hash, "spoon08", "spoon08");
                   7331:        axl_hash_insert (hash, "book08", "book08");
                   7332:        axl_hash_insert (hash, "spear08", "spear08");
                   7333:        axl_hash_insert (hash, "dagger08", "dagger08");
                   7334:        axl_hash_insert (hash, "katana08", "katana08");
                   7335:        axl_hash_insert (hash, "helmet08", "helmet08");
                   7336:        axl_hash_insert (hash, "chain08", "chain08");
                   7337:        axl_hash_insert (hash, "halberd08", "halberd08");
                   7338:        axl_hash_insert (hash, "pipe08", "pipe08");
                   7339:        axl_hash_insert (hash, "hat08", "hat08");
                   7340:        axl_hash_insert (hash, "eyeofnewt08", "eyeofnewt08");
                   7341:        axl_hash_insert (hash, "soup08", "soup08");
                   7342:        axl_hash_insert (hash, "wolfbane08", "wolfbane08");
                   7343:        axl_hash_insert (hash, "instantcoffee08", "instantcoffee08");
                   7344:        axl_hash_insert (hash, "bugspray08", "bugspray08");
                   7345:        axl_hash_insert (hash, "flint08", "flint08");
                   7346:        axl_hash_insert (hash, "soap08", "soap08");
                   7347:        axl_hash_insert (hash, "bones08", "bones08");
                   7348:        axl_hash_insert (hash, "orb08", "orb08");
                   7349:        axl_hash_insert (hash, "gold08", "gold08");
                   7350:        axl_hash_insert (hash, "silver08", "silver08");
                   7351:        axl_hash_insert (hash, "wine08", "wine08");
                   7352:        axl_hash_insert (hash, "bread08", "bread08");
                   7353: 
                   7354:        axl_hash_insert (hash, "sword09", "sword09"); 
                   7355:        axl_hash_insert (hash, "mace09", "mace09");
                   7356:        axl_hash_insert (hash, "axe09", "axe09");
                   7357:        axl_hash_insert (hash, "arrow09", "arrow09");
                   7358:        axl_hash_insert (hash, "shield09", "shield09");
                   7359:        axl_hash_insert (hash, "bag09", "bag09");
                   7360:        axl_hash_insert (hash, "stone09", "stone09");
                   7361:        axl_hash_insert (hash, "key09", "key09");
                   7362:        axl_hash_insert (hash, "skull09", "skull09");
                   7363:        axl_hash_insert (hash, "jar09", "jar09");
                   7364:        axl_hash_insert (hash, "bottle09", "bottle09");
                   7365:        axl_hash_insert (hash, "fairy09", "fairy09");
                   7366:        axl_hash_insert (hash, "potion09", "potion09");
                   7367:        axl_hash_insert (hash, "water09", "water09");
                   7368:        axl_hash_insert (hash, "spoon09", "spoon09");
                   7369:        axl_hash_insert (hash, "book09", "book09");
                   7370:        axl_hash_insert (hash, "spear09", "spear09");
                   7371:        axl_hash_insert (hash, "dagger09", "dagger09");
                   7372:        axl_hash_insert (hash, "katana09", "katana09");
                   7373:        axl_hash_insert (hash, "helmet09", "helmet09");
                   7374:        axl_hash_insert (hash, "chain09", "chain09");
                   7375:        axl_hash_insert (hash, "halberd09", "halberd09");
                   7376:        axl_hash_insert (hash, "pipe09", "pipe09");
                   7377:        axl_hash_insert (hash, "hat09", "hat09");
                   7378:        axl_hash_insert (hash, "eyeofnewt09", "eyeofnewt09");
                   7379:        axl_hash_insert (hash, "soup09", "soup09");
                   7380:        axl_hash_insert (hash, "wolfbane09", "wolfbane09");
                   7381:        axl_hash_insert (hash, "instantcoffee09", "instantcoffee09");
                   7382:        axl_hash_insert (hash, "bugspray09", "bugspray09");
                   7383:        axl_hash_insert (hash, "flint09", "flint09");
                   7384:        axl_hash_insert (hash, "soap09", "soap09");
                   7385:        axl_hash_insert (hash, "bones09", "bones09");
                   7386:        axl_hash_insert (hash, "orb09", "orb09");
                   7387:        axl_hash_insert (hash, "gold09", "gold09");
                   7388:        axl_hash_insert (hash, "silver09", "silver09");
                   7389:        axl_hash_insert (hash, "wine09", "wine09");
                   7390:        axl_hash_insert (hash, "bread09", "bread09");
                   7391: 
                   7392:        axl_hash_insert (hash, "sword10", "sword10"); 
                   7393:        axl_hash_insert (hash, "mace10", "mace10");
                   7394:        axl_hash_insert (hash, "axe10", "axe10");
                   7395:        axl_hash_insert (hash, "arrow10", "arrow10");
                   7396:        axl_hash_insert (hash, "shield10", "shield10");
                   7397:        axl_hash_insert (hash, "bag10", "bag10");
                   7398:        axl_hash_insert (hash, "stone10", "stone10");
                   7399:        axl_hash_insert (hash, "key10", "key10");
                   7400:        axl_hash_insert (hash, "skull10", "skull10");
                   7401:        axl_hash_insert (hash, "jar10", "jar10");
                   7402:        axl_hash_insert (hash, "bottle10", "bottle10");
                   7403:        axl_hash_insert (hash, "fairy10", "fairy10");
                   7404:        axl_hash_insert (hash, "potion10", "potion10");
                   7405:        axl_hash_insert (hash, "water10", "water10");
                   7406:        axl_hash_insert (hash, "spoon10", "spoon10");
                   7407:        axl_hash_insert (hash, "book10", "book10");
                   7408:        axl_hash_insert (hash, "spear10", "spear10");
                   7409:        axl_hash_insert (hash, "dagger10", "dagger10");
                   7410:        axl_hash_insert (hash, "katana10", "katana10");
                   7411:        axl_hash_insert (hash, "helmet10", "helmet10");
                   7412:        axl_hash_insert (hash, "chain10", "chain10");
                   7413:        axl_hash_insert (hash, "halberd10", "halberd10");
                   7414:        axl_hash_insert (hash, "pipe10", "pipe10");
                   7415:        axl_hash_insert (hash, "hat10", "hat10");
                   7416:        axl_hash_insert (hash, "eyeofnewt10", "eyeofnewt10");
                   7417:        axl_hash_insert (hash, "soup10", "soup10");
                   7418:        axl_hash_insert (hash, "wolfbane10", "wolfbane10");
                   7419:        axl_hash_insert (hash, "instantcoffee10", "instantcoffee10");
                   7420:        axl_hash_insert (hash, "bugspray10", "bugspray10");
                   7421:        axl_hash_insert (hash, "flint10", "flint10");
                   7422:        axl_hash_insert (hash, "soap10", "soap10");
                   7423:        axl_hash_insert (hash, "bones10", "bones10");
                   7424:        axl_hash_insert (hash, "orb10", "orb10");
                   7425:        axl_hash_insert (hash, "gold10", "gold10");
                   7426:        axl_hash_insert (hash, "silver10", "silver10");
                   7427:        axl_hash_insert (hash, "wine10", "wine10");
                   7428:        axl_hash_insert (hash, "bread10", "bread10");
                   7429: 
                   7430:        axl_hash_insert (hash, "sword11", "sword11"); 
                   7431:        axl_hash_insert (hash, "mace11", "mace11");
                   7432:        axl_hash_insert (hash, "axe11", "axe11");
                   7433:        axl_hash_insert (hash, "arrow11", "arrow11");
                   7434:        axl_hash_insert (hash, "shield11", "shield11");
                   7435:        axl_hash_insert (hash, "bag11", "bag11");
                   7436:        axl_hash_insert (hash, "stone11", "stone11");
                   7437:        axl_hash_insert (hash, "key11", "key11");
                   7438:        axl_hash_insert (hash, "skull11", "skull11");
                   7439:        axl_hash_insert (hash, "jar11", "jar11");
                   7440:        axl_hash_insert (hash, "bottle11", "bottle11");
                   7441:        axl_hash_insert (hash, "fairy11", "fairy11");
                   7442:        axl_hash_insert (hash, "potion11", "potion11");
                   7443:        axl_hash_insert (hash, "water11", "water11");
                   7444:        axl_hash_insert (hash, "spoon11", "spoon11");
                   7445:        axl_hash_insert (hash, "book11", "book11");
                   7446:        axl_hash_insert (hash, "spear11", "spear11");
                   7447:        axl_hash_insert (hash, "dagger11", "dagger11");
                   7448:        axl_hash_insert (hash, "katana11", "katana11");
                   7449:        axl_hash_insert (hash, "helmet11", "helmet11");
                   7450:        axl_hash_insert (hash, "chain11", "chain11");
                   7451:        axl_hash_insert (hash, "halberd11", "halberd11");
                   7452:        axl_hash_insert (hash, "pipe11", "pipe11");
                   7453:        axl_hash_insert (hash, "hat11", "hat11");
                   7454:        axl_hash_insert (hash, "eyeofnewt11", "eyeofnewt11");
                   7455:        axl_hash_insert (hash, "soup11", "soup11");
                   7456:        axl_hash_insert (hash, "wolfbane11", "wolfbane11");
                   7457:        axl_hash_insert (hash, "instantcoffee11", "instantcoffee11");
                   7458:        axl_hash_insert (hash, "bugspray11", "bugspray11");
                   7459:        axl_hash_insert (hash, "flint11", "flint11");
                   7460:        axl_hash_insert (hash, "soap11", "soap11");
                   7461:        axl_hash_insert (hash, "bones11", "bones11");
                   7462:        axl_hash_insert (hash, "orb11", "orb11");
                   7463:        axl_hash_insert (hash, "gold11", "gold11");
                   7464:        axl_hash_insert (hash, "silver11", "silver11");
                   7465:        axl_hash_insert (hash, "wine11", "wine11");
                   7466:        axl_hash_insert (hash, "bread11", "bread11");
                   7467: 
                   7468:        /* show hash status */
                   7469:        axl_hash_show_status  (hash);
                   7470: 
                   7471:        /* perform checks */
                   7472:        iterator = 0;
                   7473:        while (iterator < 1000) {
                   7474: 
                   7475:                /* get values and check them */
                   7476:                test_02_02_check_key (hash, "bag");
                   7477:                test_02_02_check_key (hash, "sword"); 
                   7478:                test_02_02_check_key (hash, "mace");
                   7479:                test_02_02_check_key (hash, "axe");
                   7480:                test_02_02_check_key (hash, "arrow");
                   7481:                test_02_02_check_key (hash, "shield");
                   7482:                test_02_02_check_key (hash, "bag");
                   7483:                test_02_02_check_key (hash, "stone");
                   7484:                test_02_02_check_key (hash, "key");
                   7485:                test_02_02_check_key (hash, "skull");
                   7486:                test_02_02_check_key (hash, "jar");
                   7487:                test_02_02_check_key (hash, "bottle");
                   7488:                test_02_02_check_key (hash, "fairy");
                   7489:                test_02_02_check_key (hash, "potion");
                   7490:                test_02_02_check_key (hash, "water");
                   7491:                test_02_02_check_key (hash, "spoon");
                   7492:                test_02_02_check_key (hash, "book");
                   7493:                test_02_02_check_key (hash, "spear");
                   7494:                test_02_02_check_key (hash, "dagger");
                   7495:                test_02_02_check_key (hash, "katana");
                   7496:                test_02_02_check_key (hash, "helmet");
                   7497:                test_02_02_check_key (hash, "chain");
                   7498:                test_02_02_check_key (hash, "halberd");
                   7499:                test_02_02_check_key (hash, "pipe");
                   7500:                test_02_02_check_key (hash, "hat");
                   7501:                test_02_02_check_key (hash, "eyeofnewt");
                   7502:                test_02_02_check_key (hash, "soup");
                   7503:                test_02_02_check_key (hash, "wolfbane");
                   7504:                test_02_02_check_key (hash, "instantcoffee");
                   7505:                test_02_02_check_key (hash, "bugspray");
                   7506:                test_02_02_check_key (hash, "flint");
                   7507:                test_02_02_check_key (hash, "soap");
                   7508:                test_02_02_check_key (hash, "bones");
                   7509:                test_02_02_check_key (hash, "orb");
                   7510:                test_02_02_check_key (hash, "gold");
                   7511:                test_02_02_check_key (hash, "silver");
                   7512:                test_02_02_check_key (hash, "wine");
                   7513:                test_02_02_check_key (hash, "bread");
                   7514:                
                   7515:                test_02_02_check_key (hash, "bag01");
                   7516:                test_02_02_check_key (hash, "sword01"); 
                   7517:                test_02_02_check_key (hash, "mace01");
                   7518:                test_02_02_check_key (hash, "axe01");
                   7519:                test_02_02_check_key (hash, "arrow01");
                   7520:                test_02_02_check_key (hash, "shield01");
                   7521:                test_02_02_check_key (hash, "bag01");
                   7522:                test_02_02_check_key (hash, "stone01");
                   7523:                test_02_02_check_key (hash, "key01");
                   7524:                test_02_02_check_key (hash, "skull01");
                   7525:                test_02_02_check_key (hash, "jar01");
                   7526:                test_02_02_check_key (hash, "bottle01");
                   7527:                test_02_02_check_key (hash, "fairy01");
                   7528:                test_02_02_check_key (hash, "potion01");
                   7529:                test_02_02_check_key (hash, "water01");
                   7530:                test_02_02_check_key (hash, "spoon01");
                   7531:                test_02_02_check_key (hash, "book01");
                   7532:                test_02_02_check_key (hash, "spear01");
                   7533:                test_02_02_check_key (hash, "dagger01");
                   7534:                test_02_02_check_key (hash, "katana01");
                   7535:                test_02_02_check_key (hash, "helmet01");
                   7536:                test_02_02_check_key (hash, "chain01");
                   7537:                test_02_02_check_key (hash, "halberd01");
                   7538:                test_02_02_check_key (hash, "pipe01");
                   7539:                test_02_02_check_key (hash, "hat01");
                   7540:                test_02_02_check_key (hash, "eyeofnewt01");
                   7541:                test_02_02_check_key (hash, "soup01");
                   7542:                test_02_02_check_key (hash, "wolfbane01");
                   7543:                test_02_02_check_key (hash, "instantcoffee01");
                   7544:                test_02_02_check_key (hash, "bugspray01");
                   7545:                test_02_02_check_key (hash, "flint01");
                   7546:                test_02_02_check_key (hash, "soap01");
                   7547:                test_02_02_check_key (hash, "bones01");
                   7548:                test_02_02_check_key (hash, "orb01");
                   7549:                test_02_02_check_key (hash, "gold01");
                   7550:                test_02_02_check_key (hash, "silver01");
                   7551:                test_02_02_check_key (hash, "wine01");
                   7552:                test_02_02_check_key (hash, "bread01");
                   7553:                
                   7554:                test_02_02_check_key (hash, "bag02");
                   7555:                test_02_02_check_key (hash, "sword02"); 
                   7556:                test_02_02_check_key (hash, "mace02");
                   7557:                test_02_02_check_key (hash, "axe02");
                   7558:                test_02_02_check_key (hash, "arrow02");
                   7559:                test_02_02_check_key (hash, "shield02");
                   7560:                test_02_02_check_key (hash, "bag02");
                   7561:                test_02_02_check_key (hash, "stone02");
                   7562:                test_02_02_check_key (hash, "key02");
                   7563:                test_02_02_check_key (hash, "skull02");
                   7564:                test_02_02_check_key (hash, "jar02");
                   7565:                test_02_02_check_key (hash, "bottle02");
                   7566:                test_02_02_check_key (hash, "fairy02");
                   7567:                test_02_02_check_key (hash, "potion02");
                   7568:                test_02_02_check_key (hash, "water02");
                   7569:                test_02_02_check_key (hash, "spoon02");
                   7570:                test_02_02_check_key (hash, "book02");
                   7571:                test_02_02_check_key (hash, "spear02");
                   7572:                test_02_02_check_key (hash, "dagger02");
                   7573:                test_02_02_check_key (hash, "katana02");
                   7574:                test_02_02_check_key (hash, "helmet02");
                   7575:                test_02_02_check_key (hash, "chain02");
                   7576:                test_02_02_check_key (hash, "halberd02");
                   7577:                test_02_02_check_key (hash, "pipe02");
                   7578:                test_02_02_check_key (hash, "hat02");
                   7579:                test_02_02_check_key (hash, "eyeofnewt02");
                   7580:                test_02_02_check_key (hash, "soup02");
                   7581:                test_02_02_check_key (hash, "wolfbane02");
                   7582:                test_02_02_check_key (hash, "instantcoffee02");
                   7583:                test_02_02_check_key (hash, "bugspray02");
                   7584:                test_02_02_check_key (hash, "flint02");
                   7585:                test_02_02_check_key (hash, "soap02");
                   7586:                test_02_02_check_key (hash, "bones02");
                   7587:                test_02_02_check_key (hash, "orb02");
                   7588:                test_02_02_check_key (hash, "gold02");
                   7589:                test_02_02_check_key (hash, "silver02");
                   7590:                test_02_02_check_key (hash, "wine02");
                   7591:                test_02_02_check_key (hash, "bread02");
                   7592: 
                   7593:                test_02_02_check_key (hash, "bag03");
                   7594:                test_02_02_check_key (hash, "sword03"); 
                   7595:                test_02_02_check_key (hash, "mace03");
                   7596:                test_02_02_check_key (hash, "axe03");
                   7597:                test_02_02_check_key (hash, "arrow03");
                   7598:                test_02_02_check_key (hash, "shield03");
                   7599:                test_02_02_check_key (hash, "bag03");
                   7600:                test_02_02_check_key (hash, "stone03");
                   7601:                test_02_02_check_key (hash, "key03");
                   7602:                test_02_02_check_key (hash, "skull03");
                   7603:                test_02_02_check_key (hash, "jar03");
                   7604:                test_02_02_check_key (hash, "bottle03");
                   7605:                test_02_02_check_key (hash, "fairy03");
                   7606:                test_02_02_check_key (hash, "potion03");
                   7607:                test_02_02_check_key (hash, "water03");
                   7608:                test_02_02_check_key (hash, "spoon03");
                   7609:                test_02_02_check_key (hash, "book03");
                   7610:                test_02_02_check_key (hash, "spear03");
                   7611:                test_02_02_check_key (hash, "dagger03");
                   7612:                test_02_02_check_key (hash, "katana03");
                   7613:                test_02_02_check_key (hash, "helmet03");
                   7614:                test_02_02_check_key (hash, "chain03");
                   7615:                test_02_02_check_key (hash, "halberd03");
                   7616:                test_02_02_check_key (hash, "pipe03");
                   7617:                test_02_02_check_key (hash, "hat03");
                   7618:                test_02_02_check_key (hash, "eyeofnewt03");
                   7619:                test_02_02_check_key (hash, "soup03");
                   7620:                test_02_02_check_key (hash, "wolfbane03");
                   7621:                test_02_02_check_key (hash, "instantcoffee03");
                   7622:                test_02_02_check_key (hash, "bugspray03");
                   7623:                test_02_02_check_key (hash, "flint03");
                   7624:                test_02_02_check_key (hash, "soap03");
                   7625:                test_02_02_check_key (hash, "bones03");
                   7626:                test_02_02_check_key (hash, "orb03");
                   7627:                test_02_02_check_key (hash, "gold03");
                   7628:                test_02_02_check_key (hash, "silver03");
                   7629:                test_02_02_check_key (hash, "wine03");
                   7630:                test_02_02_check_key (hash, "bread03");
                   7631: 
                   7632:                test_02_02_check_key (hash, "bag04");
                   7633:                test_02_02_check_key (hash, "sword04"); 
                   7634:                test_02_02_check_key (hash, "mace04");
                   7635:                test_02_02_check_key (hash, "axe04");
                   7636:                test_02_02_check_key (hash, "arrow04");
                   7637:                test_02_02_check_key (hash, "shield04");
                   7638:                test_02_02_check_key (hash, "bag04");
                   7639:                test_02_02_check_key (hash, "stone04");
                   7640:                test_02_02_check_key (hash, "key04");
                   7641:                test_02_02_check_key (hash, "skull04");
                   7642:                test_02_02_check_key (hash, "jar04");
                   7643:                test_02_02_check_key (hash, "bottle04");
                   7644:                test_02_02_check_key (hash, "fairy04");
                   7645:                test_02_02_check_key (hash, "potion04");
                   7646:                test_02_02_check_key (hash, "water04");
                   7647:                test_02_02_check_key (hash, "spoon04");
                   7648:                test_02_02_check_key (hash, "book04");
                   7649:                test_02_02_check_key (hash, "spear04");
                   7650:                test_02_02_check_key (hash, "dagger04");
                   7651:                test_02_02_check_key (hash, "katana04");
                   7652:                test_02_02_check_key (hash, "helmet04");
                   7653:                test_02_02_check_key (hash, "chain04");
                   7654:                test_02_02_check_key (hash, "halberd04");
                   7655:                test_02_02_check_key (hash, "pipe04");
                   7656:                test_02_02_check_key (hash, "hat04");
                   7657:                test_02_02_check_key (hash, "eyeofnewt04");
                   7658:                test_02_02_check_key (hash, "soup04");
                   7659:                test_02_02_check_key (hash, "wolfbane04");
                   7660:                test_02_02_check_key (hash, "instantcoffee04");
                   7661:                test_02_02_check_key (hash, "bugspray04");
                   7662:                test_02_02_check_key (hash, "flint04");
                   7663:                test_02_02_check_key (hash, "soap04");
                   7664:                test_02_02_check_key (hash, "bones04");
                   7665:                test_02_02_check_key (hash, "orb04");
                   7666:                test_02_02_check_key (hash, "gold04");
                   7667:                test_02_02_check_key (hash, "silver04");
                   7668:                test_02_02_check_key (hash, "wine04");
                   7669:                test_02_02_check_key (hash, "bread04");
                   7670: 
                   7671:                test_02_02_check_key (hash, "bag05");
                   7672:                test_02_02_check_key (hash, "sword05"); 
                   7673:                test_02_02_check_key (hash, "mace05");
                   7674:                test_02_02_check_key (hash, "axe05");
                   7675:                test_02_02_check_key (hash, "arrow05");
                   7676:                test_02_02_check_key (hash, "shield05");
                   7677:                test_02_02_check_key (hash, "bag05");
                   7678:                test_02_02_check_key (hash, "stone05");
                   7679:                test_02_02_check_key (hash, "key05");
                   7680:                test_02_02_check_key (hash, "skull05");
                   7681:                test_02_02_check_key (hash, "jar05");
                   7682:                test_02_02_check_key (hash, "bottle05");
                   7683:                test_02_02_check_key (hash, "fairy05");
                   7684:                test_02_02_check_key (hash, "potion05");
                   7685:                test_02_02_check_key (hash, "water05");
                   7686:                test_02_02_check_key (hash, "spoon05");
                   7687:                test_02_02_check_key (hash, "book05");
                   7688:                test_02_02_check_key (hash, "spear05");
                   7689:                test_02_02_check_key (hash, "dagger05");
                   7690:                test_02_02_check_key (hash, "katana05");
                   7691:                test_02_02_check_key (hash, "helmet05");
                   7692:                test_02_02_check_key (hash, "chain05");
                   7693:                test_02_02_check_key (hash, "halberd05");
                   7694:                test_02_02_check_key (hash, "pipe05");
                   7695:                test_02_02_check_key (hash, "hat05");
                   7696:                test_02_02_check_key (hash, "eyeofnewt05");
                   7697:                test_02_02_check_key (hash, "soup05");
                   7698:                test_02_02_check_key (hash, "wolfbane05");
                   7699:                test_02_02_check_key (hash, "instantcoffee05");
                   7700:                test_02_02_check_key (hash, "bugspray05");
                   7701:                test_02_02_check_key (hash, "flint05");
                   7702:                test_02_02_check_key (hash, "soap05");
                   7703:                test_02_02_check_key (hash, "bones05");
                   7704:                test_02_02_check_key (hash, "orb05");
                   7705:                test_02_02_check_key (hash, "gold05");
                   7706:                test_02_02_check_key (hash, "silver05");
                   7707:                test_02_02_check_key (hash, "wine05");
                   7708:                test_02_02_check_key (hash, "bread05");
                   7709: 
                   7710:                test_02_02_check_key (hash, "bag06");
                   7711:                test_02_02_check_key (hash, "sword06"); 
                   7712:                test_02_02_check_key (hash, "mace06");
                   7713:                test_02_02_check_key (hash, "axe06");
                   7714:                test_02_02_check_key (hash, "arrow06");
                   7715:                test_02_02_check_key (hash, "shield06");
                   7716:                test_02_02_check_key (hash, "bag06");
                   7717:                test_02_02_check_key (hash, "stone06");
                   7718:                test_02_02_check_key (hash, "key06");
                   7719:                test_02_02_check_key (hash, "skull06");
                   7720:                test_02_02_check_key (hash, "jar06");
                   7721:                test_02_02_check_key (hash, "bottle06");
                   7722:                test_02_02_check_key (hash, "fairy06");
                   7723:                test_02_02_check_key (hash, "potion06");
                   7724:                test_02_02_check_key (hash, "water06");
                   7725:                test_02_02_check_key (hash, "spoon06");
                   7726:                test_02_02_check_key (hash, "book06");
                   7727:                test_02_02_check_key (hash, "spear06");
                   7728:                test_02_02_check_key (hash, "dagger06");
                   7729:                test_02_02_check_key (hash, "katana06");
                   7730:                test_02_02_check_key (hash, "helmet06");
                   7731:                test_02_02_check_key (hash, "chain06");
                   7732:                test_02_02_check_key (hash, "halberd06");
                   7733:                test_02_02_check_key (hash, "pipe06");
                   7734:                test_02_02_check_key (hash, "hat06");
                   7735:                test_02_02_check_key (hash, "eyeofnewt06");
                   7736:                test_02_02_check_key (hash, "soup06");
                   7737:                test_02_02_check_key (hash, "wolfbane06");
                   7738:                test_02_02_check_key (hash, "instantcoffee06");
                   7739:                test_02_02_check_key (hash, "bugspray06");
                   7740:                test_02_02_check_key (hash, "flint06");
                   7741:                test_02_02_check_key (hash, "soap06");
                   7742:                test_02_02_check_key (hash, "bones06");
                   7743:                test_02_02_check_key (hash, "orb06");
                   7744:                test_02_02_check_key (hash, "gold06");
                   7745:                test_02_02_check_key (hash, "silver06");
                   7746:                test_02_02_check_key (hash, "wine06");
                   7747:                test_02_02_check_key (hash, "bread06");
                   7748: 
                   7749:                test_02_02_check_key (hash, "bag07");
                   7750:                test_02_02_check_key (hash, "sword07"); 
                   7751:                test_02_02_check_key (hash, "mace07");
                   7752:                test_02_02_check_key (hash, "axe07");
                   7753:                test_02_02_check_key (hash, "arrow07");
                   7754:                test_02_02_check_key (hash, "shield07");
                   7755:                test_02_02_check_key (hash, "bag07");
                   7756:                test_02_02_check_key (hash, "stone07");
                   7757:                test_02_02_check_key (hash, "key07");
                   7758:                test_02_02_check_key (hash, "skull07");
                   7759:                test_02_02_check_key (hash, "jar07");
                   7760:                test_02_02_check_key (hash, "bottle07");
                   7761:                test_02_02_check_key (hash, "fairy07");
                   7762:                test_02_02_check_key (hash, "potion07");
                   7763:                test_02_02_check_key (hash, "water07");
                   7764:                test_02_02_check_key (hash, "spoon07");
                   7765:                test_02_02_check_key (hash, "book07");
                   7766:                test_02_02_check_key (hash, "spear07");
                   7767:                test_02_02_check_key (hash, "dagger07");
                   7768:                test_02_02_check_key (hash, "katana07");
                   7769:                test_02_02_check_key (hash, "helmet07");
                   7770:                test_02_02_check_key (hash, "chain07");
                   7771:                test_02_02_check_key (hash, "halberd07");
                   7772:                test_02_02_check_key (hash, "pipe07");
                   7773:                test_02_02_check_key (hash, "hat07");
                   7774:                test_02_02_check_key (hash, "eyeofnewt07");
                   7775:                test_02_02_check_key (hash, "soup07");
                   7776:                test_02_02_check_key (hash, "wolfbane07");
                   7777:                test_02_02_check_key (hash, "instantcoffee07");
                   7778:                test_02_02_check_key (hash, "bugspray07");
                   7779:                test_02_02_check_key (hash, "flint07");
                   7780:                test_02_02_check_key (hash, "soap07");
                   7781:                test_02_02_check_key (hash, "bones07");
                   7782:                test_02_02_check_key (hash, "orb07");
                   7783:                test_02_02_check_key (hash, "gold07");
                   7784:                test_02_02_check_key (hash, "silver07");
                   7785:                test_02_02_check_key (hash, "wine07");
                   7786:                test_02_02_check_key (hash, "bread07");
                   7787: 
                   7788:                test_02_02_check_key (hash, "bag08");
                   7789:                test_02_02_check_key (hash, "sword08"); 
                   7790:                test_02_02_check_key (hash, "mace08");
                   7791:                test_02_02_check_key (hash, "axe08");
                   7792:                test_02_02_check_key (hash, "arrow08");
                   7793:                test_02_02_check_key (hash, "shield08");
                   7794:                test_02_02_check_key (hash, "bag08");
                   7795:                test_02_02_check_key (hash, "stone08");
                   7796:                test_02_02_check_key (hash, "key08");
                   7797:                test_02_02_check_key (hash, "skull08");
                   7798:                test_02_02_check_key (hash, "jar08");
                   7799:                test_02_02_check_key (hash, "bottle08");
                   7800:                test_02_02_check_key (hash, "fairy08");
                   7801:                test_02_02_check_key (hash, "potion08");
                   7802:                test_02_02_check_key (hash, "water08");
                   7803:                test_02_02_check_key (hash, "spoon08");
                   7804:                test_02_02_check_key (hash, "book08");
                   7805:                test_02_02_check_key (hash, "spear08");
                   7806:                test_02_02_check_key (hash, "dagger08");
                   7807:                test_02_02_check_key (hash, "katana08");
                   7808:                test_02_02_check_key (hash, "helmet08");
                   7809:                test_02_02_check_key (hash, "chain08");
                   7810:                test_02_02_check_key (hash, "halberd08");
                   7811:                test_02_02_check_key (hash, "pipe08");
                   7812:                test_02_02_check_key (hash, "hat08");
                   7813:                test_02_02_check_key (hash, "eyeofnewt08");
                   7814:                test_02_02_check_key (hash, "soup08");
                   7815:                test_02_02_check_key (hash, "wolfbane08");
                   7816:                test_02_02_check_key (hash, "instantcoffee08");
                   7817:                test_02_02_check_key (hash, "bugspray08");
                   7818:                test_02_02_check_key (hash, "flint08");
                   7819:                test_02_02_check_key (hash, "soap08");
                   7820:                test_02_02_check_key (hash, "bones08");
                   7821:                test_02_02_check_key (hash, "orb08");
                   7822:                test_02_02_check_key (hash, "gold08");
                   7823:                test_02_02_check_key (hash, "silver08");
                   7824:                test_02_02_check_key (hash, "wine08");
                   7825:                test_02_02_check_key (hash, "bread08");
                   7826: 
                   7827:                test_02_02_check_key (hash, "bag09");
                   7828:                test_02_02_check_key (hash, "sword09"); 
                   7829:                test_02_02_check_key (hash, "mace09");
                   7830:                test_02_02_check_key (hash, "axe09");
                   7831:                test_02_02_check_key (hash, "arrow09");
                   7832:                test_02_02_check_key (hash, "shield09");
                   7833:                test_02_02_check_key (hash, "bag09");
                   7834:                test_02_02_check_key (hash, "stone09");
                   7835:                test_02_02_check_key (hash, "key09");
                   7836:                test_02_02_check_key (hash, "skull09");
                   7837:                test_02_02_check_key (hash, "jar09");
                   7838:                test_02_02_check_key (hash, "bottle09");
                   7839:                test_02_02_check_key (hash, "fairy09");
                   7840:                test_02_02_check_key (hash, "potion09");
                   7841:                test_02_02_check_key (hash, "water09");
                   7842:                test_02_02_check_key (hash, "spoon09");
                   7843:                test_02_02_check_key (hash, "book09");
                   7844:                test_02_02_check_key (hash, "spear09");
                   7845:                test_02_02_check_key (hash, "dagger09");
                   7846:                test_02_02_check_key (hash, "katana09");
                   7847:                test_02_02_check_key (hash, "helmet09");
                   7848:                test_02_02_check_key (hash, "chain09");
                   7849:                test_02_02_check_key (hash, "halberd09");
                   7850:                test_02_02_check_key (hash, "pipe09");
                   7851:                test_02_02_check_key (hash, "hat09");
                   7852:                test_02_02_check_key (hash, "eyeofnewt09");
                   7853:                test_02_02_check_key (hash, "soup09");
                   7854:                test_02_02_check_key (hash, "wolfbane09");
                   7855:                test_02_02_check_key (hash, "instantcoffee09");
                   7856:                test_02_02_check_key (hash, "bugspray09");
                   7857:                test_02_02_check_key (hash, "flint09");
                   7858:                test_02_02_check_key (hash, "soap09");
                   7859:                test_02_02_check_key (hash, "bones09");
                   7860:                test_02_02_check_key (hash, "orb09");
                   7861:                test_02_02_check_key (hash, "gold09");
                   7862:                test_02_02_check_key (hash, "silver09");
                   7863:                test_02_02_check_key (hash, "wine09");
                   7864:                test_02_02_check_key (hash, "bread09");
                   7865: 
                   7866:                test_02_02_check_key (hash, "bag10");
                   7867:                test_02_02_check_key (hash, "sword10"); 
                   7868:                test_02_02_check_key (hash, "mace10");
                   7869:                test_02_02_check_key (hash, "axe10");
                   7870:                test_02_02_check_key (hash, "arrow10");
                   7871:                test_02_02_check_key (hash, "shield10");
                   7872:                test_02_02_check_key (hash, "bag10");
                   7873:                test_02_02_check_key (hash, "stone10");
                   7874:                test_02_02_check_key (hash, "key10");
                   7875:                test_02_02_check_key (hash, "skull10");
                   7876:                test_02_02_check_key (hash, "jar10");
                   7877:                test_02_02_check_key (hash, "bottle10");
                   7878:                test_02_02_check_key (hash, "fairy10");
                   7879:                test_02_02_check_key (hash, "potion10");
                   7880:                test_02_02_check_key (hash, "water10");
                   7881:                test_02_02_check_key (hash, "spoon10");
                   7882:                test_02_02_check_key (hash, "book10");
                   7883:                test_02_02_check_key (hash, "spear10");
                   7884:                test_02_02_check_key (hash, "dagger10");
                   7885:                test_02_02_check_key (hash, "katana10");
                   7886:                test_02_02_check_key (hash, "helmet10");
                   7887:                test_02_02_check_key (hash, "chain10");
                   7888:                test_02_02_check_key (hash, "halberd10");
                   7889:                test_02_02_check_key (hash, "pipe10");
                   7890:                test_02_02_check_key (hash, "hat10");
                   7891:                test_02_02_check_key (hash, "eyeofnewt10");
                   7892:                test_02_02_check_key (hash, "soup10");
                   7893:                test_02_02_check_key (hash, "wolfbane10");
                   7894:                test_02_02_check_key (hash, "instantcoffee10");
                   7895:                test_02_02_check_key (hash, "bugspray10");
                   7896:                test_02_02_check_key (hash, "flint10");
                   7897:                test_02_02_check_key (hash, "soap10");
                   7898:                test_02_02_check_key (hash, "bones10");
                   7899:                test_02_02_check_key (hash, "orb10");
                   7900:                test_02_02_check_key (hash, "gold10");
                   7901:                test_02_02_check_key (hash, "silver10");
                   7902:                test_02_02_check_key (hash, "wine10");
                   7903:                test_02_02_check_key (hash, "bread10");
                   7904: 
                   7905:                test_02_02_check_key (hash, "bag11");
                   7906:                test_02_02_check_key (hash, "sword11"); 
                   7907:                test_02_02_check_key (hash, "mace11");
                   7908:                test_02_02_check_key (hash, "axe11");
                   7909:                test_02_02_check_key (hash, "arrow11");
                   7910:                test_02_02_check_key (hash, "shield11");
                   7911:                test_02_02_check_key (hash, "bag11");
                   7912:                test_02_02_check_key (hash, "stone11");
                   7913:                test_02_02_check_key (hash, "key11");
                   7914:                test_02_02_check_key (hash, "skull11");
                   7915:                test_02_02_check_key (hash, "jar11");
                   7916:                test_02_02_check_key (hash, "bottle11");
                   7917:                test_02_02_check_key (hash, "fairy11");
                   7918:                test_02_02_check_key (hash, "potion11");
                   7919:                test_02_02_check_key (hash, "water11");
                   7920:                test_02_02_check_key (hash, "spoon11");
                   7921:                test_02_02_check_key (hash, "book11");
                   7922:                test_02_02_check_key (hash, "spear11");
                   7923:                test_02_02_check_key (hash, "dagger11");
                   7924:                test_02_02_check_key (hash, "katana11");
                   7925:                test_02_02_check_key (hash, "helmet11");
                   7926:                test_02_02_check_key (hash, "chain11");
                   7927:                test_02_02_check_key (hash, "halberd11");
                   7928:                test_02_02_check_key (hash, "pipe11");
                   7929:                test_02_02_check_key (hash, "hat11");
                   7930:                test_02_02_check_key (hash, "eyeofnewt11");
                   7931:                test_02_02_check_key (hash, "soup11");
                   7932:                test_02_02_check_key (hash, "wolfbane11");
                   7933:                test_02_02_check_key (hash, "instantcoffee11");
                   7934:                test_02_02_check_key (hash, "bugspray11");
                   7935:                test_02_02_check_key (hash, "flint11");
                   7936:                test_02_02_check_key (hash, "soap11");
                   7937:                test_02_02_check_key (hash, "bones11");
                   7938:                test_02_02_check_key (hash, "orb11");
                   7939:                test_02_02_check_key (hash, "gold11");
                   7940:                test_02_02_check_key (hash, "silver11");
                   7941:                test_02_02_check_key (hash, "wine11");
                   7942:                test_02_02_check_key (hash, "bread11");
                   7943: 
                   7944:                /* update iterator */
                   7945:                iterator++;
                   7946:        }
                   7947: 
                   7948:        /* destroy the hash */
                   7949:        axl_hash_free (hash);
                   7950: 
                   7951:        /* check integer hash */
                   7952:        hash = axl_hash_new (axl_hash_int, axl_hash_equal_int);
                   7953:        axl_hash_insert (hash, INT_TO_PTR (-1), "menos uno");
                   7954:        axl_hash_insert (hash, INT_TO_PTR (8), "ocho");
                   7955:        
                   7956:        /* check values stored */
                   7957:        value = (const char *) axl_hash_get (hash, INT_TO_PTR (-1));
                   7958:        if (! axl_cmp (value, "menos uno")) {
                   7959:                printf ("Expected to find %s but found %s\n", "menos uno", value);
                   7960:                return axl_false;
                   7961:        }
                   7962: 
                   7963:        /* check values stored */
                   7964:        value = (const char *) axl_hash_get (hash, INT_TO_PTR (8));
                   7965:        if (! axl_cmp (value, "ocho")) {
                   7966:                printf ("Expected to find %s but found %s\n", "ocho", value);
                   7967:                return axl_false;
                   7968:        }
                   7969: 
                   7970:        /* free hash */
                   7971:        axl_hash_free (hash);
                   7972: 
                   7973:        /* terminated test */
                   7974:        return axl_true;
                   7975: }
                   7976: 
                   7977: axlPointer test_02_01_copy_key (axlPointer key, axlDestroyFunc key_destroy, axlPointer data, axlDestroyFunc data_destroy)
                   7978: {
                   7979:        if (key_destroy == NULL)
                   7980:                return key;
                   7981: 
                   7982:        return axl_strdup (key);
                   7983: }
                   7984: 
                   7985: axlPointer test_02_01_copy_value (axlPointer key, axlDestroyFunc key_destroy, axlPointer data, axlDestroyFunc data_destroy)
                   7986: {
                   7987:        if (data_destroy == NULL)
                   7988:                return data;
                   7989: 
                   7990:        return axl_strdup (data);
                   7991: }
                   7992: 
                   7993: 
                   7994: /** 
                   7995:  * @brief Checks normal hash operations.
                   7996:  * 
                   7997:  * 
                   7998:  * @return \ref axl_true if it was ok.
                   7999:  */
                   8000: axl_bool test_02_01 () 
                   8001: {
                   8002:        axlHash    * hash;
                   8003:        axlHash    * hash2;
                   8004:        axlPointer * data;
                   8005: 
                   8006:        /* create a hash */
                   8007:        hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
                   8008: 
                   8009:        /* perform operations on empty state */
                   8010:        if (axl_hash_exists (hash, "value")) {
                   8011:                printf ("Found that the hash returns that item exist but it is empty\n");
                   8012:                return axl_false;
                   8013:        }
                   8014: 
                   8015:        /* perform a remove operation */
                   8016:        axl_hash_remove (hash, "value");
                   8017: 
                   8018:        /* get data associated */
                   8019:        data = axl_hash_get (hash, "value");
                   8020:        if (data != NULL) {
                   8021:                printf ("Found that the hash returns that item exist but it is empty\n");
                   8022:                return axl_false;
                   8023:        }
                   8024: 
                   8025:        /* add items to the hash */
                   8026:        axl_hash_insert_full (hash, "value", NULL, axl_strdup ("value"), axl_free);
                   8027:        axl_hash_insert_full (hash, "value2", NULL, axl_strdup ("value2"), axl_free);
                   8028:        axl_hash_insert_full (hash, "value3", NULL, axl_strdup ("value3"), axl_free);
                   8029: 
                   8030:        /* check items stored */
                   8031:        test_02_02_check_key (hash, "value");
                   8032:        test_02_02_check_key (hash, "value2");
                   8033:        test_02_02_check_key (hash, "value3");
                   8034: 
                   8035:        /* copy the hash */
                   8036:        hash2 = axl_hash_copy (hash, test_02_01_copy_key, test_02_01_copy_value);
                   8037: 
                   8038:        /* check items stored */
                   8039:        test_02_02_check_key (hash2, "value");
                   8040:        test_02_02_check_key (hash2, "value2");
                   8041:        test_02_02_check_key (hash2, "value3");
                   8042:        
                   8043: 
                   8044:        /* destroy the hash */
                   8045:        axl_hash_free (hash);
                   8046: 
                   8047:        /* destroy the hash2 */
                   8048:        axl_hash_free (hash2);
                   8049: 
                   8050:        return axl_true;
                   8051: }
                   8052: 
                   8053: /** 
                   8054:  * @brief Test current libaxl hash implementation.
                   8055:  *
                   8056:  * @return axl_true if it works properly or axl_false if not.
                   8057:  */
                   8058: axl_bool test_02_03 () 
                   8059: {
                   8060:        axlHash * hash;
                   8061: 
                   8062:        /* create the hash */
                   8063:        hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
                   8064:        
                   8065:        axl_hash_insert (hash, "value", "value");
                   8066:        axl_hash_insert (hash, "value", "value");
                   8067:        axl_hash_insert (hash, "value", "value");
                   8068:        axl_hash_insert (hash, "value", "value");
                   8069:        axl_hash_insert (hash, "value", "value");
                   8070:        axl_hash_insert (hash, "value", "value");
                   8071:        axl_hash_insert (hash, "value", "value");
                   8072:        axl_hash_insert (hash, "value", "value");
                   8073:        axl_hash_insert (hash, "value", "value");
                   8074:        axl_hash_insert (hash, "value", "value");
                   8075: 
                   8076:        axl_hash_show_status (hash);
                   8077: 
                   8078:        if (axl_hash_items (hash) != 1) {
                   8079:                printf ("ERROR: expected to find a hash size of 1 but found: %d\n",
                   8080:                        axl_hash_items (hash));
                   8081:                return axl_false;
                   8082:        }
                   8083: 
                   8084:        /* free the hash */
                   8085:        axl_hash_free (hash);
                   8086: 
                   8087:        return axl_true;
                   8088: }
                   8089: 
                   8090: axl_bool test_02_03a ()
                   8091: {
                   8092:        axlHash * hash;
                   8093: 
                   8094:        hash = axl_hash_new (axl_hash_int, axl_hash_equal_int);
                   8095: 
                   8096:        axl_hash_insert (hash, INT_TO_PTR (10), INT_TO_PTR (10));
                   8097: 
                   8098:        axl_hash_insert (hash, INT_TO_PTR (1032), INT_TO_PTR (1032));
                   8099: 
                   8100:        axl_hash_insert (hash, INT_TO_PTR (1048), INT_TO_PTR (1048));
                   8101: 
                   8102:        axl_hash_insert (hash, INT_TO_PTR (10320), INT_TO_PTR (10320));
                   8103: 
                   8104:        /* remove */
                   8105:        if (axl_hash_remove (hash, INT_TO_PTR (10321))) {
                   8106:                printf ("ERROR: expected to not find a true result from removing an item that do not exists..");
                   8107:                return axl_false;
                   8108:        }
                   8109: 
                   8110:        if (! axl_hash_remove (hash, INT_TO_PTR (10320))) {
                   8111:                printf ("ERROR: expected to find a true result from removing an item that do not exists..");
                   8112:                return axl_false;
                   8113:        }
                   8114: 
                   8115:        if (axl_hash_remove (hash, INT_TO_PTR (10320))) {
                   8116:                printf ("ERROR: expected to NOT find a true result from removing an item that do not exists..");
                   8117:                return axl_false;
                   8118:        }
                   8119: 
                   8120:        if (! axl_hash_remove (hash, INT_TO_PTR (1048))) {
                   8121:                printf ("ERROR: expected to find a true result from removing an item that do not exists..");
                   8122:                return axl_false;
                   8123:        }
                   8124: 
                   8125:        if (axl_hash_remove (hash, INT_TO_PTR (1048))) {
                   8126:                printf ("ERROR: expected to NOT find a true result from removing an item that do not exists..");
                   8127:                return axl_false;
                   8128:        }
                   8129: 
                   8130:        if (! axl_hash_remove (hash, INT_TO_PTR (1032))) {
                   8131:                printf ("ERROR: expected to find a true result from removing an item that do not exists..");
                   8132:                return axl_false;
                   8133:        }
                   8134: 
                   8135:        if (axl_hash_remove (hash, INT_TO_PTR (1032))) {
                   8136:                printf ("ERROR: expected to NOT find a true result from removing an item that do not exists..");
                   8137:                return axl_false;
                   8138:        }
                   8139: 
                   8140:        if (! axl_hash_remove (hash, INT_TO_PTR (10))) {
                   8141:                printf ("ERROR: expected to find a true result from removing an item that do not exists..");
                   8142:                return axl_false;
                   8143:        }
                   8144: 
                   8145:        if (axl_hash_remove (hash, INT_TO_PTR (10))) {
                   8146:                printf ("ERROR: expected to NOT find a true result from removing an item that do not exists..");
                   8147:                return axl_false;
                   8148:        }
                   8149: 
                   8150:        axl_hash_free (hash);
                   8151: 
                   8152:        return axl_true;
                   8153: }
                   8154: 
                   8155: void show_item_test_02_04 (axlPointer key, axlPointer data)
                   8156: {
                   8157:        __axl_log ("hash-test", AXL_LEVEL_DEBUG, "  %s -> %s", (char *) key, (char *) data);
                   8158: }
                   8159: 
                   8160: axl_bool test_02_04 () 
                   8161: {
                   8162:        axlHash * hash;
                   8163:        
                   8164:        /* create the hash */
                   8165:        hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
                   8166: 
                   8167:        /* insert data */
                   8168:        axl_hash_insert (hash, "sword", "sword"); 
                   8169:        axl_hash_insert (hash, "mace", "mace");
                   8170:        axl_hash_insert (hash, "axe", "axe");
                   8171:        axl_hash_insert (hash, "arrow", "arrow");
                   8172:        axl_hash_insert (hash, "shield", "shield");
                   8173:        axl_hash_insert (hash, "bag", "bag");
                   8174:        axl_hash_insert (hash, "stone", "stone");
                   8175:        axl_hash_insert (hash, "key", "key");
                   8176:        axl_hash_insert (hash, "skull", "skull");
                   8177:        axl_hash_insert (hash, "jar", "jar");
                   8178:        axl_hash_insert (hash, "bottle", "bottle");
                   8179:        axl_hash_insert (hash, "fairy", "fairy");
                   8180:        axl_hash_insert (hash, "potion", "potion");
                   8181:        axl_hash_insert (hash, "water", "water");
                   8182:        axl_hash_insert (hash, "spoon", "spoon");
                   8183:        axl_hash_insert (hash, "book", "book");
                   8184:        axl_hash_insert (hash, "spear", "spear");
                   8185:        axl_hash_insert (hash, "dagger", "dagger");
                   8186:        axl_hash_insert (hash, "katana", "katana");
                   8187:        axl_hash_insert (hash, "helmet", "helmet");
                   8188:        axl_hash_insert (hash, "chain", "chain");
                   8189:        axl_hash_insert (hash, "halberd", "halberd");
                   8190:        axl_hash_insert (hash, "pipe", "pipe");
                   8191:        axl_hash_insert (hash, "hat", "hat");
                   8192:        axl_hash_insert (hash, "eyeofnewt", "eyeofnewt");
                   8193:        axl_hash_insert (hash, "soup", "soup");
                   8194:        axl_hash_insert (hash, "wolfbane", "wolfbane");
                   8195:        axl_hash_insert (hash, "instantcoffee", "instantcoffee");
                   8196:        axl_hash_insert (hash, "bugspray", "bugspray");
                   8197:        axl_hash_insert (hash, "flint", "flint");
                   8198:        axl_hash_insert (hash, "soap", "soap");
                   8199:        axl_hash_insert (hash, "bones", "bones");
                   8200:        axl_hash_insert (hash, "orb", "orb");
                   8201:        axl_hash_insert (hash, "gold", "gold");
                   8202:        axl_hash_insert (hash, "silver", "silver");
                   8203:        axl_hash_insert (hash, "wine", "wine");
                   8204:        axl_hash_insert (hash, "bread", "bread");
                   8205: 
                   8206:        axl_hash_show_status_full (hash, show_item_test_02_04);
                   8207: 
                   8208:        axl_hash_free (hash);
                   8209: 
                   8210:        return axl_true;
                   8211: 
                   8212: }
                   8213: 
                   8214: axl_bool test_02_04_1 ()
                   8215: {
                   8216:        axlHash * hash;
                   8217:        int       iterator;
                   8218: 
                   8219:        hash     = axl_hash_new (axl_hash_string, axl_hash_equal_string);
                   8220:        iterator = 0;
                   8221:        while (iterator < 1000) {
                   8222:                /* check the value do not exists */
                   8223:                if (axl_hash_exists (hash, "status-ok")) {
                   8224:                        printf ("ERROR (1): expected to not find key value 'status-ok', but found..\n");
                   8225:                        return axl_false;
                   8226:                } /* end if */
                   8227: 
                   8228:                axl_hash_insert_full (hash, "status-ok", NULL, INT_TO_PTR (1), NULL);
                   8229: 
                   8230:                if (! axl_hash_exists (hash, "status-ok")) {
                   8231:                        printf ("ERROR (2): expected to find key value 'status-ok', but not found..\n");
                   8232:                        return axl_false;
                   8233:                } /* end if */
                   8234:                
                   8235:                axl_hash_remove (hash, "status-ok");
                   8236: 
                   8237:                if (axl_hash_exists (hash, "status-ok")) {
                   8238:                        printf ("ERROR (3): expected to NOT find key value 'status-ok', but found..\n");
                   8239:                        return axl_false;
                   8240:                } /* end if */
                   8241: 
                   8242:                /* next iterator */
                   8243:                iterator++;
                   8244:        } /* end while */
                   8245: 
                   8246:        printf ("Test 02-04-1: capacity %d, items stored: %d\n", axl_hash_capacity (hash), axl_hash_items (hash));
                   8247: 
                   8248:        /* now store 10 items */
                   8249:        axl_hash_insert (hash, "value", INT_TO_PTR (1));
                   8250:        axl_hash_insert (hash, "value2", INT_TO_PTR (2));
                   8251:        axl_hash_insert (hash, "value3", INT_TO_PTR (3));
                   8252:        axl_hash_insert (hash, "value4", INT_TO_PTR (4));
                   8253:        axl_hash_insert (hash, "value5", INT_TO_PTR (5));
                   8254:        axl_hash_insert (hash, "value6", INT_TO_PTR (6));
                   8255:        axl_hash_insert (hash, "value7", INT_TO_PTR (7));
                   8256:        axl_hash_insert (hash, "value8", INT_TO_PTR (8));
                   8257:        axl_hash_insert (hash, "value9", INT_TO_PTR (9));
                   8258:        axl_hash_insert (hash, "value10", INT_TO_PTR (10));
                   8259: 
                   8260:        /* check capacity */
                   8261:        printf ("Test 02-04-1: Items stored %d\n", axl_hash_items (hash));
                   8262:        if (axl_hash_items (hash) != 10) {
                   8263:                printf ("ERROR (3): expected to find 10 items but found %d..\n",
                   8264:                        axl_hash_items (hash));
                   8265:                return axl_false;
                   8266:        } /* end if */
                   8267: 
                   8268:        /* check here available internal store */
                   8269:        if (__axl_hash_spare_max (hash) != 9 || __axl_hash_spare_next (hash) != -1) {
                   8270:                printf ("ERROR (5): expected to find either max spare 9 or next spare -1 but found %d and %d..\n",
                   8271:                        __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8272:                return axl_false;
                   8273:        } /* end if */
                   8274: 
                   8275:        /* remove items */
                   8276:        printf ("Test 02-04-1: Calling to remove items..\n");
                   8277:        axl_hash_remove (hash, "value");
                   8278:        axl_hash_remove (hash, "value2");
                   8279:        axl_hash_remove (hash, "value3");
                   8280:        axl_hash_remove (hash, "value4");
                   8281:        axl_hash_remove (hash, "value5");
                   8282:        axl_hash_remove (hash, "value6");
                   8283:        axl_hash_remove (hash, "value7");
                   8284:        axl_hash_remove (hash, "value8");
                   8285:        axl_hash_remove (hash, "value9");
                   8286:        axl_hash_remove (hash, "value10");
                   8287: 
                   8288:        if (axl_hash_items (hash) != 0) {
                   8289:                printf ("ERROR (4): expected to find 0 items but found %d..\n",
                   8290:                        axl_hash_items (hash));
                   8291:                return axl_false;
                   8292:        } /* end if */
                   8293: 
                   8294:        /* check here available internal store */
                   8295:        if (__axl_hash_spare_max (hash) != 9 || __axl_hash_spare_next (hash) != 9) {
                   8296:                printf ("ERROR (5): expected to find either max spare 9 or next spare 9 but found %d and %d..\n",
                   8297:                        __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8298:                return axl_false;
                   8299:        } /* end if */
                   8300: 
                   8301:        /* check capacity */
                   8302:        printf ("Test 02-04-1: Items stored %d\n", axl_hash_items (hash));
                   8303: 
                   8304:        /* insert lot of items */
                   8305:        axl_hash_insert (hash, "value", INT_TO_PTR (1));
                   8306:        axl_hash_insert (hash, "value2", INT_TO_PTR (2));
                   8307:        axl_hash_insert (hash, "value3", INT_TO_PTR (3));
                   8308:        axl_hash_insert (hash, "value4", INT_TO_PTR (4));
                   8309:        axl_hash_insert (hash, "value5", INT_TO_PTR (5));
                   8310:        axl_hash_insert (hash, "value6", INT_TO_PTR (6));
                   8311:        axl_hash_insert (hash, "value7", INT_TO_PTR (7));
                   8312:        axl_hash_insert (hash, "value8", INT_TO_PTR (8));
                   8313:        axl_hash_insert (hash, "value9", INT_TO_PTR (9));
                   8314:        axl_hash_insert (hash, "value10", INT_TO_PTR (10));
                   8315:        axl_hash_insert (hash, "value11", INT_TO_PTR (1));
                   8316:        axl_hash_insert (hash, "value12", INT_TO_PTR (2));
                   8317:        axl_hash_insert (hash, "value13", INT_TO_PTR (3));
                   8318:        axl_hash_insert (hash, "value14", INT_TO_PTR (4));
                   8319:        axl_hash_insert (hash, "value15", INT_TO_PTR (5));
                   8320:        axl_hash_insert (hash, "value16", INT_TO_PTR (6));
                   8321:        axl_hash_insert (hash, "value17", INT_TO_PTR (7));
                   8322:        axl_hash_insert (hash, "value18", INT_TO_PTR (8));
                   8323:        axl_hash_insert (hash, "value19", INT_TO_PTR (9));
                   8324:        axl_hash_insert (hash, "value20", INT_TO_PTR (10));
                   8325: 
                   8326:        /* check here available internal store */
                   8327:        printf ("Test 02-04-1: Max spares %d, next spares %d..\n",
                   8328:                __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8329:        if (__axl_hash_spare_max (hash) != 9 || __axl_hash_spare_next (hash) != -1) {
                   8330:                printf ("ERROR (5): expected to find either max spare 9 or next spare -1 but found %d and %d..\n",
                   8331:                        __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8332:                return axl_false;
                   8333:        } /* end if */
                   8334: 
                   8335:        /* insert lot of items */
                   8336:        axl_hash_remove (hash, "value");
                   8337:        axl_hash_remove (hash, "value2");
                   8338:        axl_hash_remove (hash, "value3");
                   8339:        axl_hash_remove (hash, "value4");
                   8340:        axl_hash_remove (hash, "value5");
                   8341:        axl_hash_remove (hash, "value6");
                   8342:        axl_hash_remove (hash, "value7");
                   8343:        axl_hash_remove (hash, "value8");
                   8344:        axl_hash_remove (hash, "value9");
                   8345:        axl_hash_remove (hash, "value10");
                   8346:        axl_hash_remove (hash, "value11");
                   8347:        axl_hash_remove (hash, "value12");
                   8348:        axl_hash_remove (hash, "value13");
                   8349:        axl_hash_remove (hash, "value14");
                   8350:        axl_hash_remove (hash, "value15");
                   8351:        axl_hash_remove (hash, "value16");
                   8352:        axl_hash_remove (hash, "value17");
                   8353:        axl_hash_remove (hash, "value18");
                   8354:        axl_hash_remove (hash, "value19");
                   8355:        axl_hash_remove (hash, "value20");
                   8356: 
                   8357:        printf ("Test 02-04-1: Max spares %d, next spares %d..\n",
                   8358:                __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8359: 
                   8360:        if (__axl_hash_spare_max (hash) != 27 || __axl_hash_spare_next (hash) != 19) {
                   8361:                printf ("ERROR (6): expected to find either max spare 27 or next spare 19 but found %d and %d..\n",
                   8362:                        __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8363:                return axl_false;
                   8364:        } /* end if */
                   8365: 
                   8366:        /* insert lot of items */
                   8367:        axl_hash_insert (hash, "value", INT_TO_PTR (1));
                   8368:        axl_hash_insert (hash, "value2", INT_TO_PTR (2));
                   8369:        axl_hash_insert (hash, "value3", INT_TO_PTR (3));
                   8370:        axl_hash_insert (hash, "value4", INT_TO_PTR (4));
                   8371:        axl_hash_insert (hash, "value5", INT_TO_PTR (5));
                   8372:        axl_hash_insert (hash, "value6", INT_TO_PTR (6));
                   8373:        axl_hash_insert (hash, "value7", INT_TO_PTR (7));
                   8374:        axl_hash_insert (hash, "value8", INT_TO_PTR (8));
                   8375:        axl_hash_insert (hash, "value9", INT_TO_PTR (9));
                   8376:        axl_hash_insert (hash, "value10", INT_TO_PTR (10));
                   8377:        axl_hash_insert (hash, "value11", INT_TO_PTR (1));
                   8378:        axl_hash_insert (hash, "value12", INT_TO_PTR (2));
                   8379:        axl_hash_insert (hash, "value13", INT_TO_PTR (3));
                   8380:        axl_hash_insert (hash, "value14", INT_TO_PTR (4));
                   8381:        axl_hash_insert (hash, "value15", INT_TO_PTR (5));
                   8382:        axl_hash_insert (hash, "value16", INT_TO_PTR (6));
                   8383:        axl_hash_insert (hash, "value17", INT_TO_PTR (7));
                   8384:        axl_hash_insert (hash, "value18", INT_TO_PTR (8));
                   8385:        axl_hash_insert (hash, "value19", INT_TO_PTR (9));
                   8386:        axl_hash_insert (hash, "value20", INT_TO_PTR (10));
                   8387: 
                   8388:        printf ("Test 02-04-1: Max spares %d, next spares %d..\n",
                   8389:                __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8390: 
                   8391:        if (__axl_hash_spare_max (hash) != 27 || __axl_hash_spare_next (hash) != -1) {
                   8392:                printf ("ERROR (6): expected to find either max spare 27 or next spare 19 but found %d and %d..\n",
                   8393:                        __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8394:                return axl_false;
                   8395:        } /* end if */
                   8396: 
                   8397:        /* insert lot of items */
                   8398:        axl_hash_remove (hash, "value");
                   8399:        axl_hash_remove (hash, "value2");
                   8400:        axl_hash_remove (hash, "value3");
                   8401:        axl_hash_remove (hash, "value4");
                   8402:        axl_hash_remove (hash, "value5");
                   8403:        axl_hash_remove (hash, "value6");
                   8404:        axl_hash_remove (hash, "value7");
                   8405:        axl_hash_remove (hash, "value8");
                   8406:        axl_hash_remove (hash, "value9");
                   8407:        axl_hash_remove (hash, "value10");
                   8408:        axl_hash_remove (hash, "value11");
                   8409:        axl_hash_remove (hash, "value12");
                   8410:        axl_hash_remove (hash, "value13");
                   8411:        axl_hash_remove (hash, "value14");
                   8412:        axl_hash_remove (hash, "value15");
                   8413:        axl_hash_remove (hash, "value16");
                   8414:        axl_hash_remove (hash, "value17");
                   8415:        axl_hash_remove (hash, "value18");
                   8416:        axl_hash_remove (hash, "value19");
                   8417:        axl_hash_remove (hash, "value20");
                   8418: 
                   8419:        if (__axl_hash_spare_max (hash) != 27 || __axl_hash_spare_next (hash) != 19) {
                   8420:                printf ("ERROR (7): expected to find either max spare 27 or next spare 19 but found %d and %d..\n",
                   8421:                        __axl_hash_spare_max (hash), __axl_hash_spare_next (hash));
                   8422:                return axl_false;
                   8423:        } /* end if */
                   8424: 
                   8425:        axl_hash_free (hash);
                   8426: 
                   8427:        return axl_true;
                   8428: }
                   8429: 
                   8430: axl_bool test_02_05 ()
                   8431: {
                   8432:        axlHash       * hash;
                   8433:        axlHashCursor * cursor;
                   8434:        int             iterator;
                   8435:        char          * key, * value;
                   8436:        
                   8437:        /* create the hash */
                   8438:        hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
                   8439: 
                   8440:        /* insert data */
                   8441:        axl_hash_insert (hash, "sword", "sword"); 
                   8442:        axl_hash_insert (hash, "mace", "mace");
                   8443:        axl_hash_insert (hash, "axe", "axe");
                   8444:        axl_hash_insert (hash, "arrow", "arrow");
                   8445:        axl_hash_insert (hash, "shield", "shield");
                   8446:        axl_hash_insert (hash, "bag", "bag");
                   8447:        axl_hash_insert (hash, "stone", "stone");
                   8448:        axl_hash_insert (hash, "key", "key");
                   8449:        axl_hash_insert (hash, "skull", "skull");
                   8450:        axl_hash_insert (hash, "jar", "jar");
                   8451:        axl_hash_insert (hash, "bottle", "bottle");
                   8452:        axl_hash_insert (hash, "fairy", "fairy");
                   8453:        axl_hash_insert (hash, "potion", "potion");
                   8454:        axl_hash_insert (hash, "water", "water");
                   8455:        axl_hash_insert (hash, "spoon", "spoon");
                   8456:        axl_hash_insert (hash, "book", "book");
                   8457:        axl_hash_insert (hash, "spear", "spear");
                   8458:        axl_hash_insert (hash, "dagger", "dagger");
                   8459:        axl_hash_insert (hash, "katana", "katana");
                   8460:        axl_hash_insert (hash, "helmet", "helmet");
                   8461:        axl_hash_insert (hash, "chain", "chain");
                   8462:        axl_hash_insert (hash, "halberd", "halberd");
                   8463:        axl_hash_insert (hash, "pipe", "pipe");
                   8464:        axl_hash_insert (hash, "hat", "hat");
                   8465:        axl_hash_insert (hash, "eyeofnewt", "eyeofnewt");
                   8466:        axl_hash_insert (hash, "soup", "soup");
                   8467:        axl_hash_insert (hash, "wolfbane", "wolfbane");
                   8468:        axl_hash_insert (hash, "instantcoffee", "instantcoffee");
                   8469:        axl_hash_insert (hash, "bugspray", "bugspray");
                   8470:        axl_hash_insert (hash, "flint", "flint");
                   8471:        axl_hash_insert (hash, "soap", "soap");
                   8472:        axl_hash_insert (hash, "bones", "bones");
                   8473:        axl_hash_insert (hash, "orb", "orb");
                   8474:        axl_hash_insert (hash, "gold", "gold");
                   8475:        axl_hash_insert (hash, "silver", "silver");
                   8476:        axl_hash_insert (hash, "wine", "wine");
                   8477:        axl_hash_insert (hash, "bread", "bread");
                   8478: 
                   8479:        /* create a cursor */
                   8480:        cursor   = axl_hash_cursor_new (hash);
                   8481:        iterator = 0;
                   8482:        while (axl_hash_cursor_has_item (cursor)) {
                   8483:                /* first item */
                   8484:                if (! axl_cmp (axl_hash_cursor_get_key (cursor),
                   8485:                               axl_hash_cursor_get_value (cursor))) {
                   8486:                        printf ("error: supposed to find key and value equal (%s==%s), but not found..\n",
                   8487:                                (char*)axl_hash_cursor_get_key (cursor),
                   8488:                                (char*)axl_hash_cursor_get_value (cursor));
                   8489:                        return axl_false;
                   8490:                } /* end if */
                   8491: 
                   8492:                /* get next */
                   8493:                axl_hash_cursor_next (cursor);
                   8494: 
                   8495:                iterator++;
                   8496: 
                   8497:                if (iterator == 38) {
                   8498:                        printf ("error: found more items than actually expected..\n");
                   8499:                        return axl_false;
                   8500:                }
                   8501:        } /* end while */
                   8502: 
                   8503:        if (iterator != 37) {
                   8504:                printf ("error: found more items than actually expected..\n");
                   8505:                return axl_false;
                   8506:        }
                   8507: 
                   8508:        iterator = 0;
                   8509:        axl_hash_cursor_first (cursor);
                   8510:        while (axl_hash_cursor_has_item (cursor)) {
                   8511:                /* first item */
                   8512:                if (! axl_cmp (axl_hash_cursor_get_key (cursor),
                   8513:                               axl_hash_cursor_get_value (cursor))) {
                   8514:                        printf ("error: supposed to find key and value equal (%s==%s), but not found..\n",
                   8515:                                (char*)axl_hash_cursor_get_key (cursor),
                   8516:                                (char*)axl_hash_cursor_get_value (cursor));
                   8517:                        return axl_false;
                   8518:                } /* end if */
                   8519: 
                   8520:                iterator++;
                   8521: 
                   8522:                if (iterator < 37) {
                   8523:                        if (! axl_hash_cursor_has_next (cursor)) {
                   8524:                                printf ("error: expected to find next node on iterator (%d)\n", iterator);
                   8525:                                return axl_false;
                   8526:                        } /* end if */
                   8527:                } /* end if */
                   8528: 
                   8529:                /* get next */
                   8530:                axl_hash_cursor_next (cursor);
                   8531: 
                   8532:                if (iterator == 38) {
                   8533:                        printf ("error: found more items than actually expected..\n");
                   8534:                        return axl_false;
                   8535:                }
                   8536:        } /* end while */
                   8537: 
                   8538:        if (iterator != 37) {
                   8539:                printf ("error: found different count of items than actually expected (%d != 37)..\n", iterator);
                   8540:                return axl_false;
                   8541:        }
                   8542: 
                   8543:        /* check last api */
                   8544:        axl_hash_cursor_last (cursor);
                   8545:        if (! axl_hash_cursor_has_item (cursor)) {
                   8546:                printf ("error: expected to find last element defined..\n");
                   8547:                return axl_false;
                   8548:        }
                   8549: 
                   8550:        /* check last */
                   8551:        if (! axl_cmp ("flint", axl_hash_cursor_get_key (cursor))) {
                   8552:                printf ("error: expected to find last element \"flint\"=\"%s\"\n", (char*) axl_hash_cursor_get_key (cursor));
                   8553:                return axl_false;
                   8554:        }
                   8555: 
                   8556: 
                   8557:        if (axl_hash_cursor_has_next (cursor)) {
                   8558:                printf ("error: expected to not find next element defined..\n");
                   8559:                return axl_false;
                   8560:        } /* end if */
                   8561: 
                   8562:        axl_hash_cursor_first (cursor);
                   8563:        while (axl_hash_cursor_has_item (cursor)) {
                   8564:                /* first item */
                   8565:                if (! axl_cmp (axl_hash_cursor_get_key (cursor),
                   8566:                               axl_hash_cursor_get_value (cursor))) {
                   8567:                        printf ("error: supposed to find key and value equal (%s==%s), but not found..\n",
                   8568:                                (char*)axl_hash_cursor_get_key (cursor),
                   8569:                                (char*)axl_hash_cursor_get_value (cursor));
                   8570:                        return axl_false;
                   8571:                } /* end if */
                   8572: 
                   8573:                /* get value */
                   8574:                key   = axl_hash_cursor_get_key (cursor);
                   8575:                value = axl_hash_cursor_get_value (cursor);
                   8576: 
                   8577:                /* check key to exists */
                   8578:                if (! axl_hash_exists (axl_hash_cursor_hash (cursor), key)) {
                   8579:                        printf ("error: expected to find key defined=<%s>\n", key);
                   8580:                        return axl_false;
                   8581:                }
                   8582: 
                   8583:                /* check value to exists */
                   8584:                if (! axl_cmp (axl_hash_get (axl_hash_cursor_hash (cursor), key), value)) {
                   8585:                        printf ("error: expected to find value not found: <%s>!=<%s>\n", 
                   8586:                                value, (char*) axl_hash_get (axl_hash_cursor_hash (cursor), key));
                   8587:                        return axl_false;
                   8588:                } /* end if */
                   8589:                
                   8590: 
                   8591:                /* remove items */
                   8592:                axl_hash_cursor_remove (cursor);
                   8593:                
                   8594:        } /* end while */
                   8595: 
                   8596:        if (axl_hash_items (hash) != 0) {
                   8597:                printf ("error: expected to find hash with 0 size (but found: %d)\n",
                   8598:                        axl_hash_items (hash));
                   8599:                return axl_false;
                   8600:        } /* end if */
                   8601: 
                   8602:        /* free cursor */
                   8603:        axl_hash_cursor_free (cursor);
                   8604: 
                   8605:        /* free the hash */
                   8606:        axl_hash_free (hash);
                   8607: 
                   8608:        /* now check the cursor with only one item */
                   8609:        hash = axl_hash_new (axl_hash_string, axl_hash_equal_string);
                   8610:        axl_hash_insert (hash, "12:BB:DD:8A:1D:E5:64:0C:7E:F5:EB:B3:21:C7:67:7E", "test");
                   8611:        cursor = axl_hash_cursor_new (hash);
                   8612: 
                   8613:        iterator = 0;
                   8614:        while (axl_hash_cursor_has_item (cursor) && iterator < 10) {
                   8615:                
                   8616:                axl_hash_cursor_get_value (cursor);
                   8617:                
                   8618:                /* get next cursor */
                   8619:                axl_hash_cursor_next (cursor);
                   8620:                iterator++;
                   8621:        }
                   8622: 
                   8623:        if (iterator != 1) {
                   8624:                printf ("Expected to find only one iteration inside the hash but the limit was found\n");
                   8625:                return axl_false;
                   8626:        }
                   8627: 
                   8628:        axl_hash_free (hash);
                   8629:        axl_hash_cursor_free (cursor);
                   8630: 
                   8631:        /* test ok */
                   8632:        return axl_true;
                   8633: }
                   8634: 
                   8635: /** 
                   8636:  * @brief Allows to check current binary stack used by the library.
                   8637:  * 
                   8638:  * 
                   8639:  * @return axl_true if tests are ok.
                   8640:  */
                   8641: axl_bool test_02_06 ()
                   8642: {
                   8643:        axl_bool         value;
                   8644:        axlBinaryStack * bstack;
                   8645:        int              iterator;
                   8646: 
                   8647:        /* create a bstack */
                   8648:        bstack = axl_binary_stack_new ();
                   8649: 
                   8650:        /* push 10 axl_true values */
                   8651:        axl_binary_stack_push (bstack, axl_true);
                   8652:        axl_binary_stack_push (bstack, axl_true);
                   8653:        axl_binary_stack_push (bstack, axl_true);
                   8654:        axl_binary_stack_push (bstack, axl_true);
                   8655:        axl_binary_stack_push (bstack, axl_true);
                   8656: 
                   8657:        axl_binary_stack_push (bstack, axl_true);
                   8658:        axl_binary_stack_push (bstack, axl_true);
                   8659:        axl_binary_stack_push (bstack, axl_true);
                   8660:        axl_binary_stack_push (bstack, axl_true);
                   8661:        axl_binary_stack_push (bstack, axl_true);
                   8662: 
                   8663:        /* check count */
                   8664:        if (axl_binary_stack_size (bstack) != 10) {
                   8665:                printf ("Expected to find %d items but found: %d", 
                   8666:                        10, axl_binary_stack_size (bstack));
                   8667:                return axl_false;
                   8668:        } /* end if */
                   8669: 
                   8670:        /* push values */
                   8671: 
                   8672:        axl_binary_stack_push (bstack, axl_false);
                   8673:        axl_binary_stack_push (bstack, axl_true);
                   8674:        axl_binary_stack_push (bstack, axl_true);
                   8675: 
                   8676:        axl_binary_stack_push (bstack, axl_true);
                   8677:        axl_binary_stack_push (bstack, axl_false);
                   8678:        axl_binary_stack_push (bstack, axl_false);
                   8679: 
                   8680:        /* check count */
                   8681:        if (axl_binary_stack_size (bstack) != 16) {
                   8682:                printf ("Expected to find %d items but found: %d\n", 
                   8683:                        16, axl_binary_stack_size (bstack));
                   8684:                return axl_false;
                   8685:        } /* end if */
                   8686: 
                   8687:        /* pop data */
                   8688:        value = axl_binary_stack_pop (bstack);
                   8689:        if (value != axl_false) {
                   8690:                printf ("Expected to find %d, but found %d (1)\n", axl_false, value);
                   8691:                return axl_false;
                   8692:        }
                   8693: 
                   8694:        value = axl_binary_stack_pop (bstack);
                   8695:        if (value != axl_false) {
                   8696:                printf ("Expected to find %d, but found %d (2)\n", axl_false, value);
                   8697:                return axl_false;
                   8698:        }
                   8699: 
                   8700:        value = axl_binary_stack_pop (bstack);
                   8701:        if (value != axl_true) {
                   8702:                printf ("Expected to find %d, but found %d (3)\n", axl_true, value);
                   8703:                return axl_false;
                   8704:        }
                   8705: 
                   8706:        value = axl_binary_stack_pop (bstack);
                   8707:        if (value != axl_true) {
                   8708:                printf ("Expected to find %d, but found %d (4)\n", axl_true, value);
                   8709:                return axl_false;
                   8710:        }
                   8711: 
                   8712:        value = axl_binary_stack_pop (bstack);
                   8713:        if (value != axl_true) {
                   8714:                printf ("Expected to find %d, but found %d (5)\n", axl_true, value);
                   8715:                return axl_false;
                   8716:        }
                   8717: 
                   8718:        value = axl_binary_stack_pop (bstack);
                   8719:        if (value != axl_false) {
                   8720:                printf ("Expected to find %d, but found %d (6)\n", axl_false, value);
                   8721:                return axl_false;
                   8722:        }
                   8723: 
                   8724:        /* check count */
                   8725:        if (axl_binary_stack_size (bstack) != 10) {
                   8726:                printf ("Expected to find %d items but found: %d\n", 
                   8727:                        10, axl_binary_stack_size (bstack));
                   8728:                return axl_false;
                   8729:        } /* end if */
                   8730: 
                   8731:        iterator = 0;
                   8732:        while (iterator < 10) {
                   8733:                /* get the value */
                   8734:                value    = axl_binary_stack_pop (bstack);
                   8735:                if (value != axl_true) {
                   8736:                        printf ("Expected to find %d, but found %d (3)\n", axl_true, value);
                   8737:                        return axl_false;
                   8738:                }  /* end if */
                   8739: 
                   8740:                iterator++;
                   8741:        } /* end while */
                   8742: 
                   8743:        /* check count */
                   8744:        if (axl_binary_stack_size (bstack) != 0) {
                   8745:                printf ("Expected to find %d items but found: %d\n", 
                   8746:                        0, axl_binary_stack_size (bstack));
                   8747:                return axl_false;
                   8748:        } /* end if */
                   8749: 
                   8750:        /* free binary stack */
                   8751:        axl_binary_stack_free (bstack);
                   8752: 
                   8753:        return axl_true;
                   8754: }
                   8755: 
                   8756: /** 
                   8757:  * Test01: Initial xml header checking.
                   8758:  */
                   8759: int main (int argc, char ** argv)
                   8760: {
                   8761:        axlError * error;
                   8762: 
                   8763:        printf ("** LibAxl: Another XML library (regression test).\n");
                   8764:        printf ("** Copyright (C) 2008 Advanced Software Production Line, S.L.\n**\n");
                   8765:        printf ("** Axl regression tests: version=%s\n**\n",
                   8766:                VERSION);
                   8767:        printf ("** To gather information about time performance you can use:\n**\n");
                   8768:        printf ("**     >> time ./test_01\n**\n");
                   8769:        printf ("** To gather information about memory consumed (and leaks) use:\n**\n");
                   8770:        printf ("**     >> libtool --mode=execute valgrind --leak-check=yes --error-limit=no ./test_01\n**\n");
                   8771:        printf ("**\n");
                   8772:        printf ("** Report bugs to:\n**\n");
                   8773:        printf ("**     <axl@lists.aspl.es> Axl mailing list\n**\n");
                   8774: 
                   8775:        
                   8776:        /* initialize axl library */
                   8777:        if (! axl_init ()) {
                   8778:                printf ("Unable to initialize Axl library\n");
                   8779:                return -1;
                   8780:        }
                   8781: 
                   8782:        /* DATA STRUCTURE TESTS */
                   8783:        if (test_01_01 ()) {    
                   8784:                printf ("Test 01-01: LibAxl list implementation [   OK   ]\n");
                   8785:        }else {
                   8786:                printf ("Test 01-01 ##: LibAxl list implementation [ FAILED ]\n");
                   8787:                return -1;
                   8788:        }
                   8789: 
                   8790:        if (test_01_02 ()) {
                   8791:                printf ("Test 01-02: LibAxl FIFO implementation [   OK   ]\n");
                   8792:        }else {
                   8793:                printf ("Test 01-02: LibAxl list implementation [ FAILED ]\n");
                   8794:                return -1;
                   8795:        }
                   8796: 
                   8797:        if (test_01_03 ()) {
                   8798:                printf ("Test 01-03: LibAxl string functions    [   OK   ]\n");
                   8799:        }else {
                   8800:                printf ("Test 01-03: LibAxl string functions    [ FAILED ]\n");
                   8801:                return -1;
                   8802:        }
                   8803: 
                   8804:        if (test_01_04 ()) {
                   8805:                printf ("Test 01-04: LibAxl list implementation (II) [   OK   ]\n");
                   8806:        }else {
                   8807:                printf ("Test 01-04: LibAxl list implementation (II) [ FAILED ]\n");
                   8808:                return -1;
                   8809:        }
                   8810: 
                   8811:        if (test_01_04_a ()) {
                   8812:                printf ("Test 01-04-a: LibAxl list implementation (III) [   OK   ]\n");
                   8813:        }else {
                   8814:                printf ("Test 01-04-a: LibAxl list implementation (III) [ FAILED ]\n");
                   8815:                return -1;
                   8816:        }
                   8817: 
                   8818:        if (test_01_05 ()) {
                   8819:                printf ("Test 01-05: LibAxl error reporting [   OK   ]\n");
                   8820:        }else {
                   8821:                printf ("Test 01-05: LibAxl error reporting [ FAILED ]\n");
                   8822:                return -1;
                   8823:        }
                   8824: 
                   8825:        /* HASH IMPLEMENTATION CHECKS */
                   8826:        if (test_02_01 ()) {
                   8827:                printf ("Test 02-01: LibAxl hash implementation [   OK   ]\n");
                   8828:        }else {
                   8829:                printf ("Test 02-01: LibAxl hash implementation [ FAILEDp ]\n");
                   8830:                return -1;
                   8831:        }
                   8832: 
                   8833:        if (test_02_02 ()) {
                   8834:                printf ("Test 02-02: LibAxl hash implementation (lookup) [   OK   ]\n");
                   8835:        }else {
                   8836:                printf ("Test 02-02: LibAxl hash implementation (lookup) [ FAILED ]\n");
                   8837:                return -1;
                   8838:        }
                   8839: 
                   8840:        if (test_02_03 ()) {
                   8841:                printf ("Test 02-03: LibAxl hash implementation (replace) [   OK   ]\n");
                   8842:        }else {
                   8843:                printf ("Test 02-03: LibAxl hash implementation (replace) [ FAILED ]\n");
                   8844:                return -1;
                   8845:        }
                   8846: 
                   8847:        if (test_02_03a ()) {
                   8848:                printf ("Test 02-03-a: LibAxl hash remove notification [   OK   ]\n");
                   8849:        }else {
                   8850:                printf ("Test 02-03-a: LibAxl hash remove notification [ FAILED ]\n");
                   8851:                return -1;
                   8852:        }
                   8853: 
                   8854:        if (test_02_04 ()) {
                   8855:                printf ("Test 02-04: LibAxl hash implementation (remove) [   OK   ]\n");
                   8856:        }else {
                   8857:                printf ("Test 02-04: LibAxl hash implementation (remove) [ FAILED ]\n");
                   8858:                return -1;
                   8859:        }
                   8860: 
                   8861:        if (test_02_04_1 ()) {
                   8862:                printf ("Test 02-04-1: LibAxl hash implementation (insert-remove cycle) [   OK   ]\n");
                   8863:        }else {
                   8864:                printf ("Test 02-04-1: LibAxl hash implementation (insert-remove cycle) [ FAILED ]\n");
                   8865:                return -1;
                   8866:        }
                   8867: 
                   8868:        if (test_02_05 ()) {
                   8869:                printf ("Test 02-05: LibAxl hash cursor [   OK   ]\n");
                   8870:        }else {
                   8871:                printf ("Test 02-05: LibAxl hash cursor [ FAILED ]\n");
                   8872:                return -1;
                   8873:        }
                   8874: 
                   8875:        /* binary stack checks */
                   8876:        if (test_02_06 ()) {
                   8877:                printf ("Test 02-06: LibAxl binary stack [   OK   ]\n");
                   8878:        }else {
                   8879:                printf ("Test 02-06: LibAxl binary stack [ FAILED ]\n");
                   8880:                return -1;
                   8881:        }
                   8882: 
                   8883:        /* LIBRARY TESTS */
                   8884:        if (test_01 (&error))
                   8885:                printf ("Test 01: basic xml parsing [   OK   ]\n");
                   8886:        else {
                   8887:                printf ("Test 01: basic xml parsing [ FAILED ]\n  (code: %d) %s\n",
                   8888:                        axl_error_get_code (error), axl_error_get (error));
                   8889:                axl_error_free (error);
                   8890:                return -1;
                   8891:        }
                   8892: 
                   8893:        if (test_01a (&error)) {
                   8894:                printf ("Test 01-a: Axl Stream boundary checks [   OK   ]\n");
                   8895:        } else {
                   8896:                printf ("Test 01-a: Axl Stream boundary checks [ FAILED ]\n  (CODE: %d) %s\n",
                   8897:                        axl_error_get_code (error), axl_error_get (error));
                   8898:                axl_error_free (error);
                   8899:                return -1;
                   8900:        }       
                   8901: 
                   8902:        if (test_01b (&error)) {
                   8903:                printf ("Test 01-b: Basic XML parsing, XML document position [   OK   ]\n");
                   8904:        } else {
                   8905:                printf ("Test 01-b: Basic XML parsing, XML document position [ FAILED ]\n  (CODE: %d) %s\n",
                   8906:                        axl_error_get_code (error), axl_error_get (error));
                   8907:                axl_error_free (error);
                   8908:                return -1;
                   8909:        }
                   8910: 
                   8911:        if (test_01c (&error)) {
                   8912:                printf ("Test 01-c: Basic XML parsing, XML document traversing [   OK   ]\n");
                   8913:        } else {
                   8914:                printf ("Test 01-c: Basic XML parsing, XML document traversing [ FAILED ]\n  (CODE: %d) %s\n",
                   8915:                        axl_error_get_code (error), axl_error_get (error));
                   8916:                axl_error_free (error);
                   8917:                return -1;
                   8918:        }       
                   8919: 
                   8920:        if (test_01d (&error)) {
                   8921:                printf ("Test 01-d: Basic XML parsing, node nth access [   OK   ]\n");
                   8922:        } else {
                   8923:                printf ("Test 01-d: Basic XML parsing, node nth access [ FAILED ]\n  (CODE: %d) %s\n",
                   8924:                        axl_error_get_code (error), axl_error_get (error));
                   8925:                axl_error_free (error);
                   8926:                return -1;
                   8927:        }       
                   8928: 
                   8929:        if (test_01e (&error)) {
                   8930:                printf ("Test 01-e: Basic XML parsing, large content  [   OK   ]\n");
                   8931:        } else {
                   8932:                printf ("Test 01-e: Basic XML parsing, large content  [ FAILED ]\n   (CODE: %d) %s\n",
                   8933:                        axl_error_get_code (error), axl_error_get (error));
                   8934:                axl_error_free (error);
                   8935:                return -1;
                   8936:        } /* end if */
                   8937: 
                   8938:        if (test_01f (&error)) {
                   8939:                printf ("Test 01-f: Basic XML parsing, white space node content  [   OK   ]\n");
                   8940:        } else {
                   8941:                printf ("Test 01-f: Basic XML parsing, white space node content  [ 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:        } /* end if */
                   8946: 
                   8947:        if (test_02 (&error))
                   8948:                printf ("Test 02: basic xml error detection [   OK   ]\n");
                   8949:        else {
                   8950:                printf ("Test 02: basic xml error detection [ 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_03 (&error))
                   8957:                printf ("Test 03: complex xml error detection [   OK   ]\n");
                   8958:        else {
                   8959:                printf ("Test 03: complex xml error detection [ 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_04 (&error))
                   8966:                printf ("Test 04: complex xml parsing [   OK   ]\n");
                   8967:        else {
                   8968:                printf ("Test 04: complex xml parsing [ 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_05 (&error))
                   8975:                printf ("Test 05: DTD basic parsing [   OK   ]\n");
                   8976:        else {
                   8977:                printf ("Test 05: DTD basic parsing [ 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_06 (&error))
                   8984:                printf ("Test 06: DTD basic parsing (2) [   OK   ]\n");
                   8985:        else {
                   8986:                printf ("Test 06: DTD basic parsing (2) [ 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:        }       
                   8991: 
                   8992:        if (test_07 (&error)) 
                   8993:                printf ("Test 07: DTD validation (I) [   OK   ]\n");
                   8994:        else {
                   8995:                printf ("Test 07: DTD validation (I) [ 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:        }       
                   9000: 
                   9001:        if (test_08 (&error)) 
                   9002:                printf ("Test 08: Large XML file loading [   OK   ]\n");
                   9003:        else {
                   9004:                printf ("Test 08: Large XML file loading [ 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: 
                   9011: 
                   9012:        if (test_09 (&error)) 
                   9013:                printf ("Test 09: Complex DTD validation [   OK   ]\n");
                   9014:        else {
                   9015:                printf ("Test 09: Complex DTD validation [ FAILED ]\n  (CODE: %d) %s\n",
                   9016:                        axl_error_get_code (error), axl_error_get (error));
                   9017:                axl_error_free (error);
                   9018:                return -1;
                   9019:        }
                   9020: 
                   9021: 
                   9022:        if (test_10 (&error)) 
                   9023:                printf ("Test 10: Complex DTD validation (II) [   OK   ]\n");
                   9024:        else {
                   9025:                printf ("Test 10: Complex DTD validation (II) [ FAILED ]\n  (CODE: %d) %s\n",
                   9026:                        axl_error_get_code (error), axl_error_get (error));
                   9027:                axl_error_free (error);
                   9028:                return -1;
                   9029:        }
                   9030: 
                   9031:        if (test_11 (&error)) 
                   9032:                printf ("Test 11: Complex DTD validation (III) [   OK   ]\n");
                   9033:        else {
                   9034:                printf ("Test 11: Complex DTD validation (III) [ FAILED ]\n  (CODE: %d) %s\n",
                   9035:                        axl_error_get_code (error), axl_error_get (error));
                   9036:                axl_error_free (error);
                   9037:                return -1;
                   9038:        }       
                   9039: 
                   9040:        if (test_12 (&error)) 
                   9041:                printf ("Test 12: Complex DTD validation (IV) [   OK   ]\n");
                   9042:        else {
                   9043:                printf ("Test 12: Complex DTD validation (IV) [ FAILED ]\n  (CODE: %d) %s\n",
                   9044:                        axl_error_get_code (error), axl_error_get (error));
                   9045:                axl_error_free (error);
                   9046:                return -1;
                   9047:        }       
                   9048:        
                   9049:        if (test_13 (&error)) 
                   9050:                printf ("Test 13: XML memory dumping [   OK   ]\n");
                   9051:        else {
                   9052:                printf ("Test 13: XML memory dumping [ FAILED ]\n  (CODE: %d) %s\n",
                   9053:                        axl_error_get_code (error), axl_error_get (error));
                   9054:                axl_error_free (error);
                   9055:                return -1;
                   9056:        }       
                   9057: 
                   9058:        if (test_14 (&error)) {
                   9059:                printf ("Test 14: quotation and escape sequences (&,',\",<,>) [   OK   ]\n");
                   9060:        } else {
                   9061:                printf ("Test 14: quotation and escape sequences (&,',\",<,>) [ FAILED ]\n  (CODE: %d) %s\n",
                   9062:                        axl_error_get_code (error), axl_error_get (error));
                   9063:                axl_error_free (error);
                   9064:                return -1;
                   9065:        }       
                   9066: 
                   9067:        if (test_15 (&error)) {
                   9068:                printf ("Test 15: DTD validation fail checks (25/04/2006) [   OK   ]\n");
                   9069:        } else {
                   9070:                printf ("Test 15: DTD validation fail checks (25/04/2006) [ FAILED ]\n  (CODE: %d) %s\n",
                   9071:                        axl_error_get_code (error), axl_error_get (error));
                   9072:                axl_error_free (error);
                   9073:                return -1;
                   9074:        }       
                   9075: 
                   9076: 
                   9077:        if (test_16 (&error)) {
                   9078:                printf ("Test 16: DTD validation fail checks (03/05/2006) [   OK   ]\n");
                   9079:        } else {
                   9080:                printf ("Test 16: DTD validation fail checks (03/05/2006) [ FAILED ]\n  (CODE: %d) %s\n",
                   9081:                        axl_error_get_code (error), axl_error_get (error));
                   9082:                axl_error_free (error);
                   9083:                return -1;
                   9084:        }       
                   9085: 
                   9086:        if (test_17 (&error)) {
                   9087:                printf ("Test 17: DTD validation fail checks (02/07/2006) [   OK   ]\n");
                   9088:        } else {
                   9089:                printf ("Test 17: DTD validation fail checks (02/07/2006) [ FAILED ]\n  (CODE: %d) %s\n",
                   9090:                        axl_error_get_code (error), axl_error_get (error));
                   9091:                axl_error_free (error);
                   9092:                return -1;
                   9093:        }       
                   9094: 
                   9095:        if (test_18 (&error)) {
                   9096:                printf ("Test 18: DTD ENTITY support [   OK   ]\n");
                   9097:        } else {
                   9098:                printf ("Test 18: DTD ENTITY support [ FAILED ]\n  (CODE: %d) %s\n",
                   9099:                        axl_error_get_code (error), axl_error_get (error));
                   9100:                axl_error_free (error);
                   9101:                return -1;
                   9102:        }       
                   9103: 
                   9104:        if (test_19 (&error)) {
                   9105:                printf ("Test 19: Axl document node replacing [   OK   ]\n");
                   9106:        } else {
                   9107:                printf ("Test 19: Axl document node replacing [ FAILED ]\n  (CODE: %d) %s\n",
                   9108:                        axl_error_get_code (error), axl_error_get (error));
                   9109:                axl_error_free (error);
                   9110:                return -1;
                   9111:        }       
                   9112: 
                   9113: 
                   9114:        if (test_20 (&error)) {
                   9115:                printf ("Test 20: Axl node copy and anotation data [   OK   ]\n");
                   9116:        } else {
                   9117:                printf ("Test 20: Axl node copy and anotation data [ FAILED ]\n  (CODE: %d) %s\n",
                   9118:                        axl_error_get_code (error), axl_error_get (error));
                   9119:                axl_error_free (error);
                   9120:                return -1;
                   9121:        }       
                   9122: 
                   9123:        if (test_20b (&error)) {
                   9124:                printf ("Test 20b: Axl node copy 2 [   OK   ]\n");
                   9125:        } else {
                   9126:                printf ("Test 20b: Axl node copy 2 [ FAILED ]\n  (CODE: %d) %s\n",
                   9127:                        axl_error_get_code (error), axl_error_get (error));
                   9128:                axl_error_free (error);
                   9129:                return -1;
                   9130:        }       
                   9131: 
                   9132:        if (test_21 (&error)) {
                   9133:                printf ("Test 21: Axl node mixed content [   OK   ]\n");
                   9134:        } else {
                   9135:                printf ("Test 21: Axl node mixed content [ FAILED ]\n  (CODE: %d) %s\n",
                   9136:                        axl_error_get_code (error), axl_error_get (error));
                   9137:                axl_error_free (error);
                   9138:                return -1;
                   9139:        }       
                   9140: 
                   9141:        if (test_22 (&error)) {
                   9142:                printf ("Test 22: Axl node attributes [   OK   ]\n");
                   9143:        } else {
                   9144:                printf ("Test 22: Axl node attributes [ FAILED ]\n  (CODE: %d) %s\n",
                   9145:                        axl_error_get_code (error), axl_error_get (error));
                   9146:                axl_error_free (error);
                   9147:                return -1;
                   9148:        }
                   9149: 
                   9150:        if (test_23 (&error)) {
                   9151:                printf ("Test 23: Axl item modification [   OK   ]\n");
                   9152:        } else {
                   9153:                printf ("Test 23: Axl item modification [ FAILED ]\n  (CODE: %d) %s\n",
                   9154:                        axl_error_get_code (error), axl_error_get (error));
                   9155:                axl_error_free (error);
                   9156:                return -1;
                   9157:        }
                   9158: 
                   9159:        if (test_24 (&error)) {
                   9160:                printf ("Test 24: Invalid sequences detection [   OK   ]\n");
                   9161:        }else {
                   9162:                printf ("Test 24: Invalid sequences detection [ FAILED ]\n  (CODE: %d) %s\n",
                   9163:                        axl_error_get_code (error), axl_error_get (error));
                   9164:                axl_error_free (error);
                   9165:                return -1;
                   9166:        }
                   9167: 
                   9168:        if (test_25 (&error)) {
                   9169:                printf ("Test 25: Lookup functions [   OK   ]\n");
                   9170:        }else {
                   9171:                printf ("Test 25: Lookup [ 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: #ifdef AXL_NS_SUPPORT
                   9178:        if (test_26 (&error)) {
                   9179:                printf ("Test 26: Namespace support (basic) [   OK   ]\n");
                   9180:        }else {
                   9181:                printf ("Test 26: Namespace support (basic) [ FAILED ]\n  (CODE: %d) %s\n",
                   9182:                        axl_error_get_code (error), axl_error_get (error));
                   9183:                axl_error_free (error);
                   9184:                return -1;
                   9185:        }
                   9186: 
                   9187:        if (test_27 (&error)) {
                   9188:                printf ("Test 27: Namespace support [   OK   ]\n");
                   9189:        }else {
                   9190:                printf ("Test 27: Namespace support [ FAILED ]\n  (CODE: %d) %s\n",
                   9191:                        axl_error_get_code (error), axl_error_get (error));
                   9192:                axl_error_free (error);
                   9193:                return -1;
                   9194:        }
                   9195: 
                   9196:        if (test_28 (&error)) {
                   9197:                printf ("Test 28: Namespace defaulting support [   OK   ]\n");
                   9198:        }else {
                   9199:                printf ("Test 28: Namespace defaulting support [ FAILED ]\n  (CODE: %d) %s\n",
                   9200:                        axl_error_get_code (error), axl_error_get (error));
                   9201:                axl_error_free (error);
                   9202:                return -1;
                   9203:        }
                   9204: 
                   9205:        if (test_29 (&error)) {
                   9206:                printf ("Test 29: Namespace lookup support [   OK   ]\n");
                   9207:        }else {
                   9208:                printf ("Test 29: Namespace lookup support [ FAILED ]\n  (CODE: %d) %s\n",
                   9209:                        axl_error_get_code (error), axl_error_get (error));
                   9210:                axl_error_free (error);
                   9211:                return -1;
                   9212:        }
                   9213: 
                   9214: #endif /* end #ifdef AXL_NS_SUPPORT */ 
                   9215: 
                   9216:        if (test_30 (&error)) {
                   9217:                printf ("Test 30: DTD attribute validation support [   OK   ]\n");
                   9218:        }else {
                   9219:                printf ("Test 30: DTD attribute validation support [ FAILED ]\n  (CODE: %d) %s\n",
                   9220:                        axl_error_get_code (error), axl_error_get (error));
                   9221:                axl_error_free (error);
                   9222:                return -1;
                   9223:        }
                   9224: 
                   9225:        if (test_31 (&error)) {
                   9226:                printf ("Test 31: DTD attribute validation (ID support) [   OK   ]\n");
                   9227:        }else {
                   9228:                printf ("Test 31: DTD attribute validation (ID support) [ FAILED ]\n  (CODE: %d) %s\n",
                   9229:                        axl_error_get_code (error), axl_error_get (error));
                   9230:                axl_error_free (error);
                   9231:                return -1;
                   9232:        }
                   9233: 
                   9234:        if (test_32 (&error)) {
                   9235:                printf ("Test 32: DTD attribute validation (IDREF support) [   OK   ]\n");
                   9236:        }else {
                   9237:                printf ("Test 32: DTD attribute validation (IDREF support) [ FAILED ]\n  (CODE: %d) %s\n",
                   9238:                        axl_error_get_code (error), axl_error_get (error));
                   9239:                axl_error_free (error);
                   9240:                return -1;
                   9241:        }
                   9242:        
                   9243:        if (test_33 (&error)) {
                   9244:                printf ("Test 33: Recursive root node replace [   OK   ]\n");
                   9245:        }else {
                   9246:                printf ("Test 33: Recursive root node replace [ FAILED ]\n  (CODE: %d) %s\n",
                   9247:                        axl_error_get_code (error), axl_error_get (error));
                   9248:                axl_error_free (error);
                   9249:                return -1;
                   9250:        }
                   9251: 
                   9252:        if (test_34 (&error)) {
                   9253:                printf ("Test 34: axl trim bug (19/06/2007) [   OK   ]\n");
                   9254:        }else {
                   9255:                printf ("Test 34: axl trim bug (19/06/2007) [ FAILED ]\n  (CODE: %d) %s\n",
                   9256:                        axl_error_get_code (error), axl_error_get (error));
                   9257:                axl_error_free (error);
                   9258:                return -1;
                   9259:        }
                   9260: 
                   9261:        if (test_35 (&error)) {
                   9262:                printf ("Test 35: axl_doc_parse_from_file bug (20/06/2007) [   OK   ]\n");
                   9263:        }else {
                   9264:                printf ("Test 35: axl_doc_parse_from_file bug (20/06/2007) [ FAILED ]\n  (CODE: %d) %s\n",
                   9265:                        axl_error_get_code (error), axl_error_get (error));
                   9266:                axl_error_free (error);
                   9267:                return -1;
                   9268:        }
                   9269: 
                   9270:        if (test_36 (&error)) {
                   9271:                printf ("Test 36: deattach root node [   OK   ]\n");
                   9272:        }else {
                   9273:                printf ("Test 36: deattach root node [ 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_37 (&error)) {
                   9280:                printf ("Test 37: clearing xml node content [   OK   ]\n");
                   9281:        }else {
                   9282:                printf ("Test 37: clearing xml node content [ 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_38 (&error)) {
                   9289:                printf ("Test 38: IDREF dtd error found (23/06/2007) [   OK   ]\n");
                   9290:        }else {
                   9291:                printf ("Test 38: IDREF dtd error found (23/06/2007) [ 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_39 (&error)) {
                   9298:                printf ("Test 39: Inline dtd support [   OK   ]\n");
                   9299:        }else {
                   9300:                printf ("Test 39: Inline dtd support [ 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_40 (&error)) {
                   9307:                printf ("Test 40: Avoid recursive content inclusion into coments  [   OK   ]\n");
                   9308:        }else {
                   9309:                printf ("Test 40: Avoid recursive content inclusion into coments  [ 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_41 (&error)) {
                   9316:                printf ("Test 41: Extended encoding support (through axl-babel)  [   OK   ]\n");
                   9317:        }else {
                   9318:                printf ("Test 41: Extended encoding support (through axl-babel)  [ 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_42 (&error)) {
                   9325:                printf ("Test 42: Checking nested CDATA support (including ']]>', '<![CDATA[' or xml documents with '<![CDATA[..]]>' decls) [   OK   ]\n");
                   9326:        }else {
                   9327:                printf ("Test 42: Checking nested CDATA support CDATA declaration (including ']]>', '<![CDATA[' or xml documents with '<![CDATA[..]]>' decls) [ 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_43 (&error)) {
                   9334:                printf ("Test 43: Memory leak check with root nodes [   OK   ]\n");
                   9335:        }else {
                   9336:                printf ("Test 43: Memory leak check with root nodes [ 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_44 (&error)) {
                   9343:                printf ("Test 44: DTD fix (optional child after one to many child spec) [   OK   ]\n");
                   9344:        }else {
                   9345:                printf ("Test 44: DTD fix (optional child after one to many child spec) [ 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_45 (&error)) {
                   9352:                printf ("Test 45: Fix attribute added twice [   OK   ]\n");
                   9353:        }else {
                   9354:                printf ("Test 45: Fix attribute added twice [ 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:        /* cleanup axl library */
                   9361:        axl_end ();
                   9362:        return 0;
                   9363: }

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