bitmap_position_packfile(): convert to new revindex API
[git.git] / t / t0016-oidmap.sh
blob31f8276ba82bad3129c4a3cfa92f2d0ba798073c
1 #!/bin/sh
3 test_description='test oidmap'
4 . ./test-lib.sh
6 # This purposefully is very similar to t0011-hashmap.sh
8 test_oidmap () {
9 echo "$1" | test-tool oidmap $3 >actual &&
10 echo "$2" >expect &&
11 test_cmp expect actual
15 test_expect_success 'setup' '
17 test_commit one &&
18 test_commit two &&
19 test_commit three &&
20 test_commit four
24 test_expect_success 'put' '
26 test_oidmap "put one 1
27 put two 2
28 put invalidOid 4
29 put three 3" "NULL
30 NULL
31 Unknown oid: invalidOid
32 NULL"
36 test_expect_success 'replace' '
38 test_oidmap "put one 1
39 put two 2
40 put three 3
41 put invalidOid 4
42 put two deux
43 put one un" "NULL
44 NULL
45 NULL
46 Unknown oid: invalidOid
52 test_expect_success 'get' '
54 test_oidmap "put one 1
55 put two 2
56 put three 3
57 get two
58 get four
59 get invalidOid
60 get one" "NULL
61 NULL
62 NULL
64 NULL
65 Unknown oid: invalidOid
70 test_expect_success 'remove' '
72 test_oidmap "put one 1
73 put two 2
74 put three 3
75 remove one
76 remove two
77 remove invalidOid
78 remove four" "NULL
79 NULL
80 NULL
83 Unknown oid: invalidOid
84 NULL"
88 test_expect_success 'iterate' '
89 test-tool oidmap >actual.raw <<-\EOF &&
90 put one 1
91 put two 2
92 put three 3
93 iterate
94 EOF
96 # sort "expect" too so we do not rely on the order of particular oids
97 sort >expect <<-EOF &&
98 NULL
99 NULL
100 NULL
101 $(git rev-parse one) 1
102 $(git rev-parse two) 2
103 $(git rev-parse three) 3
106 sort <actual.raw >actual &&
107 test_cmp expect actual
110 test_done