about summary refs log tree commit diff
path: root/test/pbmnoise1.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-06-28 17:29:32 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-06-28 17:29:32 +0000
commit23ce26f64c34e30951ad9ade2151552ed77e7357 (patch)
treed73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /test/pbmnoise1.test
parent1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff)
downloadnetpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz
netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz
netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pbmnoise1.test')
-rwxr-xr-xtest/pbmnoise1.test38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/pbmnoise1.test b/test/pbmnoise1.test
new file mode 100755
index 00000000..855a5629
--- /dev/null
+++ b/test/pbmnoise1.test
@@ -0,0 +1,38 @@
+#! /bin/sh
+# This script tests: pbmnoise
+#
+
+# Assumes that the random number generator is Mersenne Twister
+
+echo "Test 1.  Should print 242292858 962 five times"
+
+for arg in "" "-ratio=1/2" "-ratio=256/512" "-ratio=32768/65536" "-pack" 
+    do
+    pbmnoise -endian=big -randomseed=1 1088 7 ${arg} | cksum
+done
+
+echo "Test 2."
+
+for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \
+	 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 
+         # for i in `seq 0 32`
+  do
+  pbmnoise -endian=little -randomseed=11 -ratio=$i/32 -plain 32 1 | \
+  tr '\n' ' ';  echo
+done
+
+echo "Test 3.  Should print 126142586 1218 four times"
+
+pbmnoise -endian=big -pack -randomseed=12 -plain 19 64 | sed 2d | tr -d '\n' | cksum
+pbmnoise -endian=big -pack -randomseed=12 -plain 152 8 | sed 2d | tr -d '\n' | cksum
+pbmnoise -endian=big -pack -randomseed=12 -plain 64 19 | sed 2d | tr -d '\n' | cksum
+pbmnoise -endian=big       -randomseed=12 -plain 64 19 | sed 2d | tr -d '\n' | cksum
+
+echo "Test 4."
+
+   pbmnoise -endian=big    -randomseed=23 64 1 -plain | tr '\n' ' '; echo
+(  pbmnoise -endian=native -randomseed=23 64 1 -plain | tr '\n' ' '; echo 
+   pbmnoise -endian=swap   -randomseed=23 64 1 -plain | tr '\n' ' '; echo
+)  | sort -nr
+   pbmnoise -endian=little -randomseed=23 64 1 -plain | tr '\n' ' '; echo
+