bin/111297: adding some regression tests for usr.bin/tr

Giorgos Keramidas keramida at FreeBSD.org
Fri Apr 6 01:30:05 UTC 2007


>Number:         111297
>Category:       bin
>Synopsis:       adding some regression tests for usr.bin/tr
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 06 01:30:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Giorgos Keramidas
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD kobe 7.0-CURRENT FreeBSD 7.0-CURRENT #2:
Fri Apr 6 03:52:16 EEST 2007 build at kobe:/home/build/obj/home/build/src/sys/GENERIC i386

>Description:

The attached patch adds some regression tests for tr(1).  They're not
very extensive, and they certainly don't cover all the possible corner
cases yet, but they're a start :)

>How-To-Repeat:
>Fix:

The patch can be applied with `cd src; gpatch -p1 < patchfile'.

--- tr-regression.diff begins here ---
diff -r be1a46e78c73 tools/regression/usr.bin/Makefile
--- a/tools/regression/usr.bin/Makefile	Thu Apr 05 21:03:04 2007 +0000
+++ b/tools/regression/usr.bin/Makefile	Fri Apr 06 04:04:43 2007 +0300
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR=	file2c join jot m4 printf sed uudecode uuencode xargs
+SUBDIR=	file2c join jot m4 printf sed tr uudecode uuencode xargs
 
 .include <bsd.subdir.mk>
diff -r be1a46e78c73 tools/regression/usr.bin/tr/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/Makefile	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+all:
+	@m4 ${.CURDIR}/../regress.m4 ${.CURDIR}/regress.sh | sh /dev/stdin ${.CURDIR}
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.00.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.00.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,4 @@
+qui3k 2rown
+fox jump54
+ov5r th5 l1zy
+4og
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.01.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.01.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.02.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.02.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,4 @@
+quik brown
+fox jumpd
+ovr th lzy
+do
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.03.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.03.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,4 @@
+QUICK BROWN
+FOX JUMPED
+OVER THE LAZY
+DOG
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.04.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.04.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,4 @@
+..... .....
+... ......
+.... ... ....
+...
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.05.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.05.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.06.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.06.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,9 @@
+??? bottles of beer on the wall, ??? bottles of beer.
+Take one down and pass it around - ?? bottles of beer on the wall.
+?? bottles of beer on the wall, ?? bottles of beer.
+Take one down and pass it around - ?? bottles of beer on the wall.
+...
+? bottles of beer on the wall, ? bottles of beer!!!
+Take one down and pass it around - ? bottle of beer on the wall.
+? bottle of beer on the wall, ? bottle of beer!!!
+Take it down and pass it around - NO MORE bottles of beer on the wall!!!
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.07.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.07.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,9 @@
+### ####### ## #### ## ### ####, ### ####### ## ####.
+#### ### #### ### #### ## ###### - ## ####### ## #### ## ### ####.
+## ####### ## #### ## ### ####, ## ####### ## ####.
+#### ### #### ### #### ## ###### - ## ####### ## #### ## ### ####.
+...
+# ####### ## #### ## ### ####, # ####### ## ####!!!
+#### ### #### ### #### ## ###### - # ###### ## #### ## ### ####.
+# ###### ## #### ## ### ####, # ###### ## ####!!!
+#### ## #### ### #### ## ###### - ## #### ####### ## #### ## ### ####!!!
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.08.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.08.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,9 @@
+100,100.
+-99.
+99,99.
+-98.
+...
+2,2!!!
+-1.
+1,1!!!
+-!!!
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.09.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.09.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,1 @@
+?#
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.0a.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.0a.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,1 @@
+$?$$$$$$$$
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.0b.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.0b.out	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,1 @@
+100befbeeea100befbeeaeedadaad99befbeeea99befbeeea99befbeeaeedadaad98befbeeea2befbeeea2befbeeaeedadaad1befbeeea1befbeeea1befbeeaedadaadEbefbeeea
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.in	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.sh	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+echo 1..12
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`00', `tr abcde 12345 < regress.in')
+REGRESSION_TEST(`01', `tr 12345 abcde < regress.in')
+REGRESSION_TEST(`02', `tr -d aceg < regress.in')
+REGRESSION_TEST(`03', `tr "[[:lower:]]" "[[:upper:]]" < regress.in')
+REGRESSION_TEST(`04', `tr "[[:alpha:]]" . < regress.in')
+REGRESSION_TEST(`05', `tr "[[:lower:]]" "[[:upper:]]" < regress.in | tr "[[:upper:]]" "[[:lower:]]"')
+REGRESSION_TEST(`06', `tr "[[:digit:]]" "?" < regress2.in')
+REGRESSION_TEST(`07', `tr "[[:alnum:]]" "#" < regress2.in')
+REGRESSION_TEST(`08', `tr "[[:upper:]]" "[[:lower:]]" < regress2.in | tr -d "[^[:alpha:]] "')
+REGRESSION_TEST(`09', `printf "\\f\\r\\n" | tr "\\014\\r" "?#"')
+REGRESSION_TEST(`0a', `printf "0xdeadbeef\\n" | tr "x[[:xdigit:]]" "?\$"')
+REGRESSION_TEST(`0b', `(tr -cd "[[:xdigit:]]" < regress2.in ; echo)')
+
+REGRESSION_END()
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.t	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+cd `dirname $0`
+
+m4 ../regress.m4 regress.sh | sh
diff -r be1a46e78c73 tools/regression/usr.bin/tr/regress2.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress2.in	Fri Apr 06 04:04:43 2007 +0300
@@ -0,0 +1,9 @@
+100 bottles of beer on the wall, 100 bottles of beer.
+Take one down and pass it around - 99 bottles of beer on the wall.
+99 bottles of beer on the wall, 99 bottles of beer.
+Take one down and pass it around - 98 bottles of beer on the wall.
+...
+2 bottles of beer on the wall, 2 bottles of beer!!!
+Take one down and pass it around - 1 bottle of beer on the wall.
+1 bottle of beer on the wall, 1 bottle of beer!!!
+Take it down and pass it around - NO MORE bottles of beer on the wall!!!
--- tr-regression.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list