Add external API for revision sorting.
[libgit2.git] / tests / test_helpers.h
blob2c09181f38234634e478130191323c7f74958c33
1 /*
2 * This file is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2,
4 * as published by the Free Software Foundation.
6 * In addition to the permissions in the GNU General Public License,
7 * the authors give you unlimited permission to link the compiled
8 * version of this file into combinations with other programs,
9 * and to distribute those combinations without any restriction
10 * coming from the use of this file. (The General Public License
11 * restrictions do apply in other respects; for example, they cover
12 * modification of the file, and distribution when not linked into
13 * a combined executable.)
15 * This file is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; see the file COPYING. If not, write to
22 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
26 #ifndef INCLUDE_test_helpers_h__
27 #define INCLUDE_test_helpers_h__
29 #include "test_lib.h"
30 #include <git/odb.h>
33 typedef struct object_data {
34 unsigned char *bytes; /* (compressed) bytes stored in object store */
35 size_t blen; /* length of data in object store */
36 char *id; /* object id (sha1) */
37 char *type; /* object type */
38 char *dir; /* object store (fan-out) directory name */
39 char *file; /* object store filename */
40 unsigned char *data; /* (uncompressed) object data */
41 size_t dlen; /* length of (uncompressed) object data */
42 } object_data;
44 extern int write_object_data(char *file, void *data, size_t len);
46 extern int write_object_files(const char *odb_dir, object_data *d);
48 extern int remove_object_files(const char *odb_dir, object_data *d);
50 extern int cmp_objects(git_obj *o, object_data *d);
52 #endif
53 /* INCLUDE_test_helpers_h__ */