#!/bin/bash # Run generator for a particular output size and check output attributes. set -euo pipefail if [[ $# != 3 ]]; then echo "$0 {program} {width} {height}" exit 1 fi PROG=$1 WIDTH=$2 HEIGHT=$3 CHECK_SPACE=$(dirname "$0")/single_connected_space.pl CHECK_SIZE=$(dirname "$0")/check_expected_size.pl # Check that output map is of the requested size. "./$PROG" "$WIDTH" "$HEIGHT" | perl "$CHECK_SIZE" "$WIDTH" "$HEIGHT" # Check that space regions are connected. "./$PROG" "$WIDTH" "$HEIGHT" | perl "$CHECK_SPACE" # Check that output sixel image is square. "./$PROG" "$WIDTH" "$HEIGHT" \ | convert six:- pbm:- \ | perl -e '$s=<>; $s=~/^P4/ or die; $s=<>; $s=~/^(\d+) (\d+)/ or die; $1 == $2 or die; while(<>){}' # Success. exit 0