about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-06-08 14:31:55 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-06-08 14:31:55 +0000
commitab2c3e2053f1caea636b781542bb032f72074821 (patch)
treecfedb9c69207a6a7901aa88ca027c31f3414fcf6 /test
parent92957c23f07558fa9d73e183a9739eed240bf7b4 (diff)
downloadnetpbm-mirror-ab2c3e2053f1caea636b781542bb032f72074821.tar.gz
netpbm-mirror-ab2c3e2053f1caea636b781542bb032f72074821.tar.xz
netpbm-mirror-ab2c3e2053f1caea636b781542bb032f72074821.zip
Add tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3854 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order9
-rw-r--r--test/pamendian-roundtrip.ok4
-rwxr-xr-xtest/pamendian-roundtrip.test22
-rw-r--r--test/pamexec-roundtrip.ok10
-rwxr-xr-xtest/pamexec-roundtrip.test25
-rw-r--r--test/pamexec.ok10
-rwxr-xr-xtest/pamexec.test38
-rw-r--r--test/pamfix.ok68
-rwxr-xr-xtest/pamfix.test66
-rw-r--r--test/pamvalidate.ok13
-rwxr-xr-xtest/pamvalidate.test17
-rw-r--r--test/pbmtext-iso88591.ok4
-rwxr-xr-xtest/pbmtext-iso88591.test18
-rw-r--r--test/pbmtext-utf8.ok2
-rwxr-xr-xtest/pbmtext-utf8.test22
-rw-r--r--test/pj-roundtrip.ok4
-rwxr-xr-xtest/pj-roundtrip.test22
-rw-r--r--test/rawtoppm.ok23
-rwxr-xr-xtest/rawtoppm.test72
19 files changed, 422 insertions, 27 deletions
diff --git a/test/Test-Order b/test/Test-Order
index a696529b..f907c29b 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -120,12 +120,16 @@ pamtopdbimg.test
 pbmtog3.test
 411toppm.test
 eyuvtoppm.test
+rawtoppm.test
 
 pbm-misc-converters.test
 
 # Miscellaneous utility tests
 
 ppmdfont.test
+pamfix.test
+pamvalidate.test
+pamexec.test
 
 # Round-trip tests : editors
 
@@ -145,6 +149,10 @@ enlarge-reduce-roundtrip.test
 cut-cat-roundtrip.test
 pamhue-roundtrip.test
 
+# Round-trip tests: miscellaneous utility
+
+pamexec-roundtrip.test
+
 # Round-trip tests : lossless converters
 
 ppmtoarbtxt-roundtrip.test
@@ -179,6 +187,7 @@ pi3-roundtrip.test
 pict-roundtrip.test
 png-roundtrip.test
 png-roundtrip2.test
+pj-roundtrip.test
 ps-roundtrip.test
 ps-flate-roundtrip.test
 ps-alt-roundtrip.test
