#!/bin/sh
# -*- shell-script -*-
# Copyright (C) 2004-2017 GraphicsMagick Group
. ./common.shi
. ${top_srcdir}/tests/common.shi

# Test program
rwfile=./rwfile

# Types we will test
check_types='bilevel gray pallette truecolor'

# Number of tests we plan to run
test_plan_fn 648

# ART format
for type in ${check_types}
do
  test_command_fn "ART ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" ART
  test_command_fn "ART ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" ART
done

# AVS format
for type in ${check_types}
do
  test_command_fn "AVS ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" AVS
  test_command_fn "AVS ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" AVS
done

# BMP format
for type in ${check_types}
do
  test_command_fn "BMP ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" BMP
  test_command_fn "BMP ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" BMP
done

# BMP2 format
for type in ${check_types}
do
  test_command_fn "BMP2 ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" BMP2
  test_command_fn "BMP2 ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" BMP2
done

# BMP3 format
for type in ${check_types}
do
  test_command_fn "BMP3 ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" BMP3
  test_command_fn "BMP3 ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" BMP3
done

# CALS format
for type in ${check_types}
do
  test_command_fn "CALS ${type}" -F TIFF ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" CALS
  #test_command_fn "CALS ${type} (stdio)" -F TIFF ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" CALS
done

# CIN format
for type in ${check_types}
do
  test_command_fn "CIN ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" CIN
  test_command_fn "CIN ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" CIN
done

# DCX format
for type in ${check_types}
do
  test_command_fn "DCX ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" DCX
  test_command_fn "DCX ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" DCX
done

# DIB format
for type in ${check_types}
do
  test_command_fn "DIB ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" DIB
  test_command_fn "DIB ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" DIB
done

# DPX format
for type in ${check_types}
do
  test_command_fn "DPX ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" DPX
  test_command_fn "DPX ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" DPX
done

# EPDF format
for type in ${check_types}
do
  test_command_fn "EPDF ${type}" -F 'PS' ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" EPDF
  #test_command_fn "EPDF ${type} (stdio)" -F 'PS' ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" EPDF
done

# EPSF format
for type in ${check_types}
do
  test_command_fn "EPSF ${type}" -F 'PS' ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" EPSF
  #test_command_fn "EPSF ${type} (stdio)" -F 'PS' ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" EPSF
done

# EPSI format
for type in ${check_types}
do
  test_command_fn "EPSI ${type}" -F 'PS' ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" EPSI
  #test_command_fn "EPSI ${type} (stdio)" -F 'PS' ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" EPSI
done

# EPI format
for type in ${check_types}
do
  test_command_fn "EPI ${type}" -F 'PS' ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" EPI
  #test_command_fn "EPI ${type} (stdio)" -F 'PS' ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" EPI
done

# EPS format
for type in ${check_types}
do
  test_command_fn "EPS ${type}" -F 'PS' ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" EPS
  #test_command_fn "EPS ${type} (stdio)" -F 'PS' ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" EPS
done

# EPT format
for type in ${check_types}
do
  test_command_fn "EPT ${type}" -F 'PS TIFF' ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" EPT
  #test_command_fn "EPT ${type} (stdio)" -F 'PS TIFF' ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" EPT
done

# FAX format
for type in ${check_types}
do
  test_command_fn "FAX ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" FAX
  test_command_fn "FAX ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" FAX
done

# FITS format
for type in ${check_types}
do
  test_command_fn "FITS ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" FITS
  test_command_fn "FITS ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" FITS
done

# FPX format
for type in ${check_types}
do
  test_command_fn "FPX ${type}" -F FPX ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" FPX
  #test_command_fn "FPX ${type} (stdio)" -F FPX ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" FPX
done

# GIF format
for type in ${check_types}
do
  test_command_fn "GIF ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" GIF
  test_command_fn "GIF ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" GIF
done

