5 static char *hello_id
= "22596363b3de40b06f981fb85d82312e8c0ed511";
6 static char *hello_text
= "hello world\n";
8 static char *bye_id
= "ce08fe4884650f067bd5703b6a59a8b3b3c99a09";
9 static char *bye_text
= "bye world\n";
15 must_be_true((ctx
= git_hash_new_ctx()) != NULL
);
17 /* should already be init'd */
18 git_hash_update(ctx
, hello_text
, strlen(hello_text
));
19 git_hash_final(&id2
, ctx
);
20 must_pass(git_oid_mkstr(&id1
, hello_id
));
21 must_be_true(git_oid_cmp(&id1
, &id2
) == 0);
23 /* reinit should permit reuse */
25 git_hash_update(ctx
, bye_text
, strlen(bye_text
));
26 git_hash_final(&id2
, ctx
);
27 must_pass(git_oid_mkstr(&id1
, bye_id
));
28 must_be_true(git_oid_cmp(&id1
, &id2
) == 0);
30 git_hash_free_ctx(ctx
);
36 must_pass(git_oid_mkstr(&id1
, hello_id
));
38 git_hash_buf(&id2
, hello_text
, strlen(hello_text
));
40 must_be_true(git_oid_cmp(&id1
, &id2
) == 0);
47 must_pass(git_oid_mkstr(&id1
, hello_id
));
49 vec
[0].data
= hello_text
;
51 vec
[1].data
= hello_text
+4;
52 vec
[1].len
= strlen(hello_text
)-4;
54 git_hash_vec(&id2
, vec
, 2);
56 must_be_true(git_oid_cmp(&id1
, &id2
) == 0);