Introduction
Introduction Statistics Contact Development Disclaimer Help
Reflect mirroring in the bidi-tests - libgrapheme - unicode string library
git clone git://git.suckless.org/libgrapheme
Log
Files
Refs
README
LICENSE
---
commit 719d805b28b9e34d5f5e83fcbdb0fbb41c20ec6d
parent a17b629bb30ac9c0e3e7343449dc42085bb2fc59
Author: Laslo Hunhold <[email protected]>
Date: Mon, 29 May 2023 10:37:49 +0200
Reflect mirroring in the bidi-tests
The bidi-tests do not contain mirrored test data, so we need to generate
it ad-hoc using the generated mirror-LUTs.
Signed-off-by: Laslo Hunhold <[email protected]>
Diffstat:
M test/bidirectional.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/test/bidirectional.c b/test/bidirectional.c
@@ -5,16 +5,27 @@
#include <stdio.h>
#include "../gen/bidirectional-test.h"
+#include "../gen/bidirectional.h"
#include "../gen/types.h"
#include "../grapheme.h"
#include "util.h"
+static inline int_least16_t
+get_mirror_offset(uint_least32_t cp)
+{
+ if (cp <= UINT32_C(0x10FFFF)) {
+ return mirror_minor[mirror_major[cp >> 8] + (cp & 0xFF)];
+ } else {
+ return 0;
+ }
+}
+
int
main(int argc, char *argv[])
{
enum grapheme_bidirectional_direction resolved;
- uint_least32_t data[512],
- output[512]; /* TODO iterate and get max, allocate */
+ uint_least32_t data[512], output[512],
+ target; /* TODO iterate and get max, allocate */
int_least8_t lev[512];
size_t i, num_tests, failed, datalen, levlen, outputlen, ret, j, m,
ret2;
@@ -75,10 +86,13 @@ main(int argc, char *argv[])
}
for (j = 0; j < ret2; j++) {
+ target = bidirectional_test[i]
+ .cp[bidirectional_test[i]
+ .reorder[j]];
if (output[j] !=
- bidirectional_test[i]
- .cp[bidirectional_test[i]
- .reorder[j]]) {
+ (uint_least32_t)((int_least32_t)target +
+ get_mirror_offset(
+ target))) {
goto err;
}
}
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.