Deleted Added
full compact
wctomb_test.c (106686) wctomb_test.c (128005)
1/*-
1/*-
2 * Copyright (c) 2002 Tim J. Robbins
2 * Copyright (c) 2002-2004 Tim J. Robbins
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright

--- 17 unchanged lines hidden (view full) ---

28 * Test program for wctomb(), as specified by IEEE Std. 1003.1-2001 and
29 * ISO/IEC 9899:1999.
30 *
31 * The function is tested with both the "C" ("POSIX") LC_CTYPE setting and
32 * "ja_JP.eucJP". Other encodings are not tested.
33 */
34
35#include <sys/cdefs.h>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright

--- 17 unchanged lines hidden (view full) ---

28 * Test program for wctomb(), as specified by IEEE Std. 1003.1-2001 and
29 * ISO/IEC 9899:1999.
30 *
31 * The function is tested with both the "C" ("POSIX") LC_CTYPE setting and
32 * "ja_JP.eucJP". Other encodings are not tested.
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/tools/regression/lib/libc/locale/test-wctomb.c 106686 2002-11-09 04:33:02Z tjr $");
36__FBSDID("$FreeBSD: head/tools/regression/lib/libc/locale/test-wctomb.c 128005 2004-04-07 11:02:51Z tjr $");
37
38#include <assert.h>
39#include <errno.h>
40#include <limits.h>
41#include <locale.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include <string.h>

--- 22 unchanged lines hidden (view full) ---

67 /* Latin letter A. */
68 memset(buf, 0xcc, sizeof(buf));
69 len = wctomb(buf, L'A');
70 assert(len == 1);
71 assert((unsigned char)buf[0] == 'A' && (unsigned char)buf[1] == 0xcc);
72
73 /* Invalid code. */
74 assert(wctomb(buf, UCHAR_MAX + 1) == -1);
37
38#include <assert.h>
39#include <errno.h>
40#include <limits.h>
41#include <locale.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include <string.h>

--- 22 unchanged lines hidden (view full) ---

67 /* Latin letter A. */
68 memset(buf, 0xcc, sizeof(buf));
69 len = wctomb(buf, L'A');
70 assert(len == 1);
71 assert((unsigned char)buf[0] == 'A' && (unsigned char)buf[1] == 0xcc);
72
73 /* Invalid code. */
74 assert(wctomb(buf, UCHAR_MAX + 1) == -1);
75 assert(wctomb(NULL, 0) == 0);
75
76 /*
77 * Japanese (EUC) locale.
78 */
79
80 assert(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0);
81 assert(MB_CUR_MAX == 3);
82

--- 27 unchanged lines hidden ---
76
77 /*
78 * Japanese (EUC) locale.
79 */
80
81 assert(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0);
82 assert(MB_CUR_MAX == 3);
83

--- 27 unchanged lines hidden ---