From: <dg...@su...> - 2009-01-06 01:27:53
|
Author: dgollub Date: Tue Jan 6 02:27:31 2009 New Revision: 5037 URL: http://www.opensync.org/changeset/5037 Log: Introduce trival testcases xmlformat_print and xmlformat_destory. Modified: format-plugins/xmlformat/trunk/tests/check_xmlformat.c Modified: format-plugins/xmlformat/trunk/tests/check_xmlformat.c ============================================================================== --- format-plugins/xmlformat/trunk/tests/check_xmlformat.c Tue Jan 6 02:17:21 2009 (r5036) +++ format-plugins/xmlformat/trunk/tests/check_xmlformat.c Tue Jan 6 02:27:31 2009 (r5037) @@ -18,6 +18,52 @@ } END_TEST +START_TEST (xmlformat_print) +{ + char *testbed = setup_testbed("xmlformats"); + + char *buffer, *print_buffer; + unsigned int size; + OSyncError *error = NULL; + + fail_unless(osync_file_read( "contact.xml", &buffer, &size, &error), NULL); + + OSyncXMLFormat *xmlformat = osync_xmlformat_parse(buffer, size, &error); + fail_unless(xmlformat != NULL, NULL); + fail_unless(error == NULL, NULL); + + fail_unless((print_buffer = print_xmlformat((char *)xmlformat, osync_xmlformat_size(), NULL)) != NULL, NULL); + + osync_free(print_buffer); + + osync_xmlformat_unref(xmlformat); + + destroy_testbed(testbed); +} +END_TEST + +START_TEST (xmlformat_destroy) +{ + char *testbed = setup_testbed("xmlformats"); + + char *buffer; + unsigned int size; + OSyncError *error = NULL; + + fail_unless(osync_file_read( "contact.xml", &buffer, &size, &error), NULL); + + OSyncXMLFormat *xmlformat = osync_xmlformat_parse(buffer, size, &error); + fail_unless(xmlformat != NULL, NULL); + fail_unless(error == NULL, NULL); + + destroy_xmlformat((char *)xmlformat, osync_xmlformat_size(), NULL); + + osync_xmlformat_unref(xmlformat); + + destroy_testbed(testbed); +} +END_TEST + START_TEST (xmlformat_compare_test) { char *testbed = setup_testbed("xmlformats"); @@ -258,6 +304,8 @@ // Suite *s2 = suite_create("XMLFormat"); create_case(s, "xmlformat_init", xmlformat_init); + create_case(s, "xmlformat_print", xmlformat_print); + create_case(s, "xmlformat_destroy", xmlformat_destroy); create_case(s, "xmlformat_compare_test", xmlformat_compare_test); create_case(s, "xmlformat_compare_field2null", xmlformat_compare_field2null); create_case(s, "xmlformat_compare_ignore_fields", xmlformat_compare_ignore_fields); |