gno/bin/wc/tests/dotests

101 lines
2.6 KiB
Plaintext
Raw Normal View History

# Tests for wc command; invoked by command file "fulltests"
# Written by Dave Tribby (August 1997)
1997-10-03 03:47:18 +00:00
# $Id: dotests,v 1.2 1997/10/03 03:47:18 gdr Exp $
# Location of the wc command to be tested
set testcmd="../wc"
# Record starting time
echo -n "Testing command $testcmd beginning at"
date
set src="file500.txt"
set cmp="f500.clw"
set dest="/tmp/$cmp"
echo "Counting bytes, lines, and words (default) of $src"
$testcmd $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set dest="/tmp/${cmp}A"
echo "Counting bytes, lines, and words (explicit) of $src"
$testcmd -clw $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="${cmp}B"
set dest="/tmp/$cmp"
echo "Counting bytes, lines, and words (default) of $src using stdin"
$testcmd < $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="f500.c"
set dest="/tmp/$cmp"
echo "Counting bytes of $src"
$testcmd -c $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="f500.l"
set dest="/tmp/$cmp"
echo "Counting lines of $src"
$testcmd -l $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="f500.w"
set dest="/tmp/$cmp"
echo "Counting words of $src"
$testcmd -w $src > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
set cmp="multi.clw"
set dest="/tmp/$cmp"
echo "Counting bytes, lines, and words (default) of f*.*"
$testcmd f*.* > $dest
echo " Completion status = $status"
echo "Checking results against control file $cmp (no differences expected)"
cmp $cmp $dest
echo " Completion status = $status"
echo ""
echo "***** Error Messages *****"
set dest="/tmp/err.cond"
echo ""
echo "Expected error: illegal option"
$testcmd -x $src > $dest
echo " Error completion status = $status (expected: 1)"
echo ""
set src="badname"
echo "Expected error: $src: no such file or directory"
$testcmd $src > $dest
echo " Error completion status = $status (expected: 1)"