Update comment at isds_get_box_list_archive()
[libisds.git] / test / offline / isds_document_free.c
blob4f9055803cb8f4d876bc0ba4f120b7e374c17bc5
1 #include "../test.h"
2 #include "isds.h"
4 static int test_isds_document_free(
5 struct isds_document **document) {
6 isds_document_free(document);
7 if (!document) PASS_TEST;
9 if (*document)
10 FAIL_TEST("isds_document_free() did not null pointer");
12 PASS_TEST;
16 int main(void) {
17 xmlNode node = { .type = XML_TEXT_NODE, .content = BAD_CAST "data" };
19 INIT_TEST("isds_document_free()");
20 if (isds_init())
21 ABORT_UNIT("isds_init() failed");
23 struct isds_document *document = NULL;
24 TEST("NULL", test_isds_document_free, NULL);
25 TEST("*NULL", test_isds_document_free, &document);
27 TEST_CALLOC(document);
28 TEST("Empty structure", test_isds_document_free, &document);
30 TEST_CALLOC(document);
31 document->is_xml = 0;
32 TEST_FILL_STRING(document->data);
33 TEST_FILL_STRING(document->dmMimeType);
34 TEST_FILL_STRING(document->dmFileGuid);
35 TEST_FILL_STRING(document->dmUpFileGuid);
36 TEST_FILL_STRING(document->dmFileDescr);
37 TEST_FILL_STRING(document->dmFormat);
38 TEST("Binary document", test_isds_document_free, &document);
40 TEST_CALLOC(document);
41 document->is_xml = 1;
42 document->xml_node_list = &node;
43 TEST_FILL_STRING(document->dmMimeType);
44 TEST_FILL_STRING(document->dmFileGuid);
45 TEST_FILL_STRING(document->dmUpFileGuid);
46 TEST_FILL_STRING(document->dmFileDescr);
47 TEST_FILL_STRING(document->dmFormat);
48 TEST("XML document", test_isds_document_free, &document);
50 isds_cleanup();
51 SUM_TEST();