# GRAY format
for type in ${check_types}
do
  test_command_fn "GRAY ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" GRAY
  test_command_fn "GRAY ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" GRAY
done

# ICB format
for type in ${check_types}
do
  test_command_fn "ICB ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" ICB
  test_command_fn "ICB ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" ICB
done

# JBIG format
for type in ${check_types}
do
  test_command_fn "JBIG ${type}" -F JBIG ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" JBIG
  test_command_fn "JBIG ${type} (stdio)" -F JBIG ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" JBIG
done

# JPEG format
for type in ${check_types}
do
  test_command_fn "JPEG ${type}" -F JPEG ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" JPEG
  test_command_fn "JPEG ${type} (stdio)" -F JPEG ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" JPEG
done

# JP2 format
for type in ${check_types}
do
  test_command_fn "JP2 ${type}" -F JP2 ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" JP2
  test_command_fn "JP2 ${type} (stdio)" -F JP2 ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" JP2
done

# MAT format
for type in ${check_types}
do
  test_command_fn "MAT ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" MAT
  test_command_fn "MAT ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" MAT
done

# MIFF format
for type in ${check_types}
do
  test_command_fn "MIFF ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" MIFF
  test_command_fn "MIFF ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" MIFF
done

for type in ${check_types}
do
    test_command_fn "MIFF RLE compressed ${type}" ${MEMCHECK} ${rwfile} -compress RLE -filespec "out_${type}_rle_%d" "${SRCDIR}/input_${type}.miff" MIFF
done

# Normally one would expect that -F BZLIB is required, but bzip
# compression is silently translated to no compression if not
# available.
for type in ${check_types}
do
    test_command_fn "MIFF BZIP compressed ${type}" ${MEMCHECK} ${rwfile} -compress BZIP -filespec "out_${type}_bzip_%d" "${SRCDIR}/input_${type}.miff" MIFF
done

# Normally one would expect that -F ZLIB is required, but zip
# compression is silently translated to no compression if not
# available.
for type in ${check_types}
do
    test_command_fn "MIFF ZIP compressed ${type}" ${rwfile} -compress ZIP -filespec "out_${type}_zip_%d" "${SRCDIR}/input_${type}.miff" MIFF
done

# MNG format
for type in ${check_types}
do
  test_command_fn "MNG ${type}" -F PNG ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" MNG
  test_command_fn "MNG ${type} (stdio)" -F PNG ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" MNG
done

# MPR (Magick Persistent Registry).  There is no such format but file names are required.
for type in ${check_types}
do
  test_command_fn "MPR ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" MPR
done

# MTV format
for type in ${check_types}
do
  test_command_fn "MTV ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" MTV
  test_command_fn "MTV ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" MTV
done

# P7 format
for type in ${check_types}
do
  test_command_fn "P7 ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" P7
  test_command_fn "P7 ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" P7
done

# PAM format
for type in ${check_types}
do
  for depth in 8 16 32
  do
    test_command_fn "PAM ${type} (depth ${depth})" ${MEMCHECK} ${rwfile} -filespec "out_${type}_${depth}_%d" "${SRCDIR}/input_${type}.miff" PAM
    test_command_fn "PAM ${type} (stdio, depth ${depth})" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_${depth}_stdio_%d" "${SRCDIR}/input_${type}.miff" PAM
  done
done

# PBM format
for type in ${check_types}
do
  test_command_fn "PBM ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PBM
  test_command_fn "PBM ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PBM
  test_command_fn "PBM ASCII ${type}" ${MEMCHECK} ${rwfile} -compress None -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PBM
  test_command_fn "PBM ASCII ${type} (stdio)" ${MEMCHECK} ${rwfile} -compress None -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PBM
done

# PCD format
for type in ${check_types}
do
  test_command_fn "PCD ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PCD
  test_command_fn "PCD ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PCD
done

