diff options
| author | 2023-02-07 04:50:50 +0000 | |
|---|---|---|
| committer | 2023-02-07 04:50:50 +0000 | |
| commit | e0599bad23f3847d00ce38809d0bec6d8b692a6d (patch) | |
| tree | 00130f41a8435d62826741e812879c13e05ee049 /test_creole.c | |
| parent | encode (diff) | |
fixing precedence issue in test
Diffstat (limited to 'test_creole.c')
| -rw-r--r-- | test_creole.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/test_creole.c b/test_creole.c index 22a18b1..0c58780 100644 --- a/test_creole.c +++ b/test_creole.c @@ -81,11 +81,9 @@ TEST encode_byte_seq(struct seq *s) { unsigned char buf[7]; for (;;) { - /* printf("0x%X ", i); bprintb(s->minbuf, s->encode_to); printf("\n"); - */ ASSERT_EQ(creole_encode(i, s->encode_to, s->high_bits, buf), 1); @@ -151,6 +149,7 @@ SUITE(pseudo_utf8_encode_all) { for (s.high_bits = 0; s.high_bits < 16; s.high_bits++) { memset(s.maxbuf, 0xBF, sizeof(s.maxbuf)); + memset(s.minbuf, 0x80, sizeof(s.minbuf)); s.max = 0x7F; s.encode_to = 2; s.maxbuf[0] = s.minbuf[0] = 0xC0 | (s.high_bits << 1); @@ -158,54 +157,43 @@ SUITE(pseudo_utf8_encode_all) { s.minbuf[1] = 0x80; RUN_TEST1(encode_byte_seq, &s); + memset(s.minbuf, 0x80, sizeof(s.minbuf)); s.max = 0xFFF; s.encode_to = 3; s.minbuf[0] = 0xE0 | s.high_bits; s.maxbuf[0] = 0xE0 | s.high_bits; s.minbuf[1] = 0x80; - s.minbuf[2] = 0x80; RUN_TEST1(encode_byte_seq, &s); + memset(s.minbuf, 0x80, sizeof(s.minbuf)); s.max = 0x1FFFF; s.encode_to = 4; s.maxbuf[0] = s.minbuf[0] = 0xF0 | (s.high_bits >> 1); - s.minbuf[1] = 0x80 | (s.high_bits & 0x1 << 5); - s.maxbuf[1] = 0x9F | (s.high_bits & 0x1 << 5); - s.minbuf[2] = 0x80; - s.minbuf[3] = 0x80; + s.minbuf[1] = 0x80 | ((s.high_bits & 0x1) << 5); + s.maxbuf[1] = 0x9F | ((s.high_bits & 0x1) << 5); RUN_TEST1(encode_byte_seq, &s); + memset(s.minbuf, 0x80, sizeof(s.minbuf)); s.max = 0x3FFFFF; s.encode_to = 5; s.maxbuf[0] = s.minbuf[0] = 0xF8 | (s.high_bits >> 2); - s.minbuf[1] = 0x80 | (s.high_bits & 0x3 << 4); - s.maxbuf[1] = 0x8F | (s.high_bits & 0x3 << 4); - s.minbuf[2] = 0x80; - s.minbuf[3] = 0x80; - s.minbuf[4] = 0x80; - RUN_TEST1(encode_byte_seq, &s); + s.minbuf[1] = 0x80 | ((s.high_bits & 0x3) << 4); + s.maxbuf[1] = 0x8F | ((s.high_bits & 0x3) << 4); + memset(s.minbuf, 0x80, sizeof(s.minbuf)); s.max = 0x7FFFFFF; s.encode_to = 6; s.maxbuf[0] = s.minbuf[0] = 0xFC | (s.high_bits >> 3); - s.minbuf[1] = 0x80 | (s.high_bits & 0x7 << 3); - s.maxbuf[1] = 0x87 | (s.high_bits & 0x7 << 3); - s.minbuf[2] = 0x80; - s.minbuf[3] = 0x80; - s.minbuf[4] = 0x80; - s.minbuf[5] = 0x80; + s.minbuf[1] = 0x80 | ((s.high_bits & 0x7) << 3); + s.maxbuf[1] = 0x87 | ((s.high_bits & 0x7) << 3); RUN_TEST1(encode_byte_seq, &s); + memset(s.minbuf, 0x80, sizeof(s.minbuf)); s.max = 0xFFFFFFFF; s.encode_to = 7; s.maxbuf[0] = s.minbuf[0] = 0xFE; s.minbuf[1] = 0x80 | (s.high_bits << 2); s.maxbuf[1] = 0x83 | (s.high_bits << 2); - s.minbuf[2] = 0x80; - s.minbuf[3] = 0x80; - s.minbuf[4] = 0x80; - s.minbuf[5] = 0x80; - s.minbuf[6] = 0x80; RUN_TEST1(encode_byte_seq, &s); } } |