diff --git a/test/pamendian-roundtrip.ok b/test/pamendian-roundtrip.ok
new file mode 100644
index 00000000..50450617
--- /dev/null
+++ b/test/pamendian-roundtrip.ok
@@ -0,0 +1,4 @@
+Test 1: Should print '0 0 0 : 0'
+0 0 0 : 0
+Test 2 should print echo '0 0 0 0 0 : 0'
+0 0 0 0 0 : 0
diff --git a/test/pamendian-roundtrip.test b/test/pamendian-roundtrip.test
new file mode 100755
index 00000000..aed03c76
--- /dev/null
+++ b/test/pamendian-roundtrip.test
@@ -0,0 +1,22 @@
+#! /bin/bash
+# This script tests: pamendian
+# Also requires: pamdepth pgmtopbm pamseq
+
+echo "Test 1: Should print '0 0 0 : 0'" 
+
+tmpdir=${tmpdir:-/tmp}
+test0_pam=${tmpdir}/test0.pam
+
+pamseq 1 65535 > ${test0_pam}
+pamendian < ${test0_pam} | pamendian |\
+  cmp -s ${test0_pam} -
+  echo ${PIPESTATUS[@]} ":" $?
+
+rm ${test0_pam}
+
+
+echo "Test 2 should print echo '0 0 0 0 0 : 0'" 
+
+pamdepth 65535 testgrid.pbm | pamendian | pamendian | \
+  pgmtopbm -th -val=0.5 | cmp -s - testgrid.pbm
+  echo ${PIPESTATUS[@]} ":" $?
\ No newline at end of file
diff --git a/test/pamexec-roundtrip.ok b/test/pamexec-roundtrip.ok
new file mode 100644
index 00000000..604ab5de
--- /dev/null
+++ b/test/pamexec-roundtrip.ok
@@ -0,0 +1,10 @@
+Test 1: should print stdin: PPM RAW 17 22 3 255 RGB six times
+stdin: PPM RAW 17 22 3 255 RGB
+stdin: PPM RAW 17 22 3 255 RGB
+stdin: PPM RAW 17 22 3 255 RGB
+stdin: PPM RAW 17 22 3 255 RGB
+stdin: PPM RAW 17 22 3 255 RGB
+stdin: PPM RAW 17 22 3 255 RGB
+Test 2: should print '0 0 : 0' twice
+0 0 : 0
+0 0 : 0
diff --git a/test/pamexec-roundtrip.test b/test/pamexec-roundtrip.test
new file mode 100755
index 00000000..fce7b6b5
--- /dev/null
+++ b/test/pamexec-roundtrip.test
@@ -0,0 +1,25 @@
+#! /bin/bash
+# This script tests: pamexec
+# Also requires: ppmpat ppmmake pamfile
+
+tmpdir=${tmpdir:-/tmp}
+test_ppm=${tmpdir}/test_ppm
+
+echo "Test 1: should print stdin: PPM RAW 17 22 3 255 RGB six times"
+
+( ppmmake rgb:0/255/127 17 22
+  ppmpat -g2 --color=rgb:143/188/143,rgb:161/161/161 17 22
+  ppmpat -g3 --color=rgb:224/255/255,rgb:255/130/171,rgb:255/48/48 17 22
+  ppmpat -madras --color=rgb:181/181/181,rgb:51/62/99,rgb:205/193/197 17 22
+  ppmpat -tartan --color=rgb:238/233/191,rgb:84/84/84,rgb:255/160/122 17 22
+  ppmpat -argyle2 --color=rgb:205/104/57,rgb:119/136/153,rgb:255/255/255 17 22
+) | tee ${test_ppm} | pamfile -all -machine
+
+echo "Test 2: should print '0 0 : 0' twice"
+
+pamexec "ppmtoppm " ${test_ppm} | cmp -s ${test_ppm} -  
+  echo ${PIPESTATUS[@]} ":" $?
+pamexec "cat " ${test_ppm} | cmp -s ${test_ppm} -  
+  echo ${PIPESTATUS[@]} ":" $?
+
+rm ${test_ppm}
diff --git a/test/pamexec.ok b/test/pamexec.ok
new file mode 100644
index 00000000..4bfa5202
--- /dev/null
+++ b/test/pamexec.ok
@@ -0,0 +1,10 @@
+Test 1 : Should print 10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE twice
+     10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE
+     10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE
+Test 2: Should print 1791121103 989 twice
+1791121103 989
+1791121103 989
+Test 3: Should print 2983705297 810 twice
+2983705297 810
+2983705297 810
+Test Invalid: Should not print anything
diff --git a/test/pamexec.test b/test/pamexec.test
new file mode 100755
index 00000000..acf162c3
--- /dev/null
+++ b/test/pamexec.test
@@ -0,0 +1,38 @@
+#! /bin/bash
+# This script tests: pamexec
+# Also requires: pbmtext pamfile pbmminkowski pbmtog3 g3topbm
+
+tmpdir=${tmpdir:-/tmp}
+test_pbm=${tmpdir}/test.pbm
+combined_pbm=${tmpdir}/combined.pbm
+
+for i in `seq 0 9`; do echo $i | pbmtext -builtin=fixed > ${test_pbm}$i; done
+cat ${test_pbm}[0123456789] > ${combined_pbm}
+
+echo "Test 1 : Should print 10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE twice"
+
+cat ${combined_pbm} | pamfile -all -mach | uniq -c 
+pamexec "pamfile -mach" ${combined_pbm}  | uniq -c
+
+echo "Test 2: Should print 1791121103 989 twice"
+
+for i in `seq 0 9`; do pbmminkowski ${test_pbm}$i   ; done | cksum
+pamexec "pbmminkowski" ${combined_pbm} | cksum
+
+rm ${test_pbm}[0123456789]
+
+echo "Test 3: Should print 2983705297 810 twice"
+
+pamexec "pbmtog3 -no | g3topbm" ${combined_pbm}  | cksum
+cat ${combined_pbm}  | cksum
+
+echo "Invalid command" 1>&2
+echo "Errors message should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+echo "Test Invalid: Should not print anything"
+
+pamexec "false" ${combined_pbm}
+pamexec "pamfile | false" ${combined_pbm}
+
+rm ${combined_pbm}
\ No newline at end of file
diff --git a/test/pamfix.ok b/test/pamfix.ok
new file mode 100644
index 00000000..7302f91e
--- /dev/null
+++ b/test/pamfix.ok
@@ -0,0 +1,68 @@
+Test 1
+P1
+5 5
+01010
+10101
+01010
+10101
+01010
+P1
+5 4
+01010
+10101
+01010
+00001
+P1
+5 4
+01010
+10101
+01010
+00001
+P1
+5 1
+01010
+Test 2
+P2
+3 3
+7
+0 1 2 
+3 4 5 
+6 7 0 
+P2
+3 2
+7
+0 1 2 
+3 4 5 
+P2
+3 2
+7
+0 1 2 
+3 4 5 
+P2
+3 3
+8
+0 1 2 
+3 4 5 
+6 7 8 
+P2
+3 3
+7
+0 1 2 
+3 4 5 
+6 7 7 
+P2
+3 3
+8
+0 1 2 
+3 4 8 
+0 0 0 
+P2
+3 3
+7
+0 1 2 
+3 4 7 
+0 0 0 
+Test invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
diff --git a/test/pamfix.test b/test/pamfix.test
new file mode 100755
index 00000000..e6021b56
--- /dev/null
+++ b/test/pamfix.test
@@ -0,0 +1,66 @@
+#! /bin/bash
+# This script tests: pamfix
+# Also requires:
+
+# Test 1.
+echo "Test 1"
+
+pbmmake -g 5 5 | pamfix -truncate -plain
+
+echo -e "P1\n5 5\n01010\n10101\n01010\n00001\n1" |\
+  pamfix -truncate -plain
+
+echo -e "P1\n5 5\n01010\n10101\n01010\n0000\n1" |\
+  pamfix -truncate -plain
+
+echo -e "P1\n5 5\n01010\n10102\n01010\n00001\n1" |\
+  pamfix -truncate -plain
+
+# Test 2
+
+echo "Test 2"
+
+echo -e "P2\n3 3\n7\n0 1 2\n3 4 5\n6 7 0" |\
+  pamfix -truncate -plain
+
+echo -e "P2\n3 3\n7\n0 1 2\n3 4 5\n6 7" |\
+  pamfix -truncate -plain
+echo -e "P2\n3 3\n7\n0 1 2\n3 4 5\n6 7 8" |\
+  pamfix -truncate -plain
+
+echo -e "P2\n3 3\n7\n0 1 2\n3 4 5\n6 7 8" |\
+  pamfix -change -plain
+
+echo -e "P2\n3 3\n7\n0 1 2\n3 4 5\n6 7 8" |\
+ pamfix -clip -plain
+
+echo -e "P2\n3 3\n7\n0 1 2\n3 4 8\n0 0 0" |\
+  pamfix -change -truncate -plain
+
+echo -e "P2\n3 3\n7\n0 1 2\n3 4 8\n0 0 0" |\
+  pamfix -clip -truncate -plain
+
+# Test Invalid
+
+echo "Test invalid"
+
+test_out=${tmpdir}/test_out
+
+echo 1>&2
+echo "Invalid command-line combination, invalid input" 1>&2
+echo "Error messages should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+echo -e "P2\n3 2\n7\n0 1 2\n6 7 8" | pamfix -change -clip > ${test_out} || \
+  echo -n "Expected failure 1";
+  test -s ${test_out}; echo " "$?
+
+echo -e "P1\n5 5" | pamfix -truncate -plain > ${test_out} || \
+  echo -n "Expected failure 2";
+  test -s ${test_out}; echo " "$?
+
+echo -e "P2\n3 3\255" | pamfix -truncate -plain > ${test_out} || \
+  echo -n "Expected failure 3";
+  test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pamvalidate.ok b/test/pamvalidate.ok
new file mode 100644
index 00000000..98b0f70a
--- /dev/null
+++ b/test/pamvalidate.ok
@@ -0,0 +1,13 @@
+valid
+P1
+5 5
+01010
+10101
+01010
+00000
+11111
+not valid: Should print 0 four times
+0
+0
+0
+0
diff --git a/test/pamvalidate.test b/test/pamvalidate.test
new file mode 100755
index 00000000..46dd1bfa
--- /dev/null
+++ b/test/pamvalidate.test
@@ -0,0 +1,17 @@
+#! /bin/bash
+# This script tests: pamvalidate
+# Also requires:
+
+echo "valid"
+echo -e "P1\n5 5\n01010\n10101\n01010\n00000\n11111\n" | pamvalidate -plain
+
+echo "not valid: Should print 0 four times"
+echo -e "P1\n5 5\n01010\n10101\n01010\n00000\n1111\n"  | pamvalidate | wc -c
+
+echo -e "P1\n5 5\n01010\n10102\n01010\n00001\n11111\n" | pamvalidate | wc -c
+
+echo -e "P1\n5\n01010\n10101\n01010\n00000\n11111\n" | pamvalidate | wc -c
+
+echo -e "P1\n5 5" | pamvalidate | wc -c
+
+
diff --git a/test/pbmtext-iso88591.ok b/test/pbmtext-iso88591.ok
index b48fb277..842c435d 100644
--- a/test/pbmtext-iso88591.ok
+++ b/test/pbmtext-iso88591.ok
@@ -1,6 +1,6 @@
 Test 1
