bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2016-2018 Dovecot authors, see the included COPYING file */
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainenstatic void test_message_search_more_get_decoded(void)
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen const unsigned char text_plain[] = "text/plain; charset=utf-8";
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen struct message_block raw_block, decoded_block;
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen unsigned int i;
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen test_begin("message_search_more_get_decoded()");
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen ctx1 = message_search_init("p\xC3\xA4\xC3\xA4", NULL, 0);
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen ctx2 = message_search_init("p\xC3\xB6\xC3\xB6", NULL, 0);
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen /* feed the Content-Type header */
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen hdr.name = "Content-Type"; hdr.name_len = strlen(hdr.name);
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen hdr.value_len = hdr.full_value_len = sizeof(text_plain)-1;
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen test_assert(!message_search_more_get_decoded(ctx1, &raw_block, &decoded_block));
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen test_assert(!message_search_more_decoded(ctx2, &decoded_block));
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen test_assert(!message_search_more_get_decoded(ctx1, &raw_block, &decoded_block));
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen test_assert(!message_search_more_decoded(ctx2, &decoded_block));
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen test_assert(!message_search_more_get_decoded(ctx1, &raw_block, &decoded_block));
121f820aeb2f25c563a5dcbcf353a7b0e9a7e6e1Timo Sirainen test_assert(message_search_more_decoded(ctx2, &decoded_block) == (input[i+1] == '\0'));
baf3e87e186453fda13bd21f7cbcb2efc8492e8bTimo Sirainen static void (*const test_functions[])(void) = {