2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
6 * Definitions of data types for each test function
16 #include "tst_funcs.h"
17 #include "tgn_funcdef.h"
23 #define USE_MBCURMAX 99 /* well, but ... */
24 #define TST_DBL_EPS 2.22153e-16
25 #define WCSTOK_SEQNUM 3
26 #define MBLEN_SEQNUM 3
27 #define MBTOWC_SEQNUM 3
28 #define MBSTOWCS_SEQNUM 3
29 #define WCTOMB_SEQNUM 3
30 #define WCSTOMBS_SEQNUM 3
31 #define MBRLEN_SEQNUM 3
32 #define MBRTOWC_SEQNUM 3
33 #define MBSRTOWCS_SEQNUM 3
34 #define WCRTOMB_SEQNUM 3
35 #define WCSRTOMBS_SEQNUM 3
37 /* Maximum numbers of test in one of the _loc arrays. */
38 #define MAX_LOC_TEST 300
41 /*----------------------------------------------------------------------*/
43 /*----------------------------------------------------------------------*/
66 /*----------------------------------------------------------------------*/
67 /* ISW*: int isw* (wchar_t wc) */
68 /*----------------------------------------------------------------------*/
70 TST_ISW_STRUCT (ALNUM
, alnum
);
71 TST_ISW_STRUCT (ALPHA
, alpha
);
72 TST_ISW_STRUCT (CNTRL
, cntrl
);
73 TST_ISW_STRUCT (DIGIT
, digit
);
74 TST_ISW_STRUCT (GRAPH
, graph
);
75 TST_ISW_STRUCT (LOWER
, lower
);
76 TST_ISW_STRUCT (PRINT
, print
);
77 TST_ISW_STRUCT (PUNCT
, punct
);
78 TST_ISW_STRUCT (SPACE
, space
);
79 TST_ISW_STRUCT (UPPER
, upper
);
80 TST_ISW_STRUCT (XDIGIT
, xdigit
);
92 TMD_RECHEAD (ISWCTYPE
);
95 /*----------------------------------------------------------------------*/
96 /* MBLEN: int mblen (const char *s, size_t n) */
97 /*----------------------------------------------------------------------*/
107 typedef TEX_ERRET_REC (int) TEX_MBLEN_REC
;
111 /*----------------------------------------------------------------------*/
112 /* MBRLEN: size_t mbrlen (const char *s, size_t n, mbstate_t *ps) */
113 /*----------------------------------------------------------------------*/
129 typedef TEX_ERRET_REC_SEQ (size_t, MBRLEN_SEQNUM
) TEX_MBRLEN_REC
;
130 TMD_RECHEAD (MBRLEN
);
133 /*----------------------------------------------------------------------*/
134 /* MBRTOWC: size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, */
136 /*----------------------------------------------------------------------*/
164 TMD_RECHEAD (MBRTOWC
);
167 /*----------------------------------------------------------------------*/
168 /* MBSRTOWCS: size_t mbsrtowcs (wchar_t *ws, const char **s, size_t n, */
169 /* mbstate_t *ps ) */
170 /*----------------------------------------------------------------------*/
182 seq
[MBSRTOWCS_SEQNUM
];
193 seq
[MBSRTOWCS_SEQNUM
];
197 TMD_RECHEAD (MBSRTOWCS
);
200 /*----------------------------------------------------------------------*/
201 /* MBSTOWCS: size_t mbstowcs (wchar_t *ws, const char *s, size_t n) */
202 /*----------------------------------------------------------------------*/
213 seq
[MBSTOWCS_SEQNUM
];
217 typedef TEX_MBSRTOWCS_REC TEX_MBSTOWCS_REC
;
218 /* MBSRTOWCS_SEQNUM == MBSTOWCS_SEQNUM */
219 TMD_RECHEAD (MBSTOWCS
);
222 /*----------------------------------------------------------------------*/
223 /* MBTOWC: int mbtowc (wchar_t *wc, const char *s, size_t n) */
224 /*----------------------------------------------------------------------*/
226 typedef TIN_MBSTOWCS_REC TIN_MBTOWC_REC
;
227 /* MBTOWC_SEQNUM == MBSTOWCS_SEQNUM */
240 TMD_RECHEAD (MBTOWC
);
243 /*----------------------------------------------------------------------*/
244 /* STRCOLL: int strcoll (const char *s1, const char *s2) */
245 /*----------------------------------------------------------------------*/
254 typedef TEX_ERRET_REC (int) TEX_STRCOLL_REC
;
255 TMD_RECHEAD (STRCOLL
);
258 /*----------------------------------------------------------------------*/
259 /* STRFMON: size_t strfmon (char *buf, size_t nbytes, */
260 /* const char *fmt, ... ) */
261 /*----------------------------------------------------------------------*/
266 char fmt
[MONFMTSIZE
];
278 TMD_RECHEAD (STRFMON
);
281 /*----------------------------------------------------------------------*/
282 /* STRXFRM: size_t strxfrm (char *s1, const char *s2, size_t n) */
283 /*----------------------------------------------------------------------*/
293 typedef TEX_ERRET_REC (size_t) TEX_STRXFRM_REC
; /* only for org2[] */
294 TMD_RECHEAD (STRXFRM
);
297 /*----------------------------------------------------------------------*/
298 /* SWSCANF: int swscanf (const wchar_t *ws, const wchar_t *fmt, ...) */
299 /*----------------------------------------------------------------------*/
303 wchar_t ws
[WCSSIZE
* 3];
304 wchar_t fmt
[WCSSIZE
* 3];
312 int val_int
; /* %d */
313 unsigned val_uns
; /* %u */
314 float val_flt
; /* %f */
316 char val_s
[MBSSIZE
* 2]; /* %s */
317 wchar_t val_S
[WCSSIZE
* 2]; /* %lc, %ls, %C, %S */
321 TMD_RECHEAD (SWSCANF
);
324 /*----------------------------------------------------------------------*/
325 /* TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc) */
326 /*----------------------------------------------------------------------*/
328 typedef TIN_ISWCTYPE_REC TIN_TOWCTRANS_REC
;
329 typedef TEX_ERRET_REC (wint_t) TEX_TOWCTRANS_REC
;
330 TMD_RECHEAD (TOWCTRANS
);
333 /*----------------------------------------------------------------------*/
334 /* TOW*ER: wint_t tow*er (wint_t wc) */
335 /*----------------------------------------------------------------------*/
337 TST_TOW_STRUCT (LOWER
, lower
);
338 TST_TOW_STRUCT (UPPER
, upper
);
341 /*----------------------------------------------------------------------*/
342 /* WCRTOMB: wchar_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps) */
343 /*----------------------------------------------------------------------*/
361 TMD_RECHEAD (WCRTOMB
);
364 /*----------------------------------------------------------------------*/
365 /* WCSCAT: wchar_t *wcscat (wchar_t *ws1, wchar_t *ws2) */
366 /*----------------------------------------------------------------------*/
370 wchar_t ws1
[WCSSIZE
];
371 wchar_t ws2
[WCSSIZE
];
377 TMD_ERRET (wchar_t *);
382 TMD_RECHEAD (WCSCAT
);
385 /*----------------------------------------------------------------------*/
386 /* WCSCHR: wchar_t *wcschr (wchar_t *ws, wchar_t wc); */
387 /*----------------------------------------------------------------------*/
396 typedef TEX_ERRET_REC (wchar_t *) TEX_WCSCHR_REC
;
397 TMD_RECHEAD (WCSCHR
);
400 /*----------------------------------------------------------------------*/
401 /* WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2) */
402 /*----------------------------------------------------------------------*/
404 typedef TIN_WCSCAT_REC TIN_WCSCMP_REC
;
405 typedef TEX_ERRET_REC (int) TEX_WCSCMP_REC
;
406 TMD_RECHEAD (WCSCMP
);
409 /*----------------------------------------------------------------------*/
410 /* WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2) */
411 /*----------------------------------------------------------------------*/
413 typedef TIN_WCSCMP_REC TIN_WCSCOLL_REC
;
420 TMD_RECHEAD (WCSCOLL
);
423 /*----------------------------------------------------------------------*/
424 /* WCSCPY: wchar_t *wcscpy (wchar_t *ws1, const wchar_t *ws2) */
425 /*----------------------------------------------------------------------*/
429 wchar_t ws
[WCSSIZE
]; /* ws2: original string */
433 typedef TEX_WCSCAT_REC TEX_WCSCPY_REC
;
434 TMD_RECHEAD (WCSCPY
);
437 /*----------------------------------------------------------------------*/
438 /* WCSCSPN: size_t wcscspn (const wchar_t *ws1, const wchar_t *ws2) */
439 /*----------------------------------------------------------------------*/
441 typedef TIN_WCSCAT_REC TIN_WCSCSPN_REC
;
442 typedef TEX_ERRET_REC (size_t) TEX_WCSCSPN_REC
;
443 TMD_RECHEAD (WCSCSPN
);
446 /*----------------------------------------------------------------------*/
447 /* WCSLEN: size_t wcslen (const wchar_t *ws) */
448 /*----------------------------------------------------------------------*/
450 typedef TIN_WCSCPY_REC TIN_WCSLEN_REC
;
451 typedef TEX_ERRET_REC (size_t) TEX_WCSLEN_REC
;
452 TMD_RECHEAD (WCSLEN
);
455 /*----------------------------------------------------------------------*/
456 /* WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2, */
458 /*----------------------------------------------------------------------*/
462 wchar_t ws1
[WCSSIZE
];
463 wchar_t ws2
[WCSSIZE
];
468 typedef TEX_WCSCAT_REC TEX_WCSNCAT_REC
;
469 TMD_RECHEAD (WCSNCAT
);
472 /*----------------------------------------------------------------------*/
473 /* WCSNCMP: int *wcsncmp (const wchar_t *ws1, const wchar_t *ws2, */
475 /*----------------------------------------------------------------------*/
477 typedef TIN_WCSNCAT_REC TIN_WCSNCMP_REC
;
478 typedef TEX_ERRET_REC (int) TEX_WCSNCMP_REC
;
479 TMD_RECHEAD (WCSNCMP
);
482 /*----------------------------------------------------------------------*/
483 /* WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2, */
485 /*----------------------------------------------------------------------*/
489 wchar_t ws
[WCSSIZE
]; /* ws2: original string */
494 typedef TEX_WCSCPY_REC TEX_WCSNCPY_REC
;
495 TMD_RECHEAD (WCSNCPY
);
498 /*----------------------------------------------------------------------*/
499 /* WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2) */
500 /*----------------------------------------------------------------------*/
502 typedef TIN_WCSCSPN_REC TIN_WCSPBRK_REC
;
506 TMD_ERRET (wchar_t *);
511 TMD_RECHEAD (WCSPBRK
);
514 /*----------------------------------------------------------------------*/
515 /* WCSRTOMBS: size_t wcsrtombs (char *s, const wchar_t **ws, size_t n, */
517 /*----------------------------------------------------------------------*/
522 int w_flg
; /* don't need this */
537 TMD_RECHEAD (WCSRTOMBS
);
540 /*----------------------------------------------------------------------*/
541 /* WCSSPN: size_t wcsspn (const wchar_t *ws1, const wchar_t *ws2) */
542 /*----------------------------------------------------------------------*/
544 typedef TIN_WCSCSPN_REC TIN_WCSSPN_REC
;
545 typedef TEX_WCSCSPN_REC TEX_WCSSPN_REC
;
546 TMD_RECHEAD (WCSSPN
);
549 /*----------------------------------------------------------------------*/
550 /* WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2) */
551 /*----------------------------------------------------------------------*/
553 typedef TIN_WCSCSPN_REC TIN_WCSSTR_REC
;
554 typedef TEX_ERRET_REC (wchar_t *) TEX_WCSSTR_REC
;
555 TMD_RECHEAD (WCSSTR
);
558 /*----------------------------------------------------------------------*/
559 /* WCSTOD: double wcstod (const wchar_t *np, wchar_t **endp) */
560 /*----------------------------------------------------------------------*/
576 TMD_RECHEAD (WCSTOD
);
579 /*----------------------------------------------------------------------*/
580 /* WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm, */
582 /*----------------------------------------------------------------------*/
590 wchar_t dt
[WCSSIZE
]; /* delimiter */
600 TMD_ERRET (wchar_t *);
607 TMD_RECHEAD (WCSTOK
);
610 /*----------------------------------------------------------------------*/
611 /* WCSTOMBS: size_t wcstombs (char s, const wchar_t *ws, size_t n) */
612 /*----------------------------------------------------------------------*/
617 int w_flg
; /* currently we don't need it. */
630 TMD_RECHEAD (WCSTOMBS
);
633 /*----------------------------------------------------------------------*/
634 /* WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n) */
635 /*----------------------------------------------------------------------*/
637 typedef TIN_WCSNCPY_REC TIN_WCSWIDTH_REC
;
638 typedef TEX_ERRET_REC (int) TEX_WCSWIDTH_REC
;
639 TMD_RECHEAD (WCSWIDTH
);
642 /*----------------------------------------------------------------------*/
643 /* WCSXFRM: size_t wcsxfrm (wchar_t *ws1, const wchar_t *ws2, size_t n)*/
644 /*----------------------------------------------------------------------*/
648 wchar_t org1
[WCSSIZE
];
649 wchar_t org2
[WCSSIZE
];
654 typedef TEX_ERRET_REC (size_t) TEX_WCSXFRM_REC
; /* only for org2[] */
655 TMD_RECHEAD (WCSXFRM
);
658 /*----------------------------------------------------------------------*/
659 /* WCTOB: int wctob (wint_t wc) */
660 /*----------------------------------------------------------------------*/
668 typedef TEX_ERRET_REC (int) TEX_WCTOB_REC
;
672 /*----------------------------------------------------------------------*/
673 /* WCTOMB: int wctomb (char *s, wchar_t wc) */
674 /*----------------------------------------------------------------------*/
690 TMD_RECHEAD (WCTOMB
);
693 /*----------------------------------------------------------------------*/
694 /* WCTRANS: wctrans_t wctrans (const char *charclass) */
695 /*----------------------------------------------------------------------*/
703 typedef TEX_ERRET_REC (wctrans_t) TEX_WCTRANS_REC
;
704 TMD_RECHEAD (WCTRANS
);
707 /*----------------------------------------------------------------------*/
708 /* WCTYPE: wctype_t wctype (const char *class) */
709 /*----------------------------------------------------------------------*/
711 typedef TIN_WCTRANS_REC TIN_WCTYPE_REC
;
712 typedef TEX_ERRET_REC (wctype_t) TEX_WCTYPE_REC
;
713 TMD_RECHEAD (WCTYPE
);
716 /*----------------------------------------------------------------------*/
717 /* WCWIDTH: int wcwidth (wchar_t wc) */
718 /*----------------------------------------------------------------------*/
726 typedef TEX_ERRET_REC (int) TEX_WCWIDTH_REC
;
727 TMD_RECHEAD (WCWIDTH
);
729 #endif /* TST_TYPES_H */