Commit: 7f3c9e87be9ee8366bddcb10efa7cb6119a3bbd8
Parent: ff7308fc863e49dbf8835c92f363c93dbb93f241
Author: Randy Palamar
Date: Mon, 28 Oct 2024 11:15:23 -0600
fix tests on glibc/gcc
wcwidth is even worse than I thought. It doesn't work at all on
glibc (🀄 is an invalid codepoint??)
Diffstat:
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/build.sh b/build.sh
@@ -11,7 +11,7 @@ ldflags="-lm -lGL -lglfw"
testcflags="${cflags} -O0 -ggdb -D_DEBUG -UVERSION -DVERSION=test"
testcflags="${testcflags} -Wno-unused-variable -Wno-unused-function -Wno-undefined-internal"
-testcflags="${testcflags} -lm -static"
+testldflags="-lm -static"
[ ! -s "./config.h" ] && cp config.def.h config.h
@@ -27,4 +27,4 @@ if [ ${debug} ] && [ ${debug} != "0" ]; then
fi
${cc} $cflags -o vtgl main.c $ldflags
-${cc} ${testcflags} -o test test.c
+${cc} ${testcflags} -o test test.c ${testldflags}
diff --git a/test.c b/test.c
@@ -1,6 +1,4 @@
-#define _XOPEN_SOURCE 700 /* wcwidth */
#include <string.h> /* memcmp */
-#include <wchar.h> /* wcwidth */
#define GLFW_PRESS 1
#define GLFW_REPEAT 2
@@ -43,9 +41,9 @@ get_gpu_glyph_index(Arena a, void *b, void *c, u32 cp, u32 d, u32 e, CachedGlyph
{
/* TODO: this is wrong but will have to do for these tests */
static CachedGlyph scg;
- scg.tile_count = wcwidth(cp);
+ if (BETWEEN(cp, ' ', '~')) scg.tile_count = 1;
+ else scg.tile_count = 2;
*cg = &scg;
- ASSERT((char)scg.tile_count != -1);
}
#define ESC(a) s8("\x1B"#a)