# PCDS format
for type in ${check_types}
do
  test_command_fn "PCDS ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PCDS
  test_command_fn "PCDS ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PCDS
done

# PCX format
for type in ${check_types}
do
  test_command_fn "PCX ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PCX
  test_command_fn "PCX ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PCX
done

# PDF format
for type in ${check_types}
do
  test_command_fn "PDF ${type}" -F PS ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PDF
  #test_command_fn "PDF ${type} (stdio)" -F PS ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PDF
done

# PGM format
for type in ${check_types}
do
  for depth in 8 16 32
  do
    test_command_fn "PGM ${type} (depth ${depth})" ${MEMCHECK} ${rwfile} -depth ${depth} -filespec "out_${type}_${depth}_%d" "${SRCDIR}/input_${type}.miff" PGM
    test_command_fn "PGM ${type} (stdio, depth ${depth})" ${MEMCHECK} ${rwfile} -depth ${depth} -stdio -filespec "out_${type}_${depth}_stdio_%d" "${SRCDIR}/input_${type}.miff" PGM
    test_command_fn "PGM ASCII ${type} (depth ${depth})" ${MEMCHECK} ${rwfile} -depth ${depth} -quality 0 -filespec "out_${type}_${depth}_%d" "${SRCDIR}/input_${type}.miff" PGM
    test_command_fn "PGM ASCII ${type} (stdio, depth ${depth})" ${MEMCHECK} ${rwfile} -depth ${depth} -quality 0 -stdio -filespec "out_${type}_${depth}_stdio_%d" "${SRCDIR}/input_${type}.miff" PGM
  done
done

# PGX format
for type in ${check_types}
do
  test_command_fn "PGX ${type}" -F JP2 ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PGX
  test_command_fn "PGX ${type} (stdio)" -F JP2 ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PGX
done

# PICON format
for type in ${check_types}
do
  test_command_fn "PICON ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PICON
  test_command_fn "PICON ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PICON
done

# PICT format
for type in ${check_types}
do
  test_command_fn "PICT ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PICT
  test_command_fn "PICT ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PICT
done

# PNG format
for type in ${check_types}
do
  test_command_fn "PNG ${type}" -F PNG ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PNG
  test_command_fn "PNG ${type} (stdio)" -F PNG ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PNG
done

# PNM format
for type in ${check_types}
do
  test_command_fn "PNM ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PNM
  test_command_fn "PNM ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PNM
done

# PPM format
for type in ${check_types}
do
  for depth in 8 16 32
  do
    test_command_fn "PPM ${type} (depth ${depth})" ${MEMCHECK} ${rwfile} -filespec "out_${type}_${depth}_%d" "${SRCDIR}/input_${type}.miff" PPM
    test_command_fn "PPM ${type} (stdio, depth ${depth})" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_${depth}_stdio_%d" "${SRCDIR}/input_${type}.miff" PPM
    test_command_fn "PPM ASCII ${type} (depth ${depth})" ${MEMCHECK} ${rwfile} -quality 0 -filespec "out_${type}_${depth}_%d" "${SRCDIR}/input_${type}.miff" PPM
    test_command_fn "PPM ASCII ${type} (stdio, depth ${depth})" ${MEMCHECK} ${rwfile} -quality 0 -stdio -filespec "out_${type}_${depth}_stdio_%d" "${SRCDIR}/input_${type}.miff" PPM
  done
done

# PS format
for type in ${check_types}
do
  test_command_fn "PS ${type}" -F PS ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PS
  #test_command_fn "PS ${type} (stdio)" -F PS ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PS
done

# PS2 format
for type in ${check_types}
do
  test_command_fn "PS2 ${type}" -F PS ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PS2
  #test_command_fn "PS2 ${type} (stdio)" -F PS ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PS2
done

# PS3 format
for type in ${check_types}
do
  test_command_fn "PS3 ${type}" -F PS ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PS3
  #test_command_fn "PS3 ${type} (stdio)" -F PS ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PS3