-3806607098 5110
-3806607098 5110
+2066913605 5110
+2066913605 5110
 Test 2
 2858870527 192
 2858870527 192
diff --git a/test/pbmtext-iso88591.test b/test/pbmtext-iso88591.test
index 96b286ac..69e6ec90 100755
--- a/test/pbmtext-iso88591.test
+++ b/test/pbmtext-iso88591.test
@@ -2,20 +2,13 @@
 # This script tests: pbmtext
 # Also requires:
 
-# This test requires the iconv command and an iso-8859-1 locale
-# Skip this test if they are not available
+# This test requires an iso-8859-1 locale
+# Skip this test if it is not available
 
 LANG=C
 LC_ALL=C
 export LANG LC_ALL
 
-iconv /dev/null
-if [ $? -ne 0  ]
-  then echo "iconv command not available." 1>&2
-       echo "Skipping." 1>&2
-       exit 80;
-fi
-
 tmpdir=${tmpdir:-/tmp}
 iso88591_locale_list=${tmpdir}/iso88591_locale_list
 
@@ -51,16 +44,15 @@ locale_for_test=${locale_to_test};
 
 
 # Two rows
-# Should print 3806607098 5110 twice
-
+# Should print 2066913605 5110 twice
 echo "Test 1"
 
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
-             for (i=160;i<=255;++i) printf("%c",i); }' | \
+             for (i=161;i<=255;++i) printf("%c",i); }' | \
     pbmtext -builtin bdf | cksum
 
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
-             for (i=160;i<=255;++i) printf("%c",i); }' | \
+             for (i=161;i<=255;++i) printf("%c",i); }' | \
     LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar | cksum
 
 
