about summary refs log tree commit diff
path: root/test/pamfix.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-06-28 17:52:14 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-06-28 17:52:14 +0000
commit1cd3ef0dd6c2236d0b329879bacd9360d01c88a1 (patch)
treea60016b5dd48fbf681ebfb43a6ca0d7e20a391d8 /test/pamfix.test
parentcbbf595776cee6b8d8a24becf49ee6468eeba712 (diff)
downloadnetpbm-mirror-1cd3ef0dd6c2236d0b329879bacd9360d01c88a1.tar.gz
netpbm-mirror-1cd3ef0dd6c2236d0b329879bacd9360d01c88a1.tar.xz
netpbm-mirror-1cd3ef0dd6c2236d0b329879bacd9360d01c88a1.zip
Promote Development to Advaanced - Release 10.91
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3877 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamfix.test')
-rwxr-xr-xtest/pamfix.test66
1 files changed, 66 insertions, 0 deletions
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}