xref: /freebsd/usr.bin/printf/tests/regress.sh (revision fe75646a0234a261c0013bf1840fdac4acaf0cec)
1
2REGRESSION_START($1)
3
4echo '1..24'
5
6REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"')
7REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123')
8REGRESSION_TEST(`f', `printf "%f,%-8.3f,%f,%f\n" +42.25 -42.25 inf nan')
9REGRESSION_TEST(`l1', `LC_ALL=en_US.ISO8859-1 printf "%d\n" $(printf \"\\344)')
10REGRESSION_TEST(`l2', `LC_ALL=en_US.UTF-8 printf "%d\n" $(printf \"\\303\\244)')
11REGRESSION_TEST(`m1', `printf "%c%%%d\0\045\n" abc \"abc')
12REGRESSION_TEST(`m2', `printf "abc\n\cdef"')
13REGRESSION_TEST(`m3', `printf "%%%s\n" abc def ghi jkl')
14REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"')
15REGRESSION_TEST(`m5', `printf -- "-d\n"')
16REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc')
17REGRESSION_TEST('zero', `printf "%u%u\n" 15')
18REGRESSION_TEST('zero', `printf "%d%d\n" 15')
19REGRESSION_TEST('zero', `printf "%d%u\n" 15')
20REGRESSION_TEST('zero', `printf "%u%d\n" 15')
21REGRESSION_TEST(`missingpos1', `printf "%1\$*s" 1 1 2>&1')
22REGRESSION_TEST(`missingpos1', `printf "%*1\$s" 1 1 2>&1')
23REGRESSION_TEST(`missingpos1', `printf "%1\$*.*s" 1 1 1 2>&1')
24REGRESSION_TEST(`missingpos1', `printf "%*1\$.*s" 1 1 1 2>&1')
25REGRESSION_TEST(`missingpos1', `printf "%*.*1\$s" 1 1 1 2>&1')
26REGRESSION_TEST(`missingpos1', `printf "%1\$*2\$.*s" 1 1 1 2>&1')
27REGRESSION_TEST(`missingpos1', `printf "%*1\$.*2\$s" 1 1 1 2>&1')
28REGRESSION_TEST(`missingpos1', `printf "%1\$*.*2\$s" 1 1 1 2>&1')
29REGRESSION_TEST(`bwidth', `printf "%8.2b" "a\nb\n"')
30
31REGRESSION_END()
32