test-nick-colors: fix and streamline

A recent addition of an N_ELEMENTS macro invocation broke it.
This commit is contained in:
Přemysl Eric Janouch 2021-06-25 06:35:00 +02:00
parent da5dd4eb91
commit f0281cf028
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 7 additions and 4 deletions

2
test
View File

@ -1,5 +1,5 @@
#!/usr/bin/expect -f #!/usr/bin/expect -f
# Very basic end-to-end testing for Travis CI # Very basic end-to-end testing for CI
# Run the daemon to test against # Run the daemon to test against
system ./kike --write-default-cfg system ./kike --write-default-cfg

View File

@ -1,12 +1,15 @@
#!/bin/sh #!/bin/sh
# Check whether the terminal colours filtered by our algorithm are legible # Check whether the terminal colours filtered by our algorithm are legible
export example=$( export example=$(
tcc "-run -lm" - <<-EOF tcc "-run -lm" - <<-END
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
$(perl -0777 -ne 'print $& if /^.*?\nfilter_color(?s:.*?)^}$/m' degesch.c) #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
$(perl -0777 -ne 'print $& if /^.*?\nfilter_color(?s:.*?)^}$/m' \
"$(dirname "$0")"/degesch.c)
void main () { void main () {
size_t len = 0; size_t len = 0;
@ -14,7 +17,7 @@ export example=$(
for (size_t i = 0; i < len; i++) for (size_t i = 0; i < len; i++)
printf ("<@\\x1b[38;5;%dmIRCuser\\x1b[m> I'm typing!\n", table[i]); printf ("<@\\x1b[38;5;%dmIRCuser\\x1b[m> I'm typing!\n", table[i]);
} }
EOF END
) )
# Both should give acceptable results, # Both should give acceptable results,