Git 2.33.8
[git.git] / t / t0069-oidtree.sh
blobbfb1397d7b23610539803bb5c40484df6b02c836
1 #!/bin/sh
3 test_description='basic tests for the oidtree implementation'
4 . ./test-lib.sh
6 maxhexsz=$(test_oid hexsz)
7 echoid () {
8 prefix="${1:+$1 }"
9 shift
10 while test $# -gt 0
12 shortoid="$1"
13 shift
14 difference=$(($maxhexsz - ${#shortoid}))
15 printf "%s%s%0${difference}d\\n" "$prefix" "$shortoid" "0"
16 done
19 test_expect_success 'oidtree insert and contains' '
20 cat >expect <<-\EOF &&
27 EOF
29 echoid insert 444 1 2 3 4 5 a b c d e &&
30 echoid contains 44 441 440 444 4440 4444
31 echo clear
32 } | test-tool oidtree >actual &&
33 test_cmp expect actual
36 test_expect_success 'oidtree each' '
37 echoid "" 123 321 321 >expect &&
39 echoid insert f 9 8 123 321 a b c d e
40 echo each 12300
41 echo each 3211
42 echo each 3210
43 echo each 32100
44 echo clear
45 } | test-tool oidtree >actual &&
46 test_cmp expect actual
49 test_done