Add a few regression tests for printf(1).

This commit is contained in:
Stefan Farfeleder 2005-04-13 20:08:17 +00:00
parent 5ec2b8dc8a
commit 91e3aee000
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145028
12 changed files with 38 additions and 1 deletions

View File

@ -1,5 +1,5 @@
# $FreeBSD$
SUBDIR= file2c join jot m4 sed uudecode uuencode xargs
SUBDIR= file2c join jot m4 printf sed uudecode uuencode xargs
.include <bsd.subdir.mk>

View File

@ -0,0 +1,4 @@
# $FreeBSD$
all:
@m4 ${.CURDIR}/../regress.m4 ${.CURDIR}/regress.sh | sh /dev/stdin ${.CURDIR}

View File

@ -0,0 +1 @@
abcdef

View File

@ -0,0 +1 @@
123, 123,00123,00123,00123

View File

@ -0,0 +1 @@
42.250000,-42.250 ,inf,nan

View File

@ -0,0 +1 @@
a%97%

View File

@ -0,0 +1 @@
abc

View File

@ -0,0 +1,4 @@
%abc
%def
%ghi
%jkl

View File

@ -0,0 +1 @@
0,0.000000,,

View File

@ -0,0 +1 @@
abc,abc

View File

@ -0,0 +1,16 @@
# $FreeBSD$
REGRESSION_START($1)
echo '1..8'
REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"')
REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123')
REGRESSION_TEST(`f', `printf "%f,%-8.3f,%f,%f\n" +42.25 -42.25 inf nan')
REGRESSION_TEST(`m1', `printf "%c%%%d\045\n" abc \"abc')
REGRESSION_TEST(`m2', `printf "abc\n\cdef"')
REGRESSION_TEST(`m3', `printf "%%%s\n" abc def ghi jkl')
REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"')
REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc')
REGRESSION_END()

View File

@ -0,0 +1,6 @@
#!/bin/sh
# $FreeBSD$
cd `dirname $0`
m4 ../regress.m4 regress.sh | sh