/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* * GData Client * Copyright (C) Philip Withnall 2010 * * GData Client is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * GData Client is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with GData Client. If not, see . */ #include #include "gdata.h" #include "common.h" static void test_parse_feed (void) { GDataFeed *feed; GError *error = NULL; feed = GDATA_FEED (gdata_parsable_new_from_xml (GDATA_TYPE_FEED, "" "http://example.com/id" "2009-02-25T14:07:37.880860Z" "Test feed" "Test subtitle" "http://example.com/logo.png" "http://example.com/icon.png" "" "" "" "" "" "" "Joe Smith" "j.smith@example.com" "" "Example Generator" "2" "0" "50" "" "entry1" "Testing unhandled XML" "2009-01-25T14:07:37.880860Z" "2009-01-23T14:06:37.880860Z" "Here we test unhandled XML elements." "" "" "entry2" "Testing unhandled XML 2" "2009-02-25T14:07:37.880860Z" "2009-02-23T14:06:37.880860Z" "Here we test unhandled XML elements again." "" "", -1, &error)); g_assert_no_error (error); g_assert (GDATA_IS_FEED (feed)); g_clear_error (&error); g_object_unref (feed); } int main (int argc, char *argv[]) { GTimeVal start_time, end_time; guint i; gdouble total_time; #define ITERATIONS 10000 #if !GLIB_CHECK_VERSION (2, 35, 0) g_type_init (); #endif /* Test feed parsing time */ g_get_current_time (&start_time); for (i = 0; i < ITERATIONS; i++) test_parse_feed (); g_get_current_time (&end_time); total_time = (gdouble) (end_time.tv_sec - start_time.tv_sec) + (gdouble) (end_time.tv_usec - start_time.tv_usec) / (gdouble) G_USEC_PER_SEC; g_message ("Parsing a feed %u times took:\n * Total: %fs\n * Per iteration: %fs", ITERATIONS, total_time, total_time / (gdouble) ITERATIONS); return 0; }