#! /bin/sh
# This script tests: pngtopam pnmtopng
# Also requires:

# Failure message
## If this test fails and pnm-roundtrip2.test succeeds, it indicates
## some problem with pnmtopng.

# Test 1.  Should print 1926073387 101484 18 times
for flags in "" -interlace \
  -gamma=.45 \
  -hist \
  -nofilter \
  -sub \
  -up \
  -avg \
  -paeth \
  -compression=9 \
  "-compression=0 -comp_mem=1 -comp_window=8 -comp_buffer=512" \
  "-compression=9 -comp_mem=1 -comp_window=15 -comp_buffer=512" \
  "-compression=9 -comp_mem=1 -comp_window=8 -comp_buffer=512" \
  "-compression=0 -comp_mem=9 -comp_window=8 -comp_buffer=512" \
  "-compression=9 -comp_mem=9 -comp_window=15 -comp_buffer=8096" \
  -comp_strategy=huffman_only \
  -comp_strategy=filtered \
  -force
  do
pnmtopng testimg.ppm $flags | pngtopam | cksum
done

# Test 2.  Should print 281226646 481 18 times
for flags in "" -interlace \
  -gamma=.45 \
  -hist \
  -nofilter \
  -sub \
  -up \
  -avg \
  -paeth \
  -compression=9 \
  "-compression=0 -comp_mem=1 -comp_window=8 -comp_buffer=512" \
  "-compression=9 -comp_mem=1 -comp_window=15 -comp_buffer=512" \
  "-compression=9 -comp_mem=1 -comp_window=8 -comp_buffer=512" \
  "-compression=0 -comp_mem=9 -comp_window=8 -comp_buffer=512" \
  "-compression=9 -comp_mem=9 -comp_window=15 -comp_buffer=8096" \
  -comp_strategy=huffman_only \
  -comp_strategy=filtered \
  -force
  do
  pnmtopng maze.pbm $flags | pngtopam | cksum
  done
