Welcome to mirror list, hosted at ThFree Co, Russian Federation.

oid.c « core « tests-clar - github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08791cce651af2ec84bd4ca024324af2cc61782c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "clar_libgit2.h"

static git_oid id;
static git_oid idp;
static git_oid idm;
const char *str_oid = "ae90f12eea699729ed24555e40b9fd669da12a12";
const char *str_oid_p = "ae90f12eea699729ed";
const char *str_oid_m = "ae90f12eea699729ed24555e40b9fd669da12a12THIS IS EXTRA TEXT THAT SHOULD GET IGNORED";

void test_core_oid__initialize(void)
{
	cl_git_pass(git_oid_fromstr(&id, str_oid));
	cl_git_pass(git_oid_fromstrp(&idp, str_oid_p));
	cl_git_fail(git_oid_fromstrp(&idm, str_oid_m));
}

void test_core_oid__streq(void)
{
	cl_assert(git_oid_streq(&id, str_oid) == 0);
	cl_assert(git_oid_streq(&id, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef") == -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(&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);
}