diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-08-29 18:41:57 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-08-29 18:41:57 +0000 |
commit | db3c385d25be36a5b7d1c80bd1bf8b1c569dfd16 (patch) | |
tree | 03caf41f682897b8e8450dd346938d512fcd1b9b /regress/lib/libc/vis | |
parent | 36685f611f7f08b8a08b76b11d2febf166c5dced (diff) |
Basic regress test for the vis(3) family of functions. Extra tests
for various flag values will be added later.
ok deraadt@
Diffstat (limited to 'regress/lib/libc/vis')
-rw-r--r-- | regress/lib/libc/vis/Makefile | 10 | ||||
-rw-r--r-- | regress/lib/libc/vis/valid.ok | 2 | ||||
-rw-r--r-- | regress/lib/libc/vis/vis_test.c | 23 |
3 files changed, 35 insertions, 0 deletions
diff --git a/regress/lib/libc/vis/Makefile b/regress/lib/libc/vis/Makefile new file mode 100644 index 00000000000..13e560bbf7d --- /dev/null +++ b/regress/lib/libc/vis/Makefile @@ -0,0 +1,10 @@ +# $OpenBSD: Makefile,v 1.1 2005/08/29 18:41:56 otto Exp $ + +PROG= vis_test +CLEANFILES+= valid.out + +run-regress-vis_test: ${PROG} + ./${PROG} >${.OBJDIR}/valid.out + cmp -s ${.OBJDIR}/valid.out ${.CURDIR}/valid.ok + +.include <bsd.regress.mk> diff --git a/regress/lib/libc/vis/valid.ok b/regress/lib/libc/vis/valid.ok new file mode 100644 index 00000000000..f8c0efa5037 --- /dev/null +++ b/regress/lib/libc/vis/valid.ok @@ -0,0 +1,2 @@ +\^@\^A\^B\^C\^D\^E\^F\^G\^H +\^K\^L\^M\^N\^O\^P\^Q\^R\^S\^T\^U\^V\^W\^X\^Y\^Z\^[\^\\^]\^^\^_ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\^?\M^@\M^A\M^B\M^C\M^D\M^E\M^F\M^G\M^H\M^I\M^J\M^K\M^L\M^M\M^N\M^O\M^P\M^Q\M^R\M^S\M^T\M^U\M^V\M^W\M^X\M^Y\M^Z\M^[\M^\\M^]\M^^\M^_\240\M-!\M-"\M-#\M-$\M-%\M-&\M-'\M-(\M-)\M-*\M-+\M-,\M--\M-.\M-/\M-0\M-1\M-2\M-3\M-4\M-5\M-6\M-7\M-8\M-9\M-:\M-;\M-<\M-=\M->\M-?\M-@\M-A\M-B\M-C\M-D\M-E\M-F\M-G\M-H\M-I\M-J\M-K\M-L\M-M\M-N\M-O\M-P\M-Q\M-R\M-S\M-T\M-U\M-V\M-W\M-X\M-Y\M-Z\M-[\M-\\M-]\M-^\M-_\M-`\M-a\M-b\M-c\M-d\M-e\M-f\M-g\M-h\M-i\M-j\M-k\M-l\M-m\M-n\M-o\M-p\M-q\M-r\M-s\M-t\M-u\M-v\M-w\M-x\M-y\M-z\M-{\M-|\M-}\M-~\M^? diff --git a/regress/lib/libc/vis/vis_test.c b/regress/lib/libc/vis/vis_test.c new file mode 100644 index 00000000000..40e5d9f5032 --- /dev/null +++ b/regress/lib/libc/vis/vis_test.c @@ -0,0 +1,23 @@ +/* $OpenBSD */ + +/* Public domain. 2005, Otto Moerbeek */ + +#include <limits.h> +#include <stdlib.h> +#include <stdio.h> +#include <vis.h> + +int +main() +{ + char inp[UCHAR_MAX + 1]; + char out[4 * UCHAR_MAX + 1]; + int i; + + for (i = 0; i <= UCHAR_MAX; i++) { + inp[i] = i; + } + strvisx(out, inp, UCHAR_MAX + 1, 0); + printf("%s\n", out); + exit(0); +} |