1 #include <glib.h> 2 3 #include "xml.h" 4 5 #include "mock_prefs_common_get_use_shred.h" 6 #include "mock_prefs_common_get_flush_metadata.h" 7 8 #define DATADIR "data/" 9 10 static void test_xml_open_file_missing(void)11test_xml_open_file_missing(void) 12 { 13 XMLFile *xf = xml_open_file(DATADIR "missing.xml"); 14 g_assert_null(xf); 15 } 16 17 static void test_xml_open_file_empty(void)18test_xml_open_file_empty(void) 19 { 20 XMLFile *xf = xml_open_file(DATADIR "empty.xml"); 21 g_assert_nonnull(xf); 22 g_assert_nonnull(xf->buf); 23 g_assert_nonnull(xf->bufp); 24 g_assert_null(xf->dtd); 25 g_assert_null(xf->encoding); 26 g_assert_null(xf->tag_stack); 27 g_assert_cmpint(xf->level, ==, 0); 28 g_assert_false(xf->is_empty_element); 29 } 30 31 int main(int argc,char * argv[])32main(int argc, char *argv[]) 33 { 34 g_test_init(&argc, &argv, NULL); 35 36 g_test_add_func("/common/xml_open_file_missing", test_xml_open_file_missing); 37 g_test_add_func("/common/xml_open_file_empty", test_xml_open_file_empty); 38 39 return g_test_run(); 40 } 41