summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/t0102-objtype.c75
-rw-r--r--tests/test_helpers.c4
-rw-r--r--tests/test_helpers.h2
3 files changed, 40 insertions, 41 deletions
diff --git a/tests/t0102-objtype.c b/tests/t0102-objtype.c
index a234798ea..ec4e15d44 100644
--- a/tests/t0102-objtype.c
+++ b/tests/t0102-objtype.c
@@ -1,50 +1,51 @@
#include "test_lib.h"
#include <git/odb.h>
+#include <git/object.h>
BEGIN_TEST(type_to_string)
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ_BAD), ""));
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ__EXT1), ""));
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ_COMMIT), "commit"));
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ_TREE), "tree"));
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ_BLOB), "blob"));
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ_TAG), "tag"));
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ__EXT2), ""));
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ_OFS_DELTA), "OFS_DELTA"));
- must_be_true(!strcmp(git_otype_tostring(GIT_OBJ_REF_DELTA), "REF_DELTA"));
-
- must_be_true(!strcmp(git_otype_tostring(-2), ""));
- must_be_true(!strcmp(git_otype_tostring(8), ""));
- must_be_true(!strcmp(git_otype_tostring(1234), ""));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ_BAD), ""));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ__EXT1), ""));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ_COMMIT), "commit"));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ_TREE), "tree"));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ_BLOB), "blob"));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ_TAG), "tag"));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ__EXT2), ""));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA"));
+ must_be_true(!strcmp(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA"));
+
+ must_be_true(!strcmp(git_object_type2string(-2), ""));
+ must_be_true(!strcmp(git_object_type2string(8), ""));
+ must_be_true(!strcmp(git_object_type2string(1234), ""));
END_TEST
BEGIN_TEST(string_to_type)
- must_be_true(git_otype_fromstring(NULL) == GIT_OBJ_BAD);
- must_be_true(git_otype_fromstring("") == GIT_OBJ_BAD);
- must_be_true(git_otype_fromstring("commit") == GIT_OBJ_COMMIT);
- must_be_true(git_otype_fromstring("tree") == GIT_OBJ_TREE);
- must_be_true(git_otype_fromstring("blob") == GIT_OBJ_BLOB);
- must_be_true(git_otype_fromstring("tag") == GIT_OBJ_TAG);
- must_be_true(git_otype_fromstring("OFS_DELTA") == GIT_OBJ_OFS_DELTA);
- must_be_true(git_otype_fromstring("REF_DELTA") == GIT_OBJ_REF_DELTA);
-
- must_be_true(git_otype_fromstring("CoMmIt") == GIT_OBJ_BAD);
- must_be_true(git_otype_fromstring("hohoho") == GIT_OBJ_BAD);
+ must_be_true(git_object_string2type(NULL) == GIT_OBJ_BAD);
+ must_be_true(git_object_string2type("") == GIT_OBJ_BAD);
+ must_be_true(git_object_string2type("commit") == GIT_OBJ_COMMIT);
+ must_be_true(git_object_string2type("tree") == GIT_OBJ_TREE);
+ must_be_true(git_object_string2type("blob") == GIT_OBJ_BLOB);
+ must_be_true(git_object_string2type("tag") == GIT_OBJ_TAG);
+ must_be_true(git_object_string2type("OFS_DELTA") == GIT_OBJ_OFS_DELTA);
+ must_be_true(git_object_string2type("REF_DELTA") == GIT_OBJ_REF_DELTA);
+
+ must_be_true(git_object_string2type("CoMmIt") == GIT_OBJ_BAD);
+ must_be_true(git_object_string2type("hohoho") == GIT_OBJ_BAD);
END_TEST
BEGIN_TEST(loose_object)
- must_be_true(git_otype_is_loose(GIT_OBJ_BAD) == 0);
- must_be_true(git_otype_is_loose(GIT_OBJ__EXT1) == 0);
- must_be_true(git_otype_is_loose(GIT_OBJ_COMMIT) == 1);
- must_be_true(git_otype_is_loose(GIT_OBJ_TREE) == 1);
- must_be_true(git_otype_is_loose(GIT_OBJ_BLOB) == 1);
- must_be_true(git_otype_is_loose(GIT_OBJ_TAG) == 1);
- must_be_true(git_otype_is_loose(GIT_OBJ__EXT2) == 0);
- must_be_true(git_otype_is_loose(GIT_OBJ_OFS_DELTA) == 0);
- must_be_true(git_otype_is_loose(GIT_OBJ_REF_DELTA) == 0);
-
- must_be_true(git_otype_is_loose(-2) == 0);
- must_be_true(git_otype_is_loose(8) == 0);
- must_be_true(git_otype_is_loose(1234) == 0);
+ must_be_true(git_object_typeisloose(GIT_OBJ_BAD) == 0);
+ must_be_true(git_object_typeisloose(GIT_OBJ__EXT1) == 0);
+ must_be_true(git_object_typeisloose(GIT_OBJ_COMMIT) == 1);
+ must_be_true(git_object_typeisloose(GIT_OBJ_TREE) == 1);
+ must_be_true(git_object_typeisloose(GIT_OBJ_BLOB) == 1);
+ must_be_true(git_object_typeisloose(GIT_OBJ_TAG) == 1);
+ must_be_true(git_object_typeisloose(GIT_OBJ__EXT2) == 0);
+ must_be_true(git_object_typeisloose(GIT_OBJ_OFS_DELTA) == 0);
+ must_be_true(git_object_typeisloose(GIT_OBJ_REF_DELTA) == 0);
+
+ must_be_true(git_object_typeisloose(-2) == 0);
+ must_be_true(git_object_typeisloose(8) == 0);
+ must_be_true(git_object_typeisloose(1234) == 0);
END_TEST
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index cd14c0e29..5fd9a565a 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -26,8 +26,6 @@
#include "common.h"
#include "test_helpers.h"
#include "fileops.h"
-#include "git/oid.h"
-#include "git/repository.h"
int write_object_data(char *file, void *data, size_t len)
{
@@ -125,7 +123,7 @@ int remove_loose_object(const char *repository_folder, git_object *object)
int cmp_objects(git_rawobj *o, object_data *d)
{
- if (o->type != git_otype_fromstring(d->type))
+ if (o->type != git_object_string2type(d->type))
return -1;
if (o->len != d->dlen)
return -1;
diff --git a/tests/test_helpers.h b/tests/test_helpers.h
index 7085c645e..d6d32140e 100644
--- a/tests/test_helpers.h
+++ b/tests/test_helpers.h
@@ -27,7 +27,7 @@
#define INCLUDE_test_helpers_h__
#include "test_lib.h"
-#include <git/odb.h>
+#include <git.h>
#define ODB_FOLDER "../resources/testrepo.git/objects/"
#define REPOSITORY_FOLDER "../resources/testrepo.git/"