5 #include "test-helper.h"
7 #define DEBUG_FLAG EMPATHY_DEBUG_TESTS
8 #include <libempathy/empathy-debug.h>
10 #include <libempathy-gtk/empathy-live-search.h>
16 gboolean should_match;
20 test_live_search (void)
22 LiveSearchTest tests[] =
24 /* Test word separators and case */
25 { "Hello World", "he", TRUE },
26 { "Hello World", "wo", TRUE },
27 { "Hello World", "lo", FALSE },
28 { "Hello World", "ld", FALSE },
29 { "Hello-World", "wo", TRUE },
30 { "HelloWorld", "wo", FALSE },
32 /* Test accentued letters */
33 { "Jörgen", "jor", TRUE },
34 { "Gaëtan", "gaetan", TRUE },
35 { "élève", "ele", TRUE },
36 { "Azais", "AzaÏs", TRUE },
39 { "Xavier Claessens", "Xav Cla", TRUE },
40 { "Xavier Claessens", "Cla Xav", TRUE },
41 { "Foo Bar Baz", " b ", TRUE },
42 { "Foo Bar Baz", "bar bazz", FALSE },
47 gboolean failed = FALSE;
50 for (i = 0; tests[i].string != NULL; i ++)
55 match = empathy_live_search_match_string (tests[i].string, tests[i].prefix);
56 ok = (match == tests[i].should_match);
58 DEBUG ("'%s' - '%s': %s", tests[i].string, tests[i].prefix, ok ? "OK" : "FAILED");
73 test_init (argc, argv);
75 g_test_add_func ("/live-search", test_live_search);
77 result = g_test_run ();