From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2096.outbound.protection.outlook.com [40.92.58.96]) by sourceware.org (Postfix) with ESMTPS id 1F33D3858D33; Tue, 17 Oct 2023 22:50:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F33D3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=hotmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1F33D3858D33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.92.58.96 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697583046; cv=pass; b=KrG70Ik+0AlAfCesPaqJnNT6WjG1mNnEpnSy2z3SYJbN+dv6mGGoCLmioYgyHyfJFAgUmkAVpwOywe3uLGEcFqMpb0TfSxnebn2uJo9U4tf4S1F9e5iD1BmVCICouyE/GLwxuSJs9JA63BF6wFCzUM83ayNPOm2aUW7k28uYrUQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697583046; c=relaxed/simple; bh=DQ24qaOJphFe9yEUugrluBXFc6K7UaV8p4Qcy1xCO4s=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=DHFnB7YhUkAiWXUpbrtUQgzI0cPHB2Q0W4T0ynSEV+DAk1mGwy6suJ2hYWyXLTPxVv+Rm7Rz5ry6zqeLw0qqKgZohjoKzkbbjjlbYuAeVorQBclPlmh2Dgp0Ju5kjTlcSkrWtCAl9KvOc3zIIv43i898ZKi3K/ncMsq3l/gDjQA= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R8h/ZZTUAYekz9zIkSpMsi3lsJATEJBkzpdkAqd+upH7VnkQcZw2x/aieQRJDBRTGJE9K3nET8qOAZ9+lrVxTzFZoYqRJ94/fIunYDypREkvbDiWk3yWPp1KftfbgT13HDREtgiqBqqkHTHqtU7OeZfxHMFqwSfsCze/zqqYHt2xwpteMVDHFfqfDLEzR+3P7C5G94oIhSNntqRWHWWgkJ0e0jGpn9da9DYVt/mrdn54Lmfyb+deSrtbZnGGFg0NtUJfkGODxzQsk3n9Z8yjagfs7jeVCYb8rY170fKUf7r9N201Bxqzdd3iD7/NtkgF3RD8CmIJ40iGdWu13RDdMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pBLZ/RuL0pMG+2SzZs1ZNJt8+P0z+nPsDDN9XYpRyNI=; b=CvGVT4tjhc1v08wsNHFOLhxmRZ1vHLtBDCMZf2KPDv2giCKp5EOu1DsYwSljwzsG5GNgTisdLnYa2Vgll5qCf8bsi9RiJ3KCsu2CEPBP0cytIGJlNTMTHvoCP8cfMTOubk7/Dpd5JpR6lxSRt8kHqlVQ5WRa+bk5uEGxKifWBSV0jSTAVc/e02uWkrRC2SbzEkxjeQqNlNAcYjxJpb+BGdlMrDI7xdCdEsyRQ8/dTx4CUioxTSlaatOdETVmwMH+rcl9mNK/+BqPGpAMYTojJP28ri7t9nUHNqTz1c4/QZV30bbJH8ZgJLgWLizXJRV+XOCrg6m3Ko71E8Hx8mtPQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pBLZ/RuL0pMG+2SzZs1ZNJt8+P0z+nPsDDN9XYpRyNI=; b=Aa3CIn05w5KL350Dw1a/LoXKIIR5UqiqBrZxumVt5YLhp4UXLwrowncY3o0w5oEiyRfh7JitlKYhFimpF49mwBInHFMNsbUoZuNokW3E5qejkAn+OSw5lNdOb2iC1kh0p7KHTD/iS650MH15/Z2ZBV2JXuv6j8hXJtqP6jrqGbOnaz5HlCzIKOGmplJussKoMHBUlElvaqsJ5plX6VaaSIFRJCpZoUZmaNOIv2vM5b6ViFWR8QUWVx/t2n/V4mzYgbRMcyzupCkkqd2qkL8zsJX0cFla3uCz/RWj9FHxq6IAqHImI2gksMEupBvGZS7GN3Y2SxJl/VGyCdI+vBoEmw== Received: from AS1P192MB1620.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:4a0::7) by DB9P192MB1370.EURP192.PROD.OUTLOOK.COM (2603:10a6:10:293::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Tue, 17 Oct 2023 22:50:42 +0000 Received: from AS1P192MB1620.EURP192.PROD.OUTLOOK.COM ([fe80::f035:e341:1267:15e8]) by AS1P192MB1620.EURP192.PROD.OUTLOOK.COM ([fe80::f035:e341:1267:15e8%4]) with mapi id 15.20.6886.034; Tue, 17 Oct 2023 22:50:42 +0000 Message-ID: Subject: [PATCH] libstdc++: testsuite: Enhance codecvt_unicode with tests for length() From: Dimitrij Mijoski To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Date: Wed, 18 Oct 2023 00:50:40 +0200 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 X-TMN: [yVnIB9STNclTLa/uLeelHxTnXMVa7SZS] X-ClientProxiedBy: VI1P194CA0041.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:3c::30) To AS1P192MB1620.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:4a0::7) X-Microsoft-Original-Message-ID: <8361b170271d97cf9bca7b512bfb1b44f6b99b80.camel@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS1P192MB1620:EE_|DB9P192MB1370:EE_ X-MS-Office365-Filtering-Correlation-Id: e8c44737-1955-4c52-9fad-08dbcf637dc7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3WmVIns8ql0FEJEnDKZZIkn3MHz3o3zZ+MSXALXBAE3ZmnCRtr8hQhGlO0miEvAMVfVTQYaYXlNjK+HHgLdpzwpHhwJYHZsczyoP/yBbQfeir073wFLg8Xst7dRmPLufSVUPWp6WWt2rXM7BZMAHNVLY2uZdy4+tz7/9YNiEDUa07tVzO5jaxFg6RvFGuav3wvWtaknKwbevvgnR+bgNymh4pim4RamvlcfRvjZYNl9oZ9o/+Pry01fj8YLDuYX06uzGeGtay/kcMK2EmN4ll85WeYsveUQxkv/2vxMl7pIhYV3HLqJiiKs2arhWovtqjYQYrVvhZwTVp6GkZEZUBDmDcvZ3t7k3OUj6HL/lGOUi5nDBVTj9XJSLSbB2qCUcvmKYKGs06tp9w35bglDTbGzy64nxkm36HekYP+cxQMw6vXU78MwVBCz+Ckw8zi7eu6nC8o2Q2h+NRfdmnjnAUs9BTas+ufqlVb71faqkEF4ZjLMLawnwcSUqfJRCH6xny41mQaZ5zH8U3xbQkdawXhJq1BXF0nZJzJ0VAnSPPPA/EvHwLXQVIU8CUhQvefYm X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MjE4WEpPeFZtSVhCajNJa3dySXB1UUxqR25TUmZ5Uk9FdzEvQWJNbE4yNDlO?= =?utf-8?B?c1NqWXE0c2tzMGpGYjJFUmpraGdpcVY2R0x6eTFWWEVOMGxIRCtEZkxlU3Ju?= =?utf-8?B?MjRTRGNCV294U2Z6YkxuQ2IwVmhuSFhNdm1vZTh3QURVMXNxT29QTXRJWHJS?= =?utf-8?B?ek1QaEVaYllPVE1QWFhTOEJadTV2aWZnekwxeGJBaVl1N01zNTlxRXJZRlRE?= =?utf-8?B?c3Vmb0hhd1VsdUMvM3pDYlZkMExLNGU5NVRBMlk0YkNiRGhmN2Q5UythQXpX?= =?utf-8?B?cGhIbVl0eWphcThpOGxSUzBzMGxCMm5oYnFFYW5ZQ254dHpJem5hK3Z6OFJs?= =?utf-8?B?RmVidFZwL21BdG1KNUhwcHkxOUxvcjFyTmFvYnpOQ1ludVNRNGJpVVl3dXdJ?= =?utf-8?B?YXo1M1hnbkZTc2QrZklDTjg3QVRDTkt3ekVwZllJcjlTWjErbXozMldPRFFm?= =?utf-8?B?a3JFVVpib21OK2Fqb0h5TFZKbldPdlA4TkIzZElHUUdzZnJNY2NLSm4rZVR0?= =?utf-8?B?YUpwVFNSMm8xNG9sTUZsL1l4aUdhelRWUFV2YWgzZmU3c1pWR21xcVpwQUJR?= =?utf-8?B?KzBzaUpqK24rV3JVM0hxTXVFQzlnWHFFRXNlZDF6Wlh6ZUNKcmhjK0NWTk1q?= =?utf-8?B?aXFtaHdjMW5XNGdVcEdlRDRnOEF3a0M1Vk9VOC8zQ1h2TE8xWUxEK2piRmRq?= =?utf-8?B?UTk0Z3RkVE9uTTllc0tWRGh4SUtBU3JLS3hFbHFxMnc4UEhiZXUxVFlEcHhr?= =?utf-8?B?dzA1UUMzQ2ZpdTEwUTVCSjhIcVpmbkVHeVJ6a2tnUzdZb0JNTjVoRGRjSEcy?= =?utf-8?B?UGI2Ukl3V3RCZEw0MDFhQkNOQzVjSUNpS1NkbU5zWlplMmFESmlFMzFQaXFP?= =?utf-8?B?TkRKNnRaUHNVcVptNTYrSHQxQis3cUtaOGMyL3oxNHhWS1RFN3g3Zkllam9t?= =?utf-8?B?MS9odnRBZUFSOTdTK2RPekcxYWlKMUtBMnh1QmJ5bjNuMHBXdy9QLzVYdVJG?= =?utf-8?B?UmJuVVFkamZwZ1puM01uRlRCeDAzdjVEQTIyZUJzbUt6dUw5Ym9aRTA4M1cz?= =?utf-8?B?dGlzUDFhNXFnM1BRZUh2ZzBMM05XVm96bjdaUEI0NXFNNExtVG1HdW0zdWRR?= =?utf-8?B?UHkrUlRKQ2M4OG9zR2l5bG9hL2RpMUxkdHJZUWh1U1E1TkFqeGNkc09zOEpE?= =?utf-8?B?UEJ2WVpXcEoxc0Y0QVlmengyVC81WkVKRDl0dDFIVEYvR3BDTXgzeTVvR3pO?= =?utf-8?B?bXZCOFRzeURsblBqdVpnbWgzVjlxNkpNS2krUWxITkJrVEMwbkVrM0FKNFRW?= =?utf-8?B?dWNGbnhtelhSSElZeE4rVlJxM2FRbTVHcm83UnFFVUwyREpRYnk1dU1LQWNJ?= =?utf-8?B?b0lPMmtEaHZQZ3JhSHRkbWxhODc4eVhPM0xpVDlYWWt3TS9kdG9MRW5XUHJx?= =?utf-8?B?cE5MSDdjM2VMbUFWU0NSdVh1Z0RzYnZ2SWVzeW9iaWkrcXltTlRhaklZRHVM?= =?utf-8?B?YmFzRExBS25rdjdYaDNUZVBXNTgwVWxxL1FSa2g4L3dqdWhCQXk2dFNOMVg2?= =?utf-8?B?KzRxTytjSlZnbXhUcmR0SWZzS1c1TXdxQU1jNXMxNFVMLzhBWlJLUy80dHVn?= =?utf-8?B?TW5LOXZ6T1pTcU50UTk1d1VyYzJEWHc9PQ==?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-fb43a.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: e8c44737-1955-4c52-9fad-08dbcf637dc7 X-MS-Exchange-CrossTenant-AuthSource: AS1P192MB1620.EURP192.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 22:50:42.5142 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P192MB1370 X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: We can test codecvt::length() with the same data that we test codecvt::in(). For each call of in() we add another call to length(). Some additional small cosmentic changes are applied. libstdc++-v3/ChangeLog: * testsuite/22_locale/codecvt/codecvt_unicode.h: Test length() --- .../22_locale/codecvt/codecvt_unicode.h | 103 +++++++++++++++--- 1 file changed, 90 insertions(+), 13 deletions(-) diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.h b/l= ibstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.h index d3ae42fac..b3c257ec2 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.h +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.h @@ -17,7 +17,6 @@ =20 #include #include -#include #include =20 struct test_offsets_ok @@ -79,6 +78,10 @@ utf8_to_utf32_in_ok (const std::codecvt &cvt) VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.in_size); } =20 for (auto t : offsets) @@ -99,6 +102,10 @@ utf8_to_utf32_in_ok (const std::codecvt &cvt) VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, array_size (out)= ); + VERIFY (len =3D=3D t.in_size); } } =20 @@ -163,6 +170,10 @@ utf8_to_utf32_in_partial (const std::codecvt &cvt) =3D=3D 0); if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); } } =20 @@ -303,6 +314,10 @@ utf8_to_utf32_in_error (const std::codecvt &cvt) if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); =20 + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); + in[t.replace_pos] =3D old_char; } } @@ -334,7 +349,7 @@ utf32_to_utf8_out_ok (const std::codecvt &cvt) VERIFY (char_traits::length (in) =3D=3D 4); VERIFY (char_traits::length (exp) =3D=3D 10); =20 - const test_offsets_ok offsets[] =3D {{0, 0}, {1, 1}, {2, 3}, {3, 6}, {4,= 10}}; + test_offsets_ok offsets[] =3D {{0, 0}, {1, 1}, {2, 3}, {3, 6}, {4, 10}}; for (auto t : offsets) { ExternT out[array_size (exp) - 1] =3D {}; @@ -374,7 +389,7 @@ utf32_to_utf8_out_partial (const std::codecvt &cvt) VERIFY (char_traits::length (in) =3D=3D 4); VERIFY (char_traits::length (exp) =3D=3D 10); =20 - const test_offsets_partial offsets[] =3D { + test_offsets_partial offsets[] =3D { {1, 0, 0, 0}, // no space for first CP =20 {2, 1, 1, 1}, // no space for second CP @@ -528,6 +543,10 @@ utf8_to_utf16_in_ok (const std::codecvt &cvt) VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.in_size); } =20 for (auto t : offsets) @@ -548,6 +567,10 @@ utf8_to_utf16_in_ok (const std::codecvt &cvt) VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, array_size (out)= ); + VERIFY (len =3D=3D t.in_size); } } =20 @@ -617,6 +640,10 @@ utf8_to_utf16_in_partial (const std::codecvt &cvt) =3D=3D 0); if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); } } =20 @@ -757,6 +784,10 @@ utf8_to_utf16_in_error (const std::codecvt &cvt) if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); =20 + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); + in[t.replace_pos] =3D old_char; } } @@ -788,7 +819,7 @@ utf16_to_utf8_out_ok (const std::codecvt &cvt) VERIFY (char_traits::length (in) =3D=3D 5); VERIFY (char_traits::length (exp) =3D=3D 10); =20 - const test_offsets_ok offsets[] =3D {{0, 0}, {1, 1}, {2, 3}, {3, 6}, {5,= 10}}; + test_offsets_ok offsets[] =3D {{0, 0}, {1, 1}, {2, 3}, {3, 6}, {5, 10}}; for (auto t : offsets) { ExternT out[array_size (exp) - 1] =3D {}; @@ -828,7 +859,7 @@ utf16_to_utf8_out_partial (const std::codecvt &cvt) VERIFY (char_traits::length (in) =3D=3D 5); VERIFY (char_traits::length (exp) =3D=3D 10); =20 - const test_offsets_partial offsets[] =3D { + test_offsets_partial offsets[] =3D { {1, 0, 0, 0}, // no space for first CP =20 {2, 1, 1, 1}, // no space for second CP @@ -1005,6 +1036,10 @@ utf8_to_ucs2_in_ok (const std::codecvt &cvt) VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.in_size); } =20 for (auto t : offsets) @@ -1025,6 +1060,10 @@ utf8_to_ucs2_in_ok (const std::codecvt &cvt) VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, array_size (out)= ); + VERIFY (len =3D=3D t.in_size); } } =20 @@ -1081,6 +1120,10 @@ utf8_to_ucs2_in_partial (const std::codecvt &cvt) =3D=3D 0); if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); } } =20 @@ -1231,6 +1274,10 @@ utf8_to_ucs2_in_error (const std::codecvt &cvt) if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); =20 + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); + in[t.replace_pos] =3D old_char; } } @@ -1262,7 +1309,7 @@ ucs2_to_utf8_out_ok (const std::codecvt &cvt) VERIFY (char_traits::length (in) =3D=3D 3); VERIFY (char_traits::length (exp) =3D=3D 6); =20 - const test_offsets_ok offsets[] =3D {{0, 0}, {1, 1}, {2, 3}, {3, 6}}; + test_offsets_ok offsets[] =3D {{0, 0}, {1, 1}, {2, 3}, {3, 6}}; for (auto t : offsets) { ExternT out[array_size (exp) - 1] =3D {}; @@ -1302,7 +1349,7 @@ ucs2_to_utf8_out_partial (const std::codecvt &cvt) VERIFY (char_traits::length (in) =3D=3D 3); VERIFY (char_traits::length (exp) =3D=3D 6); =20 - const test_offsets_partial offsets[] =3D { + test_offsets_partial offsets[] =3D { {1, 0, 0, 0}, // no space for first CP =20 {2, 1, 1, 1}, // no space for second CP @@ -1499,6 +1546,10 @@ utf16_to_utf32_in_ok (const std::codecvt &cvt, VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.in_size); } =20 for (auto t : offsets) @@ -1519,6 +1570,10 @@ utf16_to_utf32_in_ok (const std::codecvt &cvt, VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, array_size (out)= ); + VERIFY (len =3D=3D t.in_size); } } =20 @@ -1535,7 +1590,6 @@ utf16_to_utf32_in_partial (const std::codecvt &cvt, =20 char in[array_size (input) * 2]; InternT exp[array_size (expected)]; - auto in_iter =3D begin (in); utf16_to_bytes (begin (input), end (input), begin (in), endianess); copy (begin (expected), end (expected), begin (exp)); =20 @@ -1582,6 +1636,10 @@ utf16_to_utf32_in_partial (const std::codecvt &cvt, =3D=3D 0); if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); } } =20 @@ -1656,6 +1714,10 @@ utf16_to_utf32_in_error (const std::codecvt &cvt, if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); =20 + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); + input[t.replace_pos] =3D old_char; } } @@ -1676,7 +1738,7 @@ utf32_to_utf16_out_ok (const std::codecvt &cvt, copy (begin (input), end (input), begin (in)); utf16_to_bytes (begin (expected), end (expected), begin (exp), endianess= ); =20 - const test_offsets_ok offsets[] =3D {{0, 0}, {1, 2}, {2, 4}, {3, 6}, {4,= 10}}; + test_offsets_ok offsets[] =3D {{0, 0}, {1, 2}, {2, 4}, {3, 6}, {4, 10}}; for (auto t : offsets) { char out[array_size (exp) - 2] =3D {}; @@ -1714,7 +1776,7 @@ utf32_to_utf16_out_partial (const std::codecvt &cvt, copy (begin (input), end (input), begin (in)); utf16_to_bytes (begin (expected), end (expected), begin (exp), endianess= ); =20 - const test_offsets_partial offsets[] =3D { + test_offsets_partial offsets[] =3D { {1, 0, 0, 0}, // no space for first CP {1, 1, 0, 0}, // no space for first CP =20 @@ -1858,6 +1920,10 @@ utf16_to_ucs2_in_ok (const std::codecvt &cvt, VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.in_size); } =20 for (auto t : offsets) @@ -1878,6 +1944,10 @@ utf16_to_ucs2_in_ok (const std::codecvt &cvt, VERIFY (char_traits::compare (out, exp, t.out_size) =3D=3D = 0); if (t.out_size < array_size (out)) VERIFY (out[t.out_size] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, array_size (out)= ); + VERIFY (len =3D=3D t.in_size); } } =20 @@ -1894,7 +1964,6 @@ utf16_to_ucs2_in_partial (const std::codecvt &cvt, =20 char in[array_size (input) * 2]; InternT exp[array_size (expected)]; - auto in_iter =3D begin (in); utf16_to_bytes (begin (input), end (input), begin (in), endianess); copy (begin (expected), end (expected), begin (exp)); =20 @@ -1933,6 +2002,10 @@ utf16_to_ucs2_in_partial (const std::codecvt &cvt, =3D=3D 0); if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); + + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); } } =20 @@ -2018,6 +2091,10 @@ utf16_to_ucs2_in_error (const std::codecvt &cvt, if (t.expected_out_next < array_size (out)) VERIFY (out[t.expected_out_next] =3D=3D 0); =20 + state =3D {}; + auto len =3D cvt.length (state, in, in + t.in_size, t.out_size); + VERIFY (len =3D=3D t.expected_in_next); + input[t.replace_pos] =3D old_char; } } @@ -2038,7 +2115,7 @@ ucs2_to_utf16_out_ok (const std::codecvt &cvt, copy (begin (input), end (input), begin (in)); utf16_to_bytes (begin (expected), end (expected), begin (exp), endianess= ); =20 - const test_offsets_ok offsets[] =3D {{0, 0}, {1, 2}, {2, 4}, {3, 6}}; + test_offsets_ok offsets[] =3D {{0, 0}, {1, 2}, {2, 4}, {3, 6}}; for (auto t : offsets) { char out[array_size (exp) - 2] =3D {}; @@ -2076,7 +2153,7 @@ ucs2_to_utf16_out_partial (const std::codecvt &cvt, copy (begin (input), end (input), begin (in)); utf16_to_bytes (begin (expected), end (expected), begin (exp), endianess= ); =20 - const test_offsets_partial offsets[] =3D { + test_offsets_partial offsets[] =3D { {1, 0, 0, 0}, // no space for first CP {1, 1, 0, 0}, // no space for first CP =20 --=20 2.34.1