aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtest-all2
-rw-r--r--uniq-test/1.in0
-rw-r--r--uniq-test/1.out0
-rw-r--r--uniq-test/2.in1
-rw-r--r--uniq-test/2.out1
-rw-r--r--uniq-test/3.in3
-rw-r--r--uniq-test/3.out3
-rw-r--r--uniq-test/4.in3
-rw-r--r--uniq-test/4.out3
-rw-r--r--uniq-test/5.in3
-rw-r--r--uniq-test/5.out3
-rw-r--r--uniq-test/6.in6
-rw-r--r--uniq-test/6.out3
-rw-r--r--uniq-test/7.inbin0 -> 9 bytes
-rw-r--r--uniq-test/7.outbin0 -> 9 bytes
-rw-r--r--uniq-test/cflag.in9
-rw-r--r--uniq-test/cflag.out5
-rw-r--r--uniq-test/dflag.in6
-rw-r--r--uniq-test/dflag.out2
-rw-r--r--uniq-test/fflag.in4
-rw-r--r--uniq-test/fflag.out2
-rw-r--r--uniq-test/fsflag.in7
-rw-r--r--uniq-test/fsflag.out4
-rw-r--r--uniq-test/sflag.in4
-rw-r--r--uniq-test/sflag.out2
-rw-r--r--uniq-test/sflag_excess.in5
-rw-r--r--uniq-test/sflag_excess.out1
-rwxr-xr-xuniq-test/test147
-rw-r--r--uniq-test/uflag.in6
-rw-r--r--uniq-test/uflag.out2
30 files changed, 236 insertions, 1 deletions
diff --git a/test-all b/test-all
index 0e7227e..34ce139 100755
--- a/test-all
+++ b/test-all
@@ -6,7 +6,7 @@ function all()
{
echo patch md5sum rawshake256sum rawshake512sum sha1sum sha224sum sha256sum sha3-224sum \
sha3-256sum sha3-384sum sha3-512sum sha384sum sha512-224sum sha512-256sum sha512sum \
- shake256sum shake512sum cksum true false echo test basename dirname
+ shake256sum shake512sum cksum true false echo test basename dirname uniq
}
exec 99>&2
diff --git a/uniq-test/1.in b/uniq-test/1.in
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/uniq-test/1.in
diff --git a/uniq-test/1.out b/uniq-test/1.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/uniq-test/1.out
diff --git a/uniq-test/2.in b/uniq-test/2.in
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/uniq-test/2.in
@@ -0,0 +1 @@
+
diff --git a/uniq-test/2.out b/uniq-test/2.out
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/uniq-test/2.out
@@ -0,0 +1 @@
+
diff --git a/uniq-test/3.in b/uniq-test/3.in
new file mode 100644
index 0000000..de98044
--- /dev/null
+++ b/uniq-test/3.in
@@ -0,0 +1,3 @@
+a
+b
+c
diff --git a/uniq-test/3.out b/uniq-test/3.out
new file mode 100644
index 0000000..de98044
--- /dev/null
+++ b/uniq-test/3.out
@@ -0,0 +1,3 @@
+a
+b
+c
diff --git a/uniq-test/4.in b/uniq-test/4.in
new file mode 100644
index 0000000..bfdaa0f
--- /dev/null
+++ b/uniq-test/4.in
@@ -0,0 +1,3 @@
+a
+b
+
diff --git a/uniq-test/4.out b/uniq-test/4.out
new file mode 100644
index 0000000..bfdaa0f
--- /dev/null
+++ b/uniq-test/4.out
@@ -0,0 +1,3 @@
+a
+b
+
diff --git a/uniq-test/5.in b/uniq-test/5.in
new file mode 100644
index 0000000..8f468ef
--- /dev/null
+++ b/uniq-test/5.in
@@ -0,0 +1,3 @@
+a
+b
+a
diff --git a/uniq-test/5.out b/uniq-test/5.out
new file mode 100644
index 0000000..8f468ef
--- /dev/null
+++ b/uniq-test/5.out
@@ -0,0 +1,3 @@
+a
+b
+a
diff --git a/uniq-test/6.in b/uniq-test/6.in
new file mode 100644
index 0000000..a97cece
--- /dev/null
+++ b/uniq-test/6.in
@@ -0,0 +1,6 @@
+a
+a
+b
+b
+c
+c
diff --git a/uniq-test/6.out b/uniq-test/6.out
new file mode 100644
index 0000000..de98044
--- /dev/null
+++ b/uniq-test/6.out
@@ -0,0 +1,3 @@
+a
+b
+c
diff --git a/uniq-test/7.in b/uniq-test/7.in
new file mode 100644
index 0000000..ed1ccaf
--- /dev/null
+++ b/uniq-test/7.in
Binary files differ
diff --git a/uniq-test/7.out b/uniq-test/7.out
new file mode 100644
index 0000000..ed1ccaf
--- /dev/null
+++ b/uniq-test/7.out
Binary files differ
diff --git a/uniq-test/cflag.in b/uniq-test/cflag.in
new file mode 100644
index 0000000..7f2efd0
--- /dev/null
+++ b/uniq-test/cflag.in
@@ -0,0 +1,9 @@
+a
+b
+b
+c
+c
+c
+b
+b
+a
diff --git a/uniq-test/cflag.out b/uniq-test/cflag.out
new file mode 100644
index 0000000..6a137de
--- /dev/null
+++ b/uniq-test/cflag.out
@@ -0,0 +1,5 @@
+1 a
+2 b
+3 c
+2 b
+1 a
diff --git a/uniq-test/dflag.in b/uniq-test/dflag.in
new file mode 100644
index 0000000..b3040d6
--- /dev/null
+++ b/uniq-test/dflag.in
@@ -0,0 +1,6 @@
+1
+2
+2
+a
+b
+b
diff --git a/uniq-test/dflag.out b/uniq-test/dflag.out
new file mode 100644
index 0000000..bdaf90f
--- /dev/null
+++ b/uniq-test/dflag.out
@@ -0,0 +1,2 @@
+2
+b
diff --git a/uniq-test/fflag.in b/uniq-test/fflag.in
new file mode 100644
index 0000000..aa9c83e
--- /dev/null
+++ b/uniq-test/fflag.in
@@ -0,0 +1,4 @@
+a b c d e f
+A b c d e f
+A B c d e f
+A B C d e f
diff --git a/uniq-test/fflag.out b/uniq-test/fflag.out
new file mode 100644
index 0000000..cb9fb63
--- /dev/null
+++ b/uniq-test/fflag.out
@@ -0,0 +1,2 @@
+a b c d e f
+A B C d e f
diff --git a/uniq-test/fsflag.in b/uniq-test/fsflag.in
new file mode 100644
index 0000000..7bed3cd
--- /dev/null
+++ b/uniq-test/fsflag.in
@@ -0,0 +1,7 @@
+a b c d e f
+A b c d e f
+A B c d e f
+A B C d e f
+A B C D e f
+A B C D E f
+A B C D E F
diff --git a/uniq-test/fsflag.out b/uniq-test/fsflag.out
new file mode 100644
index 0000000..eb7f382
--- /dev/null
+++ b/uniq-test/fsflag.out
@@ -0,0 +1,4 @@
+a b c d e f
+A B C D e f
+A B C D E f
+A B C D E F
diff --git a/uniq-test/sflag.in b/uniq-test/sflag.in
new file mode 100644
index 0000000..577a22d
--- /dev/null
+++ b/uniq-test/sflag.in
@@ -0,0 +1,4 @@
+aa
+ba
+bb
+ab
diff --git a/uniq-test/sflag.out b/uniq-test/sflag.out
new file mode 100644
index 0000000..6ad4673
--- /dev/null
+++ b/uniq-test/sflag.out
@@ -0,0 +1,2 @@
+aa
+bb
diff --git a/uniq-test/sflag_excess.in b/uniq-test/sflag_excess.in
new file mode 100644
index 0000000..9405325
--- /dev/null
+++ b/uniq-test/sflag_excess.in
@@ -0,0 +1,5 @@
+a
+b
+c
+d
+e
diff --git a/uniq-test/sflag_excess.out b/uniq-test/sflag_excess.out
new file mode 100644
index 0000000..7898192
--- /dev/null
+++ b/uniq-test/sflag_excess.out
@@ -0,0 +1 @@
+a
diff --git a/uniq-test/test b/uniq-test/test
new file mode 100755
index 0000000..f5393a0
--- /dev/null
+++ b/uniq-test/test
@@ -0,0 +1,147 @@
+#!/bin/bash
+
+cd -- "$(dirname "$0")"
+if test -z "$UNIQ"; then
+ UNIQ=../uniq
+fi
+N=7
+u="$PREFIX $UNIQ"
+
+report ()
+{
+ if test $1 = 0; then
+ printf "\033[1;32mTest %s OK\033[m\n" "$2"
+ else
+ printf "\033[1;31mTest %s FAILED\033[m\n" "$2"
+ fi
+}
+
+report_np ()
+{
+ if test $1 = 0; then
+ printf "\033[1;32mTest %s OK (NON-POSIX)\033[m\n" "$2"
+ else
+ printf "\033[1;31mTest %s FAILED (NON-POSIX)\033[m\n" "$2"
+ fi
+}
+
+test_file ()
+{
+ diff <($u < $1.in) $1.out > /dev/null
+ report $? "file_$1"
+}
+
+
+file_1 () { test_file 1; }
+file_2 () { test_file 2; }
+file_3 () { test_file 3; }
+file_4 () { test_file 4; }
+file_5 () { test_file 5; }
+file_6 () { test_file 6; }
+file_7 () { test_file 7; }
+
+dflag ()
+{
+ diff <($u -d < dflag.in) dflag.out > /dev/null
+ report $? "dflag"
+}
+
+uflag ()
+{
+ diff <($u -u < uflag.in) uflag.out > /dev/null
+ report $? "uflag"
+}
+
+cflag ()
+{
+ diff <($u -c < cflag.in | sed 's/^ *//') cflag.out > /dev/null
+ # The `sed` is due to conflicting specifications in uniq(1p).
+ report $? "cflag"
+}
+
+sflag_excess ()
+{
+ diff <($u -s10 < sflag_excess.in) sflag_excess.out > /dev/null
+ report $? "sflag_excess"
+}
+
+sflag ()
+{
+ diff <($u -s1 < sflag.in) sflag.out > /dev/null
+ report $? "sflag"
+}
+
+f0flag ()
+{
+ diff <($u -f0 < 5.in) 5.out > /dev/null
+ report_np $? "f0flag"
+}
+
+fflag_excess ()
+{
+ diff <($u -f10 < 5.in) <(head -n 1 < 5.out) > /dev/null
+ report $? "fflag_excess"
+}
+
+fflag ()
+{
+ diff <($u -f2 < fflag.in) fflag.out > /dev/null
+ report $? "fflag"
+}
+
+fsflag ()
+{
+ diff <($u -f2 -s2 < fsflag.in) fsflag.out > /dev/null
+ report $? "fsflag"
+}
+
+file_in ()
+{
+ diff <($u 5.in) 5.out > /dev/null
+ report $? "file_in"
+}
+
+dash_in ()
+{
+ diff <($u - < 5.in) 5.out > /dev/null
+ report $? "dash_in"
+}
+
+file_out ()
+{
+ $u - tmp < 5.in && diff tmp 5.out > /dev/null
+ report $? "file_out"
+}
+
+dash_out ()
+{
+ touch tmp; rm tmp;
+ $u - - < 5.in > tmp && diff tmp 5.out > /dev/null
+ report_np $? "dash_out"
+ if test -f ./-; then
+ rm ./-
+ fi
+}
+
+
+if test $# = 0; then
+ set $(printf 'file_%i\n' $(seq 1 $N)) dflag uflag cflag sflag_excess \
+ sflag f0flag fflag_excess fflag fsflag file_in dash_in file_out \
+ dash_out
+fi
+(
+for f in $@; do
+ $f
+done
+) | tee result
+! grep FAILED < result > /dev/null
+ret=$?
+if test $ret != 0; then
+ if test $(grep FAILED < result | grep -v NON-POSIX | wc -l) = 0; then
+ ret=1
+ else
+ ret=2
+ fi
+fi
+rm result
+exit $ret
diff --git a/uniq-test/uflag.in b/uniq-test/uflag.in
new file mode 100644
index 0000000..b3040d6
--- /dev/null
+++ b/uniq-test/uflag.in
@@ -0,0 +1,6 @@
+1
+2
+2
+a
+b
+b
diff --git a/uniq-test/uflag.out b/uniq-test/uflag.out
new file mode 100644
index 0000000..e439850
--- /dev/null
+++ b/uniq-test/uflag.out
@@ -0,0 +1,2 @@
+1
+a