#! /bin/sh
# This script tests: ppmtomitsu
# Also requires: pamseq pamdepth

tmpdir=${tmpdir:-/tmp}
testimg216_ppm=${tmpdir}/testimg216.ppm

echo "Test 0. Should print 668243897 101532"

pamseq 3 5 -tupletype=RGB | pamdepth 255 | pnmremap -nofloyd -mapfile=- testimg.ppm |\
  tee ${testimg216_ppm} | cksum

echo "Test 1. Should print 3110813682 101562"
ppmtomitsu testimg.ppm | cksum

echo "Test 2. Should print 825518840 34209"
ppmtomitsu ${testimg216_ppm} | cksum

echo "Test 3. Should print 3201293405 310"
ppmtomitsu testgrid.pbm | cksum

echo "Test 4. Should print 3354679572 752"
ppmtomitsu -tiny testgrid.pbm | cksum

echo "Test 5. Should print 3999654426 101549"
ppmtomitsu -tiny testimg.ppm | cksum

echo "Test 6. Should print 3103038403 101549"
ppmtomitsu -tiny ${testimg216_ppm} | cksum

rm ${testimg216_ppm}
