diff options
author | tjr <tjr@FreeBSD.org> | 2004-11-21 03:21:22 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2004-11-21 03:21:22 +0000 |
commit | 4e61a637dc2b0c1d6f577b85291ec5bd21024b08 (patch) | |
tree | 40ab5fe1a0a137f78bf02aea5044c29bb2c9fbba /tools/regression/lib/libc | |
parent | 1f410c73aaa09f0990f20a0fe3c1ecb1af7c352b (diff) | |
download | FreeBSD-src-4e61a637dc2b0c1d6f577b85291ec5bd21024b08.zip FreeBSD-src-4e61a637dc2b0c1d6f577b85291ec5bd21024b08.tar.gz |
Remove regression tests for the obsolete rune interface.
Diffstat (limited to 'tools/regression/lib/libc')
-rw-r--r-- | tools/regression/lib/libc/locale/Makefile | 4 | ||||
-rw-r--r-- | tools/regression/lib/libc/locale/test-sgetrune.c | 135 | ||||
-rw-r--r-- | tools/regression/lib/libc/locale/test-sgetrune.t | 10 | ||||
-rw-r--r-- | tools/regression/lib/libc/locale/test-sputrune.c | 135 | ||||
-rw-r--r-- | tools/regression/lib/libc/locale/test-sputrune.t | 10 |
5 files changed, 1 insertions, 293 deletions
diff --git a/tools/regression/lib/libc/locale/Makefile b/tools/regression/lib/libc/locale/Makefile index 374610d..5fb9a94 100644 --- a/tools/regression/lib/libc/locale/Makefile +++ b/tools/regression/lib/libc/locale/Makefile @@ -14,9 +14,7 @@ TESTS= test-mbrtowc \ test-wcstombs \ test-mblen \ test-iswctype \ - test-towctrans \ - test-sgetrune \ - test-sputrune + test-towctrans .PHONY: tests tests: ${TESTS} diff --git a/tools/regression/lib/libc/locale/test-sgetrune.c b/tools/regression/lib/libc/locale/test-sgetrune.c deleted file mode 100644 index 1bfc28d..0000000 --- a/tools/regression/lib/libc/locale/test-sgetrune.c +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * Copyright (c) 2002, 2003 Tim J. Robbins - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test program for the 4.4BSD sgetrune() function. - * - * The function is tested with both the "C" ("POSIX") LC_CTYPE setting and - * "ja_JP.eucJP". Other encodings are not tested. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <assert.h> -#include <limits.h> -#include <locale.h> -#include <rune.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -int -main(int argc, char *argv[]) -{ - size_t len; - rune_t r; - const char *cres; - char buf[MB_LEN_MAX + 1]; - - /* - * C/POSIX locale. - */ - - printf("1..1\n"); - - assert(MB_CUR_MAX == 1); - - /* Incomplete character sequence. */ - memset(buf, 0xcc, sizeof(buf)); - assert(sgetrune(buf, 0, &cres) == _INVALID_RUNE); - assert(cres == buf); - assert(sgetrune(buf, 0, NULL) == _INVALID_RUNE); - - /* Null wide character. */ - buf[0] = '\0'; - assert(sgetrune(buf, 0, &cres) == _INVALID_RUNE); - assert(cres == buf); - assert(sgetrune(buf, 0, NULL) == _INVALID_RUNE); - assert(sgetrune(buf, 1, &cres) == 0); - assert(cres == buf + 1); - assert(sgetrune(buf, 2, &cres) == 0); - assert(cres == buf + 1); - assert(sgetrune(buf, 1, NULL) == 0); - - /* Latin letter A. */ - buf[0] = 'A'; - assert(sgetrune(buf, 1, &cres) == 'A'); - assert(cres == buf + 1); - assert(sgetrune(buf, 2, &cres) == 'A'); - assert(cres == buf + 1); - assert(sgetrune(buf, 1, NULL) == 'A'); - - /* - * Japanese (EUC) locale. - */ - - assert(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0); - assert(MB_CUR_MAX > 1); - - /* Incomplete character sequence (zero length). */ - memset(buf, 0xcc, sizeof(buf)); - assert(sgetrune(buf, 0, &cres) == _INVALID_RUNE); - assert(cres == buf); - assert(sgetrune(buf, 0, NULL) == _INVALID_RUNE); - - /* Null wide character. */ - buf[0] = '\0'; - assert(sgetrune(buf, 0, &cres) == _INVALID_RUNE); - assert(cres == buf); - assert(sgetrune(buf, 0, NULL) == _INVALID_RUNE); - assert(sgetrune(buf, 1, &cres) == 0); - assert(cres == buf + 1); - assert(sgetrune(buf, 2, &cres) == 0); - assert(cres == buf + 1); - assert(sgetrune(buf, 1, NULL) == 0); - - /* Latin letter A. */ - buf[0] = 'A'; - assert(sgetrune(buf, 1, &cres) == 'A'); - assert(cres == buf + 1); - assert(sgetrune(buf, 2, &cres) == 'A'); - assert(cres == buf + 1); - assert(sgetrune(buf, 1, NULL) == 'A'); - - /* Incomplete character sequence (truncated double-byte). */ - memset(buf, 0xcc, sizeof(buf)); - buf[0] = 0xa3; - buf[1] = 0x00; - assert(sgetrune(buf, 1, &cres) == _INVALID_RUNE); - assert(cres == buf); - assert(sgetrune(buf, 1, NULL) == _INVALID_RUNE); - - /* Same as above, but complete. */ - buf[1] = 0xc1; - assert(sgetrune(buf, 2, &cres) == 0xa3c1); - assert(cres == buf + 2); - assert(sgetrune(buf, 2, NULL) == 0xa3c1); - - printf("ok 1 - sgetrune()\n"); - - return (0); -} diff --git a/tools/regression/lib/libc/locale/test-sgetrune.t b/tools/regression/lib/libc/locale/test-sgetrune.t deleted file mode 100644 index 8bdfd03..0000000 --- a/tools/regression/lib/libc/locale/test-sgetrune.t +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -cd `dirname $0` - -executable=`basename $0 .t` - -make $executable 2>&1 > /dev/null - -exec ./$executable diff --git a/tools/regression/lib/libc/locale/test-sputrune.c b/tools/regression/lib/libc/locale/test-sputrune.c deleted file mode 100644 index 6aa00c7..0000000 --- a/tools/regression/lib/libc/locale/test-sputrune.c +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * Copyright (c) 2002, 2003 Tim J. Robbins - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test program for the 4.4BSD sputrune() function. - * - * The function is tested with both the "C" ("POSIX") LC_CTYPE setting and - * "ja_JP.eucJP". Other encodings are not tested. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <assert.h> -#include <errno.h> -#include <limits.h> -#include <locale.h> -#include <rune.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -int -main(int argc, char *argv[]) -{ - size_t len; - char *res; - char buf[MB_LEN_MAX + 1]; - - /* - * C/POSIX locale. - */ - - printf("1..1\n"); - - assert(MB_CUR_MAX == 1); - - /* Null wide character. */ - memset(buf, 0xcc, sizeof(buf)); - assert(sputrune(L'\0', buf, 1, &res) == 1); - assert(res == buf + 1); - assert((unsigned char)buf[0] == 0 && (unsigned char)buf[1] == 0xcc); - assert(sputrune(L'\0', buf, 1, NULL) == 1); - assert(sputrune(L'\0', buf, 2, &res) == 1); - assert(res == buf + 1); - - /* Latin letter A. */ - memset(buf, 0xcc, sizeof(buf)); - assert(sputrune(L'A', buf, 1, &res) == 1); - assert(res == buf + 1); - assert((unsigned char)buf[0] == 'A' && (unsigned char)buf[1] == 0xcc); - - /* Invalid code. */ - assert(sputrune(UCHAR_MAX + 1, buf, 1, &res) == 0); - assert(res == NULL); - assert(sputrune(UCHAR_MAX + 1, buf, 2, &res) == 0); - assert(res == NULL); - assert(sputrune(UCHAR_MAX + 1, buf, 1, NULL) == 0); - - /* - * Compute space required for MB char. This only ever worked in the - * C/POSIX locale. - */ - assert(sputrune(L'a', NULL, MB_CUR_MAX, &res) == 1); - assert(res == (char *)1); - assert(sputrune(L'a', NULL, MB_CUR_MAX, NULL) == 1); - - /* - * Japanese (EUC) locale. - */ - - assert(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0); - assert(MB_CUR_MAX == 3); - - /* Null wide character. */ - memset(buf, 0xcc, sizeof(buf)); - assert(sputrune(L'\0', buf, 1, &res) == 1); - assert(res == buf + 1); - assert((unsigned char)buf[0] == 0 && (unsigned char)buf[1] == 0xcc); - assert(sputrune(L'\0', buf, 1, NULL) == 1); - assert(sputrune(L'\0', buf, 2, &res) == 1); - assert(res == buf + 1); - - /* Latin letter A. */ - memset(buf, 0xcc, sizeof(buf)); - assert(sputrune(L'A', buf, 1, &res) == 1); - assert(res == buf + 1); - assert((unsigned char)buf[0] == 'A' && (unsigned char)buf[1] == 0xcc); - - /* Full width letter A. */ - memset(buf, 0xcc, sizeof(buf)); - assert(sputrune(0xa3c1, buf, 2, &res) == 2); - assert(res == buf + 2); - assert((unsigned char)buf[0] == 0xa3 && - (unsigned char)buf[1] == 0xc1 && - (unsigned char)buf[2] == 0xcc); - memset(buf, 0xcc, sizeof(buf)); - assert(sputrune(0xa3c1, buf, 2, NULL) == 2); - assert((unsigned char)buf[0] == 0xa3 && - (unsigned char)buf[1] == 0xc1 && - (unsigned char)buf[2] == 0xcc); - - memset(buf, 0xcc, sizeof(buf)); - assert(sputrune(0xa3c1, buf, 1, &res) == 2); - assert(res == NULL); - assert((unsigned char)buf[0] == 0xcc); - - - printf("ok 1 - sputrune()\n"); - - return (0); -} diff --git a/tools/regression/lib/libc/locale/test-sputrune.t b/tools/regression/lib/libc/locale/test-sputrune.t deleted file mode 100644 index 8bdfd03..0000000 --- a/tools/regression/lib/libc/locale/test-sputrune.t +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -cd `dirname $0` - -executable=`basename $0 .t` - -make $executable 2>&1 > /dev/null - -exec ./$executable |