Add missing trailing dot in sentences
[viking/guyou.git] / test / test_vikgotoxmltool.c
blobd48233fee3ef7ed57c21cbaf9c6efe52d19e1280
1 #include <math.h>
2 #include <vikgotoxmltool.h>
4 void parse(VikGotoTool *tool, gchar *filename)
6 struct LatLon ll;
7 ll.lat = NAN;
8 ll.lon = NAN;
9 if (vik_goto_tool_parse_file_for_latlon(tool, filename, &ll))
10 printf("Found %g %g in %s\n", ll.lat, ll.lon, filename);
11 else
12 printf("Failed to parse file %s\n", filename);
15 int main(int argc, char *argv[])
17 #if !GLIB_CHECK_VERSION (2, 36, 0)
18 g_type_init();
19 #endif
21 VikGotoXmlTool *with_element = VIK_GOTO_XML_TOOL ( g_object_new ( VIK_GOTO_XML_TOOL_TYPE, "label", "OSM",
22 "url-format", "http://ws.geonames.org/search?q=%s&maxRows=1&lang=es&style=short",
23 "lat-path", "/geonames/geoname/lat",
24 "lon-path", "/geonames/geoname/lng",
25 NULL ) );
27 VikGotoXmlTool *with_attr = VIK_GOTO_XML_TOOL ( g_object_new ( VIK_GOTO_XML_TOOL_TYPE, "label", "OSM",
28 "url-format", "http://ws.geonames.org/search?q=%s&maxRows=1&lang=es&style=short",
29 "lat-path", "/geonames/geoname",
30 "lat-attr", "lat",
31 "lon-path", "/geonames/geoname",
32 "lon-attr", "lng",
33 NULL ) );
35 VikGotoXmlTool *with_xpath = VIK_GOTO_XML_TOOL ( g_object_new ( VIK_GOTO_XML_TOOL_TYPE, "label", "OSM",
36 "url-format", "http://ws.geonames.org/search?q=%s&maxRows=1&lang=es&style=short",
37 "lat-path", "/geonames/geoname@lat",
38 "lon-path", "/geonames/geoname@lng",
39 NULL ) );
41 int i;
42 for (i = 1; i<argc ; i++)
44 parse(VIK_GOTO_TOOL(with_element), argv[i]);
45 parse(VIK_GOTO_TOOL(with_attr), argv[i]);
46 parse(VIK_GOTO_TOOL(with_xpath), argv[i]);
48 return 0;