Skip to content

Commit 356d9d2

Browse files
committed
test: Compare ctype with wctype functions
Make sure ctype and wctype functions return the same value for ASCII. Signed-off-by: Keith Packard <[email protected]>
1 parent 492a1c0 commit 356d9d2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/test-ctype.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,26 @@
3535

3636
#include <stdio.h>
3737
#include <ctype.h>
38+
#include <wctype.h>
3839
#include <stdbool.h>
3940

4041
/* Validate C locale ctype data */
4142

4243
#define boolname(b) ((b) ? "true" : "false")
4344
#define iscat(name) is ## name
45+
#define iswcat(name) isw ## name
4446
#define TEST(name) do { \
4547
if (!!iscat(name)(c) != !!name) { \
4648
printf("character %#2x '%c' is%s is %s should be %s\n", \
4749
c, c, #name, boolname(iscat(name)(c)), boolname(name)); \
4850
error = 1; \
4951
} \
52+
if (!!iscat(name)(c) != !!iswcat(name)((wint_t)(c))) { \
53+
printf("character %#2x '%c' is%s = %s isw%s = %s\n", \
54+
c, c, #name, boolname(iscat(name)(c)), #name, \
55+
boolname(iswcat(name)(c))); \
56+
error = 1; \
57+
} \
5058
} while(0)
5159

5260
int main(void) {

0 commit comments

Comments
 (0)