#! /bin/bash # This script tests: pamdice # Also requires: pbmmake tmpdir=${tmpdir:-/tmp} fname_stem=${tmpdir}/pamdice_part # Test 1. echo "Test 1." pbmmake -w 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain ls ${fname_stem}*.pbm | while read file do cat ${file} | tr '\n' '@' ; echo done | sort | uniq -c | sed 's/^ *//' rm ${fname_stem}*.pbm # Test 1. echo "Test 2." pbmmake -g 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain ls ${fname_stem}*.pbm | while read file do cat ${file} | tr '\n' '@' ; echo done rm ${fname_stem}*.pbm # Test Invalid. echo "Test Invalid" echo 1>&2 echo "Invalid command-line argument combinations." 1>&2 echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 # No input file pamdice -width=10 -height=10 -outstem=${fname_stem} /dev/null || \ echo "Expected failure 1" # No -outstem pamdice -width=10 -height=10 testgrid.pbm || \ echo "Expected failure 2" # -width=0 pamdice -width=0 -height=10 -outstem=${fname_stem} testgrid.pbm || \ echo "Expected failure 3" # -height=0 pamdice -width=10 -height=0 -outstem=${fname_stem} testgrid.pbm || \ echo "Expected failure 4" # -hoverlap larger than width pamdice -width=10 -height=10 -hoverlap=11 \ -outstem=${fname_stem} testgrid.pbm || \ echo "Expected failure 5" # -voverlap larger than height pamdice -width=10 -height=10 -voverlap=11 \ -outstem=${fname_stem} testgrid.pbm || \ echo "Expected failure 6" # Ensure that no output files are produced by the above ls ${fname_stem}* || \ echo "Expected failure (output files)"