done

# PSD format
for type in ${check_types}
do
  test_command_fn "PSD ${type}" -F PSD ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PSD
  #test_command_fn "PSD ${type} (stdio)" -F PSD ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PSD
done

# PTIF format
for type in ${check_types}
do
  test_command_fn "PTIF ${type}" -F TIFF ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" PTIF
  test_command_fn "PTIF ${type} (stdio)" -F TIFF ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" PTIF
done

# RAS format
for type in ${check_types}
do
  test_command_fn "RAS ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" RAS
  test_command_fn "RAS ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" RAS
done

# SGI format
for type in ${check_types}
do
  test_command_fn "SGI ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" SGI
  test_command_fn "SGI ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" SGI
done

# SUN format
for type in ${check_types}
do
  test_command_fn "SUN ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" SUN
  test_command_fn "SUN ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" SUN
done

# TGA format
for type in ${check_types}
do
  test_command_fn "TGA ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" TGA
  test_command_fn "TGA ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" TGA
done

# TXT format
for type in ${check_types}
do
  test_command_fn "TXT ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" TXT
  test_command_fn "TXT ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" TXT
done

# TIFF format
for compress in None Fax Group4 JPEG LZW RLE Zip LZMA WebP ZSTD
do
  for type in ${check_types}
  do
    test_command_fn "TIFF ${type} compress=${compress}" -F TIFF ${MEMCHECK} ${rwfile} -compress ${compress} -filespec "out_${type}_${compress}_%d" "${SRCDIR}/input_${type}.miff" TIFF
    test_command_fn "TIFF ${type}  compress=${compress} (stdio)" -F TIFF ${MEMCHECK} ${rwfile} -stdio -compress ${compress} -filespec "out_${type}_${compress}_stdio_%d" "${SRCDIR}/input_${type}.miff" TIFF
  done
done

# VDA format
for type in ${check_types}
do
  test_command_fn "VDA ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" VDA
  test_command_fn "VDA ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" VDA
done

# VICAR format
for type in ${check_types}
do
  test_command_fn "VICAR ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" VICAR
  test_command_fn "VICAR ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" VICAR
done

# VIFF format
for type in ${check_types}
do
  test_command_fn "VIFF ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" VIFF
  test_command_fn "VIFF ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" VIFF
done

# VST format
for type in ${check_types}
do
  test_command_fn "VST ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" VST
  test_command_fn "VST ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" VST
done

# WBMP format
for type in ${check_types}
do
  test_command_fn "WBMP ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" WBMP
  test_command_fn "WBMP ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" WBMP
done

# WEBP format
for type in ${check_types}
do
  test_command_fn "WEBP ${type}" -F WEBP ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" WEBP
  test_command_fn "WEBP ${type} (stdio)" -F WEBP ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" WEBP
done
for type in ${check_types}
do
  test_command_fn "WEBP ${type} (lossless)" -F WEBP ${MEMCHECK} ${rwfile} -filespec "out_${type}_lossless_%d" -define webp:lossless=true "${SRCDIR}/input_${type}.miff" WEBP
done

# XBM format
for type in ${check_types}
do
  test_command_fn "XBM ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" XBM
  test_command_fn "XBM ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" XBM
done

# XPM format
for type in ${check_types}
do
  test_command_fn "XPM ${type}" ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" XPM
  test_command_fn "XPM ${type} (stdio)" ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" XPM
done

# XWD format
for type in ${check_types}
do
  test_command_fn "XWD ${type}" -F X ${MEMCHECK} ${rwfile} -filespec "out_${type}_%d" "${SRCDIR}/input_${type}.miff" XWD
  test_command_fn "XWD ${type} (stdio)" -F X ${MEMCHECK} ${rwfile} -stdio -filespec "out_${type}_stdio_%d" "${SRCDIR}/input_${type}.miff" XWD
done

:
