END_TEST START_TEST (test_XMLNamespaces_get) { XMLNamespaces_add(NS, "http://test1.org/", "test1"); /* index 0 */ XMLNamespaces_add(NS, "http://test2.org/", "test2"); /* index 1 */ XMLNamespaces_add(NS, "http://test3.org/", "test3"); /* index 2 */ XMLNamespaces_add(NS, "http://test4.org/", "test4"); /* index 3 */ XMLNamespaces_add(NS, "http://test5.org/", "test5"); /* index 4 */ XMLNamespaces_add(NS, "http://test6.org/", "test6"); /* index 5 */ XMLNamespaces_add(NS, "http://test7.org/", "test7"); /* index 6 */ XMLNamespaces_add(NS, "http://test8.org/", "test8"); /* index 7 */ XMLNamespaces_add(NS, "http://test9.org/", "test9"); /* index 8 */ fail_unless( XMLNamespaces_getLength(NS) == 9 ); fail_unless( XMLNamespaces_getIndex(NS, "http://test1.org/") == 0 ); fail_unless( strcmp(XMLNamespaces_getPrefix(NS, 1), "test2") == 0 ); fail_unless( strcmp(XMLNamespaces_getPrefixByURI(NS, "http://test1.org/"), "test1") == 0 ); fail_unless( strcmp(XMLNamespaces_getURI(NS, 1), "http://test2.org/") == 0 ); fail_unless( strcmp(XMLNamespaces_getURIByPrefix(NS, "test2"), "http://test2.org/") == 0 ); fail_unless( XMLNamespaces_getIndex(NS, "http://test1.org/") == 0 ); fail_unless( XMLNamespaces_getIndex(NS, "http://test2.org/") == 1 ); fail_unless( XMLNamespaces_getIndex(NS, "http://test5.org/") == 4 ); fail_unless( XMLNamespaces_getIndex(NS, "http://test9.org/") == 8 ); fail_unless( XMLNamespaces_getIndex(NS, "http://testX.org/") == -1 ); fail_unless( XMLNamespaces_hasURI(NS, "http://test1.org/") != 0 ); fail_unless( XMLNamespaces_hasURI(NS, "http://test2.org/") != 0 ); fail_unless( XMLNamespaces_hasURI(NS, "http://test5.org/") != 0 ); fail_unless( XMLNamespaces_hasURI(NS, "http://test9.org/") != 0 ); fail_unless( XMLNamespaces_hasURI(NS, "http://testX.org/") == 0 ); fail_unless( XMLNamespaces_getIndexByPrefix(NS, "test1") == 0 ); fail_unless( XMLNamespaces_getIndexByPrefix(NS, "test5") == 4 ); fail_unless( XMLNamespaces_getIndexByPrefix(NS, "test9") == 8 ); fail_unless( XMLNamespaces_getIndexByPrefix(NS, "testX") == -1 ); fail_unless( XMLNamespaces_hasPrefix(NS, "test1") != 0 ); fail_unless( XMLNamespaces_hasPrefix(NS, "test5") != 0 ); fail_unless( XMLNamespaces_hasPrefix(NS, "test9") != 0 ); fail_unless( XMLNamespaces_hasPrefix(NS, "testX") == 0 ); fail_unless( XMLNamespaces_hasNS(NS, "http://test1.org/", "test1") != 0 ); fail_unless( XMLNamespaces_hasNS(NS, "http://test5.org/", "test5") != 0 ); fail_unless( XMLNamespaces_hasNS(NS, "http://test9.org/", "test9") != 0 ); fail_unless( XMLNamespaces_hasNS(NS, "http://testX.org/", "testX") == 0 ); }
END_TEST START_TEST (test_XMLNamespaces_accessWithNULL) { fail_unless( XMLNamespaces_add(NULL, NULL, NULL) == LIBSBML_INVALID_OBJECT); fail_unless( XMLNamespaces_clear(NULL) == LIBSBML_OPERATION_FAILED); fail_unless( XMLNamespaces_clone(NULL) == NULL); XMLNamespaces_free(NULL); fail_unless( XMLNamespaces_getIndex(NULL, NULL) == -1); fail_unless( XMLNamespaces_getIndexByPrefix(NULL, NULL) == -1); fail_unless( XMLNamespaces_getLength(NULL) == 0); fail_unless( XMLNamespaces_getPrefix(NULL, 0) == NULL); fail_unless( XMLNamespaces_getPrefixByURI(NULL, NULL) == NULL); fail_unless( XMLNamespaces_getURI(NULL, 0) == NULL); fail_unless( XMLNamespaces_getURIByPrefix(NULL, NULL) == NULL); fail_unless( XMLNamespaces_hasNS(NULL, NULL, NULL) == 0); fail_unless( XMLNamespaces_hasPrefix(NULL, NULL) == 0); fail_unless( XMLNamespaces_hasURI(NULL, NULL) == 0); fail_unless( XMLNamespaces_isEmpty(NULL) == 1); fail_unless( XMLNamespaces_remove(NULL, 0) == LIBSBML_INVALID_OBJECT); fail_unless( XMLNamespaces_removeByPrefix(NULL, NULL) == LIBSBML_INVALID_OBJECT); }