mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-30 08:20:28 -05:00
test_unicode_norm: fix display of failing tests.
There was a bytes / array elements confusion in the code that prints out the input and output Unicode strings when a test fails. It was using a loop with index variable 'pos', which was used as an array index, but incremented by sizeof(a character) each time, leading to only every fourth character actually being printed. I assume this is leftover confusion from when I hadn't quite decided whether to abuse the char-based strbuf for these Unicode character buffers, or make a specialist type. Discovered when I reached for this test program just now in order to manually decompose a Unicode string. It doesn't have a convenient CLI for that, but it was a thing I already knew where to find!
This commit is contained in:
parent
7a100534d3
commit
6332497afb
@ -341,13 +341,13 @@ static void subtest(const char *filename, int lineno, const char *subdesc,
|
|||||||
pass++;
|
pass++;
|
||||||
} else {
|
} else {
|
||||||
printf("%s:%d: failed %s: NF%c([", filename, lineno, subdesc, nftype);
|
printf("%s:%d: failed %s: NF%c([", filename, lineno, subdesc, nftype);
|
||||||
for (size_t pos = 0; pos < input->len; pos += sizeof(uchar))
|
for (size_t pos = 0; pos < input->len; pos++)
|
||||||
printf("%s%04X", pos ? " " : "", (unsigned)input->buf[pos]);
|
printf("%s%04X", pos ? " " : "", (unsigned)input->buf[pos]);
|
||||||
printf("]) -> [");
|
printf("]) -> [");
|
||||||
for (size_t pos = 0; pos < nf->len; pos += sizeof(uchar))
|
for (size_t pos = 0; pos < nf->len; pos++)
|
||||||
printf("%s%04X", pos ? " " : "", (unsigned)nf->buf[pos]);
|
printf("%s%04X", pos ? " " : "", (unsigned)nf->buf[pos]);
|
||||||
printf("] != [");
|
printf("] != [");
|
||||||
for (size_t pos = 0; pos < expected->len; pos += sizeof(uchar))
|
for (size_t pos = 0; pos < expected->len; pos++)
|
||||||
printf("%s%04X", pos ? " " : "", (unsigned)expected->buf[pos]);
|
printf("%s%04X", pos ? " " : "", (unsigned)expected->buf[pos]);
|
||||||
printf("]\n");
|
printf("]\n");
|
||||||
fail++;
|
fail++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user