* update / add testcases for string normalization

This commit is contained in:
djcb
2012-12-09 13:34:16 +02:00
parent 58599ab8f9
commit 241af50e97
7 changed files with 59 additions and 94 deletions

View File

@ -120,6 +120,7 @@ EXTRA_DIST= \
testdir2/bar/new/.noindex \
testdir2/Foo/cur/mail5 \
testdir2/Foo/cur/arto.eml \
testdir2/Foo/cur/fraiche.eml \
testdir2/Foo/tmp/.noindex \
testdir2/Foo/new/.noindex \
testdir2/wom_bat/cur/atomic \

View File

@ -149,6 +149,9 @@ test_mu_str_normalize_02 (void)
for (i = 0; i != G_N_ELEMENTS(words); ++i) {
gchar *str;
if (g_test_verbose())
g_print ("[%s] <=> [%s] <=> [%s]\n", words[i].word, words[i].norm,
mu_str_normalize (words[i].word, FALSE, NULL));
str = mu_str_normalize (words[i].word, FALSE, NULL);
g_assert_cmpstr (str, ==, words[i].norm);
g_free (str);
@ -357,91 +360,13 @@ test_mu_str_to_list (void)
static void
test_mu_str_to_list_strip (void)
{
{
const char *items[]= {"foo", "bar", "cuux", NULL};
GSList *lst = mu_str_to_list ("foo@bar @cuux",'@', TRUE);
assert_cmplst (lst, items);
const char *items[]= {"foo", "bar", "cuux", NULL};
GSList *lst = mu_str_to_list ("foo@bar @cuux",'@', TRUE);
assert_cmplst (lst, items);
mu_str_free_list (lst);
}
}
/* static void */
/* test_mu_str_guess_first_name (void) */
/* { */
/* int i; */
/* struct { */
/* char *src, *exp; */
/* } tests[] = { */
/* { "Richard M. Stallman", "Richard M." }, */
/* { "John Rambo", "John" }, */
/* { "Ivanhoe", "Ivanhoe" }, */
/* { "", "" } */
/* }; */
/* for (i = 0; i != G_N_ELEMENTS(tests); ++i) { */
/* gchar *s; */
/* s = mu_str_guess_first_name (tests[i].src); */
/* g_assert_cmpstr (s, ==, tests[i].exp); */
/* g_free (s); */
/* } */
/* } */
/* static void */
/* test_mu_str_guess_last_name (void) */
/* { */
/* int i; */
/* struct { */
/* char *src, *exp; */
/* } tests[] = { */
/* { "Richard M. Stallman", "Stallman" }, */
/* { "John Rambo", "Rambo" }, */
/* { "Ivanhoe", "" }, */
/* { "", "" } */
/* }; */
/* for (i = 0; i != G_N_ELEMENTS(tests); ++i) { */
/* gchar *s; */
/* s = mu_str_guess_last_name (tests[i].src); */
/* g_assert_cmpstr (s, ==, tests[i].exp); */
/* g_free (s); */
/* } */
/* } */
/* static void */
/* test_mu_str_guess_nick (void) */
/* { */
/* int i; */
/* struct { */
/* char *src, *exp; */
/* } tests[] = { */
/* { "Richard M. Stallman", "RichardMS" }, */
/* { "John Rambo", "JohnR" }, */
/* { "Ivanhoe", "Ivanhoe" }, */
/* { "", "" } */
/* }; */
/* for (i = 0; i != G_N_ELEMENTS(tests); ++i) { */
/* gchar *s; */
/* s = mu_str_guess_nick (tests[i].src); */
/* g_assert_cmpstr (s, ==, tests[i].exp); */
/* g_free (s); */
/* } */
/* } */
static void
test_mu_str_subject_normalize (void)
{

View File

@ -0,0 +1,10 @@
From: Sender <test@example.com>
To: Recip <recip@example.com>
Subject: search accents
Date: 2012-12-08 00:48
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
line 1: Глокая куздра штеко будланула бокра и курдячит бокрёнка
line 2: crème fraîche