File: test-query.c

package info (click to toggle)
evolution-data-server 3.4.4-3%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 47,788 kB
  • sloc: ansic: 248,622; sh: 12,008; makefile: 2,874; xml: 428; perl: 204; python: 30
file content (38 lines) | stat: -rw-r--r-- 663 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <string.h>
#include <libebook/e-book-query.h>

#define QUERY_STRING1
#define QUERY_STRING2

static const gchar * queries[] = {
	"(exists \"full_name\")",
	"(contains \"full_name\" \"Miguel\")"

	/* XXX come on, add more here */
};

gint
main (gint argc,
      gchar **argv)
{
	gint i;
	gboolean failure = FALSE;

	for (i = 0; i < G_N_ELEMENTS (queries); i++) {
		EBookQuery *query = e_book_query_from_string (queries[i]);
		gchar *str;

		str = e_book_query_to_string (query);

		if (strcmp (str, queries[i])) {
			g_warning ("failed on query: %s", queries[i]);

			failure = TRUE;
		}
	}

	if (!failure)
	  g_message ("all tests passed");

	return 0;
}