From: Teemu Huovila Date: Mon, 1 Jun 2015 15:35:58 +0000 (+0300) Subject: lib-fts: Fix unit tests for TR29 full stop change. X-Git-Tag: 2.2.19.rc1~427 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdf70410de49eadfbb77997bb60ebba19aee4752;p=thirdparty%2Fdovecot%2Fcore.git lib-fts: Fix unit tests for TR29 full stop change. --- diff --git a/src/lib-fts/test-fts-tokenizer.c b/src/lib-fts/test-fts-tokenizer.c index 9668b7a86a..3aaf49f232 100644 --- a/src/lib-fts/test-fts-tokenizer.c +++ b/src/lib-fts/test-fts-tokenizer.c @@ -165,13 +165,13 @@ static void test_fts_tokenizer_generic_tr29_only(void) static const char *const expected_output[] = { "hello", "world", "And", "there", "was", "text", "galore", - "abc", "example.com", "Bar", "Baz", - "bar", "example.org", "foo", "domain", + "abc", "example", "com", "Bar", "Baz", + "bar", "example", "org", "foo", "domain", "1234567890123456789012345678ä", "12345678901234567890123456789", "123456789012345678901234567890", "and", "longlonglongabcdefghijklmnopqr", - "more", "Hello", "world", "3.14", "3,14", "last", NULL, + "more", "Hello", "world", "3", "14", "3,14", "last", NULL, "1", NULL, @@ -213,7 +213,7 @@ static void test_fts_tokenizer_address_only(void) test_end(); } -static void test_fts_tokenizer_address_parent(void) +static void test_fts_tokenizer_address_parent(const char *name, const char * const *settings) { static const char input[] = TEST_INPUT_ADDRESS; static const char *const expected_output[] = { @@ -225,8 +225,8 @@ static void test_fts_tokenizer_address_parent(void) struct fts_tokenizer *tok, *gen_tok; const char *error; - test_begin("fts tokenizer email address + parent"); - test_assert(fts_tokenizer_create(fts_tokenizer_generic, NULL, NULL, &gen_tok, &error) == 0); + test_begin(t_strdup_printf("fts tokenizer email address + parent %s", name)); + test_assert(fts_tokenizer_create(fts_tokenizer_generic, NULL, settings, &gen_tok, &error) == 0); test_assert(fts_tokenizer_create(fts_tokenizer_email_address, gen_tok, NULL, &tok, &error) == 0); test_tokenizer_inputoutput(tok, input, expected_output, 0); fts_tokenizer_unref(&tok); @@ -234,6 +234,17 @@ static void test_fts_tokenizer_address_parent(void) test_end(); } +const char *const simple_settings[] = {"algorithm", "simple", NULL}; +static void test_fts_tokenizer_address_parent_simple(void) +{ + test_fts_tokenizer_address_parent("simple", simple_settings); +} + +static void test_fts_tokenizer_address_parent_tr29(void) +{ + test_fts_tokenizer_address_parent("tr29", tr29_settings); +} + static void test_fts_tokenizer_address_search(void) { static const char input[] = TEST_INPUT_ADDRESS; @@ -288,7 +299,8 @@ int main(void) test_fts_tokenizer_generic_only, test_fts_tokenizer_generic_tr29_only, test_fts_tokenizer_address_only, - test_fts_tokenizer_address_parent, + test_fts_tokenizer_address_parent_simple, + test_fts_tokenizer_address_parent_tr29, test_fts_tokenizer_address_search, NULL };