ipfs-test-lib: implement test_seq()
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Christian Couder committed
Jun 3, 2015 at 23:13 UTC
3c2e0ba586355c957444338a66ea354a5c213026
1 file changed
+13
test/ipfs-test-lib.sh
+13
@@ -22,3 +22,16 @@ test_sort_cmp() {
22
sort "$2" >"$2_sorted" &&
23
test_cmp "$1_sorted" "$2_sorted"
24
}
25
+
26
+# Depending on GNU seq availability is not nice.
27
+# Git also has test_seq but it uses Perl.
28
+test_seq() {
29
+ test "$1" -le "$2" || return
30
+ i="$1"
31
+ j="$2"
32
+ while test "$i" -le "$j"
33
+ do
34
+ echo "$i"
35
+ i=$(expr "$i" + 1)
36
+ done
37
+}