]>
Commit | Line | Data |
---|---|---|
521aedad CMN |
1 | #include "clar_libgit2.h" |
2 | #include "odb.h" | |
3 | #include "git2/odb_backend.h" | |
4 | #include "pack.h" | |
5 | ||
6 | static git_odb *_odb; | |
7 | static git_repository *_repo; | |
8 | static int nobj; | |
9 | ||
10 | void test_odb_foreach__initialize(void) | |
11 | { | |
12 | cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git"))); | |
13 | git_repository_odb(&_odb, _repo); | |
14 | } | |
15 | ||
16 | void test_odb_foreach__cleanup(void) | |
17 | { | |
18 | git_odb_free(_odb); | |
19 | git_repository_free(_repo); | |
20 | } | |
21 | ||
22 | static int foreach_cb(git_oid *oid, void *data) | |
23 | { | |
24 | GIT_UNUSED(data); | |
25 | GIT_UNUSED(oid); | |
26 | ||
27 | nobj++; | |
28 | ||
29 | return 0; | |
30 | } | |
31 | ||
32 | void test_odb_foreach__foreach(void) | |
33 | { | |
34 | cl_git_pass(git_odb_foreach(_odb, foreach_cb, NULL)); | |
eca67c58 | 35 | cl_assert(nobj == 1683); |
521aedad | 36 | } |