[U-Boot] [PATCH 06/15] test: test printing Unicode
Heinrich Schuchardt
xypron.glpk at gmx.de
Sun Aug 26 18:36:42 UTC 2018
On 08/26/2018 08:06 PM, Alexander Graf wrote:
>
>
> On 11.08.18 17:28, Heinrich Schuchardt wrote:
>> Test printing of Unicode strings
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> ---
>> test/unicode_ut.c | 37 +++++++++++++++++++++++++++++++++++++
>> 1 file changed, 37 insertions(+)
>>
>> diff --git a/test/unicode_ut.c b/test/unicode_ut.c
>> index 29316606c4..8e8c4d189e 100644
>> --- a/test/unicode_ut.c
>> +++ b/test/unicode_ut.c
>> @@ -34,6 +34,42 @@ static const char d3[] = {0xe6, 0xbd, 0x9c, 0xe6, 0xb0, 0xb4, 0xe8, 0x89,
>> static const char d4[] = {0xf0, 0x90, 0x92, 0x8d, 0xf0, 0x90, 0x92, 0x96,
>> 0xf0, 0x90, 0x92, 0x87, 0x00};
>>
>> +static int ut_string16(void)
>> +{
>> +#if defined(CONFIG_EFI_LOADER) && \
>> + !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
>> + char buf[20];
>> +
>> + memset(buf, 0xff, sizeof(buf));
>> + sprintf(buf, "%8.6ls", c2);
>> + if (buf[1] != ' ')
>> + return -1;
>> + if (strncmp(&buf[2], d2, 7))
>> + return -1;
>> + if (buf[9])
>> + return -1;
>> +
>> + memset(buf, 0xff, sizeof(buf));
>> + sprintf(buf, "%8.6ls", c4);
>> + if (buf[4] != ' ')
>> + return -1;
>> + if (strncmp(&buf[5], d4, 12))
>> + return -1;
>> + if (buf[17])
>> + return -1;
>> +
>> + memset(buf, 0xff, sizeof(buf));
>> + sprintf(buf, "%-8.2ls", c4);
>> + if (strncmp(buf, d4, 8))
>> + return -1;
>> + if (buf[8] != ' ')
>> + return -1;
>> + if (buf[14])
>> + return -1;
>> +#endif
>
> Does this check the illegal character '?' case as well?
No. I can add this.
Best regards
Heinrich
>
>
> Alex
>
More information about the U-Boot
mailing list