test-unichar.c revision 9281d385594c4f158958977f1ead1d2270ef1a9e
5a580c3a38ced62d4bcc95b8ac7c4f2935b5d294Timo Sirainen/* Copyright (c) 2007-2013 Dovecot authors, see the included COPYING file */
9281d385594c4f158958977f1ead1d2270ef1a9eFlorian Zeitz static const char overlong_utf8[] = "\xf8\x80\x95\x81\xa1";
9281d385594c4f158958977f1ead1d2270ef1a9eFlorian Zeitz static const char collate_in[] = "\xc3\xbc \xc2\xb3";
9281d385594c4f158958977f1ead1d2270ef1a9eFlorian Zeitz static const char collate_exp[] = "U\xcc\x88 3";
86763e4c68313df83606e1060fc1795280590677Timo Sirainen test_assert(uni_utf8_str_is_valid(str_c(str)));
86763e4c68313df83606e1060fc1795280590677Timo Sirainen test_assert(uni_utf8_get_char(str_c(str), &chr2) > 0);
9281d385594c4f158958977f1ead1d2270ef1a9eFlorian Zeitz collate_out = buffer_create_dynamic(default_pool, 32);
9281d385594c4f158958977f1ead1d2270ef1a9eFlorian Zeitz uni_utf8_to_decomposed_titlecase(collate_in, sizeof(collate_in),
9281d385594c4f158958977f1ead1d2270ef1a9eFlorian Zeitz test_assert(!strcmp(collate_out->data, collate_exp));
86763e4c68313df83606e1060fc1795280590677Timo Sirainen test_assert(!uni_utf8_str_is_valid(overlong_utf8));