mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-07 04:05:08 +00:00
Added test case for new function
This commit is contained in:
parent
0c8efb38f9
commit
7e527ca700
@ -1,11 +1,17 @@
|
|||||||
#include "clar_libgit2.h"
|
#include "clar_libgit2.h"
|
||||||
|
|
||||||
static git_oid id;
|
static git_oid id;
|
||||||
|
static git_oid idp;
|
||||||
|
static git_oid idm;
|
||||||
const char *str_oid = "ae90f12eea699729ed24555e40b9fd669da12a12";
|
const char *str_oid = "ae90f12eea699729ed24555e40b9fd669da12a12";
|
||||||
|
const char *str_oid_p = "ae90f12eea699729ed";
|
||||||
|
const char *str_oid_m = "ae90f12eea699729ed24555e40b9fd669da12a12oiahs";
|
||||||
|
|
||||||
void test_core_oid__initialize(void)
|
void test_core_oid__initialize(void)
|
||||||
{
|
{
|
||||||
cl_git_pass(git_oid_fromstr(&id, str_oid));
|
cl_git_pass(git_oid_fromstr(&id, str_oid));
|
||||||
|
cl_git_pass(git_oid_fromstrp(&idp, str_oid_p));
|
||||||
|
cl_git_pass(git_oid_fromstrp(&idm, str_oid_m));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_core_oid__streq(void)
|
void test_core_oid__streq(void)
|
||||||
@ -15,4 +21,12 @@ void test_core_oid__streq(void)
|
|||||||
|
|
||||||
cl_assert(git_oid_streq(&id, "deadbeef") == -1);
|
cl_assert(git_oid_streq(&id, "deadbeef") == -1);
|
||||||
cl_assert(git_oid_streq(&id, "I'm not an oid.... :)") == -1);
|
cl_assert(git_oid_streq(&id, "I'm not an oid.... :)") == -1);
|
||||||
|
|
||||||
|
cl_assert(git_oid_streq(&idp, "ae90f12eea699729ed0000000000000000000000") == 0);
|
||||||
|
cl_assert(git_oid_streq(&idp, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef") == -1);
|
||||||
|
|
||||||
|
cl_assert(git_oid_streq(&idp, "deadbeef") == -1);
|
||||||
|
cl_assert(git_oid_streq(&idp, "I'm not an oid.... :)") == -1);
|
||||||
|
|
||||||
|
cl_assert(git_oid_cmp(&id, &idm) == 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user