mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-22 14:30:29 +00:00
278 lines
8.1 KiB
Plaintext
278 lines
8.1 KiB
Plaintext
# Tests for tr command; invoked by command file "fulltests"
|
|
# Written by Dave Tribby (August 1997)
|
|
|
|
# Location of the tr command to be tested
|
|
set testcmd="../tr"
|
|
|
|
# Record starting time
|
|
echo -n "Testing command $testcmd beginning at"
|
|
date
|
|
|
|
set src="file1.mixed"
|
|
set cmp="file1.UPPER"
|
|
set dest="/tmp/$cmp"
|
|
echo "Upshifting all characters in $src using character classes"
|
|
$testcmd '[:lower:]' '[:upper:]' < $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}B"
|
|
echo "Upshifting all characters in $src using character ranges"
|
|
$testcmd 'a-z' 'A-Z' < $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="file1.novowel"
|
|
set dest="/tmp/$cmp"
|
|
echo "Removing lower-case vowels in $src"
|
|
$testcmd -d 'aeiouy' < $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="file1.nolower"
|
|
set dest="/tmp/$cmp"
|
|
echo "Removing lower-case letters and squeezing spaces in $src"
|
|
$testcmd -ds '[:lower:]' ' ' < $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="file1.onlyup"
|
|
set dest="/tmp/$cmp"
|
|
echo "Keeping only upper-case letters and squeezing spaces in $src"
|
|
$testcmd -c -ds '[:upper:]' ' ' < $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="file1.noalpha"
|
|
set dest="/tmp/$cmp"
|
|
echo "Replace all alpha characters in $src with \"~\" and sqeeze"
|
|
$testcmd -s '[:alpha:]' '~' < $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="file1.Ul"
|
|
set dest="/tmp/$cmp"
|
|
echo "Replace u.c. chars with \"U\", l.c. chars with \"l\" in $src"
|
|
$testcmd "[:upper:][:lower:]" '[U*26][l*26]' < $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 src="file2.bin1"
|
|
set cmp="file2.bin2"
|
|
set dest="/tmp/$cmp"
|
|
echo "Binary file: setting high-order bit on control characters using range"
|
|
$testcmd '\000-\037' '\200-\237' < $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}B"
|
|
echo "Binary file: setting high-order bit on control characters using class"
|
|
$testcmd '[:cntrl:]' '\200-\237' < $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="file2.bin3"
|
|
set dest="/tmp/$cmp"
|
|
echo "Binary file: Translating special characters to alphabetic"
|
|
$testcmd '\a\b\f\n\r\t\v' 'ABFNRTV' < $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 src="file3.full"
|
|
set class="alnum"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="alpha"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="cntrl"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="digit"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="graph"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="lower"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="print"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="punct"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="space"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="upper"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="xdigit"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $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 class="blank"
|
|
set cmp="file3.$class"
|
|
set dest="/tmp/$cmp"
|
|
echo "ASCII subset class: $class"
|
|
$testcmd -c -d "[:$class:]" < $src > $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 ""
|
|
echo "Expected error: misplaced equivalence equals sign"
|
|
$testcmd '[=equiv=]' '[=equiv=]' < $src > $dest
|
|
echo " Error completion status = $status (expected: 1)"
|
|
|
|
echo ""
|
|
echo "Expected error: sequences only valid in string2"
|
|
$testcmd '[X*26]' '[:upper:]' < $src > $dest
|
|
echo " Error completion status = $status (expected: 1)"
|
|
|
|
echo ""
|
|
echo "Expected error: misplaced sequence asterisk"
|
|
$testcmd '[:lower:]' '[26*X]' < $src > $dest
|
|
echo " Error completion status = $status (expected: 1)"
|
|
|
|
echo ""
|
|
echo "Expected error: illegal sequence count"
|
|
$testcmd '[:lower:]' '[X*XX]' < $src > $dest
|
|
echo " Error completion status = $status (expected: 1)"
|
|
|
|
echo ""
|
|
echo "Expected error: unknown class:"
|
|
$testcmd '[:lower:]' '[:badclass:]' < $src > $dest
|
|
echo " Error completion status = $status (expected: 1)"
|