]> git.marmaro.de Git - mmh/blobdiff - test/common.sh
* sbr/m_getfld.c: fix two bugs which could cause us to walk off
[mmh] / test / common.sh
index 1c675e20f6118c04c07c35cb0fb4e8c5b0754d32..5d46c8c2662fdd169d0151c49c2dee0f3b805111 100644 (file)
@@ -31,3 +31,22 @@ require_prog ()
     test_skip "missing $1"
   fi
 }
+
+# Some stuff for doing silly progress indicators
+progress_update ()
+{
+  THIS="$1"
+  FIRST="$2"
+  LAST="$3"
+  RANGE="$(($LAST - $FIRST))"
+  PROG="$(($THIS - $FIRST))"
+  # this automatically rounds to nearest integer
+  PERC="$(((100 * $PROG) / $RANGE))"
+  # note \r so next update will overwrite
+  printf "%3d%%\r" $PERC
+}
+
+progress_done ()
+{
+  printf "100%%\n"
+}