diff --git a/test/pbmtext-utf8.ok b/test/pbmtext-utf8.ok
index 4bc7b00d..84743a09 100644
--- a/test/pbmtext-utf8.ok
+++ b/test/pbmtext-utf8.ok
@@ -5,7 +5,7 @@ Test 2
 2920616515 2301
 2920616515 2301
 Test 3
-0 0 0 0 : 0
+0 0 0 : 0
 Test 4
  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test
index c92dd38a..1db7d849 100755
--- a/test/pbmtext-utf8.test
+++ b/test/pbmtext-utf8.test
@@ -7,8 +7,8 @@ LC_ALL=C
 export LANG LC_ALL
 
 
-# This test requires the iconv command and a working UTF-8 locale 
-# Skip this test if they are not available
+# This test requires a working UTF-8 locale 
+# Skip this test if it is are not available
 
 iconv /dev/null
 if [ $? -ne 0  ]
@@ -61,8 +61,8 @@ awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
     pbmtext -builtin bdf | cksum
 
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
-             for (i=161;i<=255;++i) printf("%c",i);  }' | \
-    iconv -f iso8859-1 -t utf-8 | \
+             for (i=161;i<=191;++i) printf("%c%c",194,i);     \
+             for (i=128;i<=191;++i) printf("%c%c",195,i); }' | \
     LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar | cksum
 
 
@@ -84,17 +84,18 @@ output=${tmpdir}/output
 # Test 3.
 # Two rows
 # Compare with cmp.
-# Should print 0
+# Should print 0 0 0 : 0
 
 echo "Test 3"
 
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
-             for (i=161;i<=255;++i) printf("%c",i); print "" }' | \
-    iconv -f iso8859-1 -t utf-8 > ${output}
+             for (i=161;i<=191;++i) printf("%c%c",194,i);      \
+             for (i=128;i<=191;++i) printf("%c%c",195,i); print ""}' \
+    > ${output}
 
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
-             for (i=161;i<=255;++i) printf("%c",i); print "" }' | \
-    iconv -f iso8859-1 -t utf-8 | \
+             for (i=161;i<=191;++i) printf("%c%c",194,i);      \
+             for (i=128;i<=191;++i) printf("%c%c",195,i); print ""}' | \
     LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar -text-dump | \
     cmp --quiet - ${output}
 
@@ -123,8 +124,7 @@ echo "Test 5 Invalid"
 long_txt=${tmpdir}/long.txt
 test_out=${tmpdir}/test_out
 
-head -c 4999 /dev/zero | tr '\0' '\276' | \
-  iconv -f iso-8859-1 -t utf-8 > ${long_txt}
+head -c 4999 /dev/zero | sed 's@\x00@\xc2\xbe@g' > ${long_txt}
 cat ${long_txt} | wc -c
 
 cat ${long_txt} | \
diff --git a/test/pj-roundtrip.ok b/test/pj-roundtrip.ok
new file mode 100644
index 00000000..a13b01a7
--- /dev/null
+++ b/test/pj-roundtrip.ok
@@ -0,0 +1,4 @@
+Test 1. Should print:  0 0 0 0 : 0
+0 0 0 0 : 0
+Test 2. Should print:  0 0 0 0 0 : 0
+0 0 0 0 0 : 0
diff --git a/test/pj-roundtrip.test b/test/pj-roundtrip.test
new file mode 100755
index 00000000..3394a4d2
--- /dev/null
+++ b/test/pj-roundtrip.test
@@ -0,0 +1,22 @@
+#! /bin/bash
+# This script tests: ppmtopj pjtoppm
+# Also requires: pamseq pnmremap pamtopnm pamdepth ppmtopgm pgmtopbm
+
+echo "Test 1. Should print:  0 0 0 0 : 0"
+
+tmpdir=${tmpdir:-/tmp}
+test8_ppm=${tmpdir}/testimg8.ppm
+
+pamseq 3 1 | pnmremap -map - testimg.ppm | pamtopnm -assume > ${test8_ppm}
+
+ppmtopj ${test8_ppm} | pjtoppm | pamdepth 1 | \
+  cmp -s - ${test8_ppm} > /dev/null
+  echo ${PIPESTATUS[@]} ":" $?
+
+rm ${test8_ppm}
+
+echo "Test 2. Should print:  0 0 0 0 0 : 0"
+
+ppmtopj testgrid.pbm | pjtoppm | ppmtopgm | pgmtopbm | \
+  cmp -s - testgrid.pbm > /dev/null
+  echo ${PIPESTATUS[@]} ":" $?
diff --git a/test/rawtoppm.ok b/test/rawtoppm.ok
new file mode 100644
index 00000000..c61e75aa
--- /dev/null
+++ b/test/rawtoppm.ok
@@ -0,0 +1,23 @@
+Test 1: should print '0 0 : 0'
+0 0 : 0
+Test 2: should print '0 0 : 0' five times
+0 0 : 0
+0 0 : 0
+0 0 : 0
+0 0 : 0
+0 0 : 0
+Test 3: should print '0 0 0 : 0' five times
+0 0 0 : 0
+0 0 0 : 0
+0 0 0 : 0
+0 0 0 : 0
+0 0 0 : 0
+Test 4
+P3
+5 5
+255
+0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
+0 0 0  0 0 5  5 5 5  5 9 9  9 9 9
+0 1 2  3 4 0  1 2 3  4 0 1  2 3 4
+0 1 2  3 4 1  2 3 4  5 2 3  4 5 6
+9 8 7  6 5 4  3 2 1  0 0 0  0 0 0
diff --git a/test/rawtoppm.test b/test/rawtoppm.test
new file mode 100755
index 00000000..3c309259
--- /dev/null
+++ b/test/rawtoppm.test
@@ -0,0 +1,72 @@
+#! /bin/bash
+# This script tests: rawtoppm
+# Also requires: pamcut ppmtorgb3 rgb3toppm ppmtoppm
+
+# Test 1
+
+echo "Test 1: should print '0 0 : 0'"
+
+rawtoppm -headerskip 15 227 149 testimg.ppm | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+
+# Test 2
+echo "Test 2: should print '0 0 : 0' five times"
+
+tmpdir=${tmpdir:-/tmp}
+test0_ppm=${tmpdir}/test0.ppm
+
+for i in 0 1 10 99 220
+  do
+  pamcut -cropright $i testimg.ppm > ${test0_ppm}
+  rawtoppm -headerskip 15 -rowskip $((i * 3)) $((227 - i)) 149 testimg.ppm | \
+  cmp -s ${test0_ppm} -
+  echo ${PIPESTATUS[@]} ":" $?
+  done  
+
+rm ${test0_ppm}
+
+
+# Test 3
+echo "Test 3: should print '0 0 0 : 0' five times"
+
+ppmtorgb3 testimg.ppm
+
+rgb3toppm testimg.red testimg.blu testimg.grn | \
+  rawtoppm -headerskip 15 -rbg 227 149  | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+
+rgb3toppm testimg.grn testimg.red testimg.blu | \
+  rawtoppm -headerskip 15 -grb 227 149 | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+
+rgb3toppm testimg.grn testimg.blu testimg.red | \
+  rawtoppm -headerskip 15 -gbr 227 149 | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+
+rgb3toppm testimg.blu testimg.red testimg.grn | \
+  rawtoppm -headerskip 15 -brg 227 149 | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+
+rgb3toppm testimg.blu testimg.grn testimg.red | \
+  rawtoppm -headerskip 15 -bgr 227 149 | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+
+# Test 4
+echo "Test 4"
+
+test1_ppm=${tmpdir}/test1.ppm
+
+cat <<EOF > ${test1_ppm}
+P3
+5 5
+9
+0 0 0  0 0 0  0 0 0  0 0 0  0 0 0
+0 0 0  0 0 5  5 5 5  5 9 9  9 9 9
+0 1 2  3 4 0  1 2 3  4 0 1  2 3 4
+0 1 2  3 4 1  2 3 4  5 2 3  4 5 6
+9 8 7  6 5 4  3 2 1  0 0 0  0 0 0
+EOF
+
+ppmtoppm < ${test1_ppm} | rawtoppm -headerskip 9 5 5 -plain
+
+rm ${test1_ppm} testimg.red testimg.grn testimg.blu