]> git.proxmox.com Git - libgit2.git/blame - tests-clar/odb/foreach.c
Fix git_tree_walk to return user error
[libgit2.git] / tests-clar / odb / foreach.c
CommitLineData
521aedad
CMN
1#include "clar_libgit2.h"
2#include "odb.h"
3#include "git2/odb_backend.h"
4#include "pack.h"
5
6static git_odb *_odb;
7static git_repository *_repo;
8static int nobj;
9
10void 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
16void test_odb_foreach__cleanup(void)
17{
18 git_odb_free(_odb);
19 git_repository_free(_repo);
20}
21
22static 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
32void 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}