summaryrefslogtreecommitdiff
path: root/tests/libebook/test-query.c
blob: 44b593dbb42bbb07c782bc7bd6893a8d5f431854 (plain)
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
#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;
}