#!/usr/bin/perl -w # test.pl - Don Yang (uguu.org) # # 2013-05-04 use strict; die "$0 \n" unless $#ARGV == 1; my ($converter, $prog) = @ARGV; my @test_sizes = ( [10, 10], [100, 127], [255, 256], [257, 255], [1024, 768], [1200, 1600], [0x7fff, 1], [0x8000, 1], [1, 0x7fff], [1, 0x8000], [0x8000, 0x100], [0x100, 0x8000], ); open STDERR, ">/dev/null" or die; foreach my $i (@test_sizes) { my ($width, $height) = @$i; my @output = `pbmmake $width $height | $converter | ./$prog`; unless( $? == 0 && $#output >= 0 && $output[0] =~ /^(\d+) (\d+)/ ) { die "Command failed for ($width, $height): $?\n"; } unless( $1 == $width && $2 == $height ) { die "Output mismatched for ($width, $height)\n"; } }