10 gboolean should_match
;
18 /* Test word separators and case */
19 { "Hello World", "he", TRUE
},
20 { "Hello World", "wo", TRUE
},
21 { "Hello World", "lo", FALSE
},
22 { "Hello World", "ld", FALSE
},
23 { "Hello-World", "wo", TRUE
},
24 { "HelloWorld", "wo", FALSE
},
26 /* Test composed chars (accentued letters) */
27 { "Jörgen", "jor", TRUE
},
28 { "Gaëtan", "gaetan", TRUE
},
29 { "élève", "ele", TRUE
},
30 { "Azais", "AzaÏs", FALSE
},
31 { "AzaÏs", "Azais", TRUE
},
33 /* Test decomposed chars, they looks the same, but are actually
34 * composed of multiple unicodes */
35 { "Jorgen", "Jör", FALSE
},
36 { "Jörgen", "jor", TRUE
},
38 /* Turkish special case */
39 { "İstanbul", "ist", TRUE
},
40 { "Diyarbakır", "diyarbakir", TRUE
},
43 { "Xavier Claessens", "Xav Cla", TRUE
},
44 { "Xavier Claessens", "Cla Xav", TRUE
},
45 { "Foo Bar Baz", " b ", TRUE
},
46 { "Foo Bar Baz", "bar bazz", FALSE
},
52 setlocale(LC_ALL
, "");
55 for (i
= 0; tests
[i
].string
!= NULL
; i
++)
60 match
= g_str_match_string (tests
[i
].prefix
, tests
[i
].string
, TRUE
);
61 ok
= (match
== tests
[i
].should_match
);
63 g_debug ("'%s' - '%s' %s: %s", tests
[i
].prefix
, tests
[i
].string
,
64 tests
[i
].should_match
? "should match" : "should NOT match",
65 ok
? "OK" : "FAILED");
75 g_test_init (&argc
, &argv
, NULL
);
77 g_test_add_func ("/search", test_search
);