diff --git a/t/140-shuffle/.gitignore b/t/140-shuffle/.gitignore new file mode 100644 index 0000000..397b4a7 --- /dev/null +++ b/t/140-shuffle/.gitignore @@ -0,0 +1 @@ +*.log diff --git a/t/140-shuffle/all.do b/t/140-shuffle/all.do new file mode 100644 index 0000000..fd88405 --- /dev/null +++ b/t/140-shuffle/all.do @@ -0,0 +1,19 @@ +exec >&2 +. ../skip-if-minimal-do.sh + +# Need to repeat this several times, on the off chance that shuffling the +# input happens to give us the same output (probability 1/factorial(9)) +x=0 +while [ "$x" -lt 10 ]; do + x=$(($x + 1)) + rm -f out.log + redo --shuffle 1.x 2.x 3.x 4.x 5.x 6.x 7.x 8.x 9.x + sort out.log >sort.log + if ! diff -q out.log sort.log >/dev/null; then + exit 0 + fi + echo "retry: #$x" +done + +# still not shuffled? +exit 22 diff --git a/t/140-shuffle/clean.do b/t/140-shuffle/clean.do new file mode 100644 index 0000000..880a5b1 --- /dev/null +++ b/t/140-shuffle/clean.do @@ -0,0 +1 @@ +rm -f *.log *~ .*~ diff --git a/t/140-shuffle/default.x.do b/t/140-shuffle/default.x.do new file mode 100644 index 0000000..2e904cd --- /dev/null +++ b/t/140-shuffle/default.x.do @@ -0,0 +1 @@ +echo $1 >>out.log