Commit 20ec426d by Ben Straub

Discovered cl_git_strequal! Mounted a crusade!

parent fd29cd13
...@@ -8,7 +8,7 @@ void test_buf_basic__resize(void) ...@@ -8,7 +8,7 @@ void test_buf_basic__resize(void)
git_buf buf1 = GIT_BUF_INIT; git_buf buf1 = GIT_BUF_INIT;
git_buf_puts(&buf1, test_string); git_buf_puts(&buf1, test_string);
cl_assert(git_buf_oom(&buf1) == 0); cl_assert(git_buf_oom(&buf1) == 0);
cl_assert(strcmp(git_buf_cstr(&buf1), test_string) == 0); cl_assert_strequal(git_buf_cstr(&buf1), test_string);
git_buf_puts(&buf1, test_string); git_buf_puts(&buf1, test_string);
cl_assert(strlen(git_buf_cstr(&buf1)) == strlen(test_string) * 2); cl_assert(strlen(git_buf_cstr(&buf1)) == strlen(test_string) * 2);
...@@ -20,10 +20,10 @@ void test_buf_basic__printf(void) ...@@ -20,10 +20,10 @@ void test_buf_basic__printf(void)
git_buf buf2 = GIT_BUF_INIT; git_buf buf2 = GIT_BUF_INIT;
git_buf_printf(&buf2, "%s %s %d ", "shoop", "da", 23); git_buf_printf(&buf2, "%s %s %d ", "shoop", "da", 23);
cl_assert(git_buf_oom(&buf2) == 0); cl_assert(git_buf_oom(&buf2) == 0);
cl_assert(strcmp(git_buf_cstr(&buf2), "shoop da 23 ") == 0); cl_assert_strequal(git_buf_cstr(&buf2), "shoop da 23 ");
git_buf_printf(&buf2, "%s %d", "woop", 42); git_buf_printf(&buf2, "%s %d", "woop", 42);
cl_assert(git_buf_oom(&buf2) == 0); cl_assert(git_buf_oom(&buf2) == 0);
cl_assert(strcmp(git_buf_cstr(&buf2), "shoop da 23 woop 42") == 0); cl_assert_strequal(git_buf_cstr(&buf2), "shoop da 23 woop 42");
git_buf_free(&buf2); git_buf_free(&buf2);
} }
...@@ -21,7 +21,7 @@ static int mv_read_cb(const char *name, const char *value, void *data) ...@@ -21,7 +21,7 @@ static int mv_read_cb(const char *name, const char *value, void *data)
if (!strcmp(name, _name)) if (!strcmp(name, _name))
(*n)++; (*n)++;
return 0; return GIT_SUCCESS;
} }
void test_config_multivar__foreach(void) void test_config_multivar__foreach(void)
......
...@@ -26,9 +26,9 @@ void test_config_new__write_new_config(void) ...@@ -26,9 +26,9 @@ void test_config_new__write_new_config(void)
cl_git_pass(git_config_add_file(config, file, 0)); cl_git_pass(git_config_add_file(config, file, 0));
cl_git_pass(git_config_get_string(config, "color.ui", &out)); cl_git_pass(git_config_get_string(config, "color.ui", &out));
cl_assert(strcmp(out, "auto") == 0); cl_assert_strequal(out, "auto");
cl_git_pass(git_config_get_string(config, "core.editor", &out)); cl_git_pass(git_config_get_string(config, "core.editor", &out));
cl_assert(strcmp(out, "ed") == 0); cl_assert_strequal(out, "ed");
git_config_free(config); git_config_free(config);
......
...@@ -28,9 +28,9 @@ void test_config_read__case_sensitive(void) ...@@ -28,9 +28,9 @@ void test_config_read__case_sensitive(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config1"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config1")));
cl_git_pass(git_config_get_string(cfg, "this.that.other", &str)); cl_git_pass(git_config_get_string(cfg, "this.that.other", &str));
cl_assert(!strcmp(str, "true")); cl_assert_strequal(str, "true");
cl_git_pass(git_config_get_string(cfg, "this.That.other", &str)); cl_git_pass(git_config_get_string(cfg, "this.That.other", &str));
cl_assert(!strcmp(str, "yes")); cl_assert_strequal(str, "yes");
cl_git_pass(git_config_get_bool(cfg, "this.that.other", &i)); cl_git_pass(git_config_get_bool(cfg, "this.that.other", &i));
cl_assert(i == 1); cl_assert(i == 1);
...@@ -55,7 +55,7 @@ void test_config_read__multiline_value(void) ...@@ -55,7 +55,7 @@ void test_config_read__multiline_value(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config2"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config2")));
cl_git_pass(git_config_get_string(cfg, "this.That.and", &str)); cl_git_pass(git_config_get_string(cfg, "this.That.and", &str));
cl_assert(!strcmp(str, "one one one two two three three")); cl_assert_strequal(str, "one one one two two three three");
git_config_free(cfg); git_config_free(cfg);
} }
...@@ -71,7 +71,7 @@ void test_config_read__subsection_header(void) ...@@ -71,7 +71,7 @@ void test_config_read__subsection_header(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config3"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config3")));
cl_git_pass(git_config_get_string(cfg, "section.subsection.var", &str)); cl_git_pass(git_config_get_string(cfg, "section.subsection.var", &str));
cl_assert(!strcmp(str, "hello")); cl_assert_strequal(str, "hello");
/* The subsection is transformed to lower-case */ /* The subsection is transformed to lower-case */
cl_must_fail(git_config_get_string(cfg, "section.subSectIon.var", &str)); cl_must_fail(git_config_get_string(cfg, "section.subSectIon.var", &str));
...@@ -171,10 +171,10 @@ void test_config_read__prefixes(void) ...@@ -171,10 +171,10 @@ void test_config_read__prefixes(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config9"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config9")));
cl_git_pass(git_config_get_string(cfg, "remote.ab.url", &str)); cl_git_pass(git_config_get_string(cfg, "remote.ab.url", &str));
cl_assert(strcmp(str, "http://example.com/git/ab") == 0); cl_assert_strequal(str, "http://example.com/git/ab");
cl_git_pass(git_config_get_string(cfg, "remote.abba.url", &str)); cl_git_pass(git_config_get_string(cfg, "remote.abba.url", &str));
cl_assert(strcmp(str, "http://example.com/git/abba") == 0); cl_assert_strequal(str, "http://example.com/git/abba");
git_config_free(cfg); git_config_free(cfg);
} }
......
...@@ -106,7 +106,7 @@ void test_index_tests__default_test_index(void) ...@@ -106,7 +106,7 @@ void test_index_tests__default_test_index(void)
for (i = 0; i < ARRAY_SIZE(test_entries); ++i) { for (i = 0; i < ARRAY_SIZE(test_entries); ++i) {
git_index_entry *e = entries[test_entries[i].index]; git_index_entry *e = entries[test_entries[i].index];
cl_assert(strcmp(e->path, test_entries[i].path) == 0); cl_assert_strequal(e->path, test_entries[i].path);
cl_assert(e->mtime.seconds == test_entries[i].mtime); cl_assert(e->mtime.seconds == test_entries[i].mtime);
cl_assert(e->file_size == test_entries[i].file_size); cl_assert(e->file_size == test_entries[i].file_size);
} }
......
...@@ -28,6 +28,6 @@ void test_network_createremotethenload__cleanup(void) ...@@ -28,6 +28,6 @@ void test_network_createremotethenload__cleanup(void)
void test_network_createremotethenload__parsing(void) void test_network_createremotethenload__parsing(void)
{ {
cl_assert(!strcmp(git_remote_name(_remote), "origin")); cl_assert_strequal(git_remote_name(_remote), "origin");
cl_assert(!strcmp(git_remote_url(_remote), url)); cl_assert_strequal(git_remote_url(_remote), url);
} }
...@@ -27,8 +27,8 @@ void test_network_remotes__cleanup(void) ...@@ -27,8 +27,8 @@ void test_network_remotes__cleanup(void)
void test_network_remotes__parsing(void) void test_network_remotes__parsing(void)
{ {
cl_assert(!strcmp(git_remote_name(_remote), "test")); cl_assert_strequal(git_remote_name(_remote), "test");
cl_assert(!strcmp(git_remote_url(_remote), "git://github.com/libgit2/libgit2")); cl_assert_strequal(git_remote_url(_remote), "git://github.com/libgit2/libgit2");
} }
void test_network_remotes__parsing_ssh_remote(void) void test_network_remotes__parsing_ssh_remote(void)
...@@ -53,24 +53,24 @@ void test_network_remotes__unsupported_transport_methods_are_unsupported(void) ...@@ -53,24 +53,24 @@ void test_network_remotes__unsupported_transport_methods_are_unsupported(void)
void test_network_remotes__refspec_parsing(void) void test_network_remotes__refspec_parsing(void)
{ {
cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*")); cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/test/*")); cl_assert_strequal(git_refspec_dst(_refspec), "refs/remotes/test/*");
} }
void test_network_remotes__set_fetchspec(void) void test_network_remotes__set_fetchspec(void)
{ {
cl_git_pass(git_remote_set_fetchspec(_remote, "refs/*:refs/*")); cl_git_pass(git_remote_set_fetchspec(_remote, "refs/*:refs/*"));
_refspec = git_remote_fetchspec(_remote); _refspec = git_remote_fetchspec(_remote);
cl_assert(!strcmp(git_refspec_src(_refspec), "refs/*")); cl_assert_strequal(git_refspec_src(_refspec), "refs/*");
cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/*")); cl_assert_strequal(git_refspec_dst(_refspec), "refs/*");
} }
void test_network_remotes__set_pushspec(void) void test_network_remotes__set_pushspec(void)
{ {
cl_git_pass(git_remote_set_pushspec(_remote, "refs/*:refs/*")); cl_git_pass(git_remote_set_pushspec(_remote, "refs/*:refs/*"));
_refspec = git_remote_pushspec(_remote); _refspec = git_remote_pushspec(_remote);
cl_assert(!strcmp(git_refspec_src(_refspec), "refs/*")); cl_assert_strequal(git_refspec_src(_refspec), "refs/*");
cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/*")); cl_assert_strequal(git_refspec_dst(_refspec), "refs/*");
} }
void test_network_remotes__save(void) void test_network_remotes__save(void)
...@@ -90,13 +90,13 @@ void test_network_remotes__save(void) ...@@ -90,13 +90,13 @@ void test_network_remotes__save(void)
_refspec = git_remote_fetchspec(_remote); _refspec = git_remote_fetchspec(_remote);
cl_assert(_refspec != NULL); cl_assert(_refspec != NULL);
cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*")); cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/upstream/*")); cl_assert_strequal(git_refspec_dst(_refspec), "refs/remotes/upstream/*");
_refspec = git_remote_pushspec(_remote); _refspec = git_remote_pushspec(_remote);
cl_assert(_refspec != NULL); cl_assert(_refspec != NULL);
cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*")); cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/heads/*")); cl_assert_strequal(git_refspec_dst(_refspec), "refs/heads/*");
} }
void test_network_remotes__fnmatch(void) void test_network_remotes__fnmatch(void)
...@@ -111,7 +111,7 @@ void test_network_remotes__transform(void) ...@@ -111,7 +111,7 @@ void test_network_remotes__transform(void)
memset(ref, 0x0, sizeof(ref)); memset(ref, 0x0, sizeof(ref));
cl_git_pass(git_refspec_transform(ref, sizeof(ref), _refspec, "refs/heads/master")); cl_git_pass(git_refspec_transform(ref, sizeof(ref), _refspec, "refs/heads/master"));
cl_assert(!strcmp(ref, "refs/remotes/test/master")); cl_assert_strequal(ref, "refs/remotes/test/master");
} }
void test_network_remotes__transform_r(void) void test_network_remotes__transform_r(void)
...@@ -119,7 +119,7 @@ void test_network_remotes__transform_r(void) ...@@ -119,7 +119,7 @@ void test_network_remotes__transform_r(void)
git_buf buf = GIT_BUF_INIT; git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_refspec_transform_r(&buf, _refspec, "refs/heads/master")); cl_git_pass(git_refspec_transform_r(&buf, _refspec, "refs/heads/master"));
cl_assert(!strcmp(git_buf_cstr(&buf), "refs/remotes/test/master")); cl_assert_strequal(git_buf_cstr(&buf), "refs/remotes/test/master");
git_buf_free(&buf); git_buf_free(&buf);
} }
......
...@@ -33,11 +33,11 @@ void test_notes_notes__1(void) ...@@ -33,11 +33,11 @@ void test_notes_notes__1(void)
cl_git_pass(git_note_read(&_note, _repo, NULL, &oid)); cl_git_pass(git_note_read(&_note, _repo, NULL, &oid));
cl_assert(!strcmp(git_note_message(_note), "hello world\n")); cl_assert_strequal(git_note_message(_note), "hello world\n");
cl_assert(!git_oid_cmp(git_note_oid(_note), &note_oid)); cl_assert(!git_oid_cmp(git_note_oid(_note), &note_oid));
cl_git_pass(git_blob_lookup(&_blob, _repo, &note_oid)); cl_git_pass(git_blob_lookup(&_blob, _repo, &note_oid));
cl_assert(!strcmp(git_note_message(_note), git_blob_rawcontent(_blob))); cl_assert_strequal(git_note_message(_note), git_blob_rawcontent(_blob));
cl_git_fail(git_note_create(&note_oid, _repo, _sig, _sig, NULL, &oid, "hello world\n")); cl_git_fail(git_note_create(&note_oid, _repo, _sig, _sig, NULL, &oid, "hello world\n"));
cl_git_fail(git_note_create(&note_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &oid, "hello world\n")); cl_git_fail(git_note_create(&note_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &oid, "hello world\n"));
......
...@@ -87,7 +87,7 @@ void test_object_raw_compare__compare_fmt_oids(void) ...@@ -87,7 +87,7 @@ void test_object_raw_compare__compare_fmt_oids(void)
/* Format produced the right result */ /* Format produced the right result */
out[GIT_OID_HEXSZ] = '\0'; out[GIT_OID_HEXSZ] = '\0';
cl_assert(strcmp(exp, out) == 0); cl_assert_strequal(exp, out);
} }
void test_object_raw_compare__compare_allocfmt_oids(void) void test_object_raw_compare__compare_allocfmt_oids(void)
...@@ -100,7 +100,7 @@ void test_object_raw_compare__compare_allocfmt_oids(void) ...@@ -100,7 +100,7 @@ void test_object_raw_compare__compare_allocfmt_oids(void)
out = git_oid_allocfmt(&in); out = git_oid_allocfmt(&in);
cl_assert(out); cl_assert(out);
cl_assert(strcmp(exp, out) == 0); cl_assert_strequal(exp, out);
git__free(out); git__free(out);
} }
...@@ -120,5 +120,5 @@ void test_object_raw_compare__compare_pathfmt_oids(void) ...@@ -120,5 +120,5 @@ void test_object_raw_compare__compare_pathfmt_oids(void)
/* Format produced the right result */ /* Format produced the right result */
out[GIT_OID_HEXSZ + 1] = '\0'; out[GIT_OID_HEXSZ + 1] = '\0';
cl_assert(strcmp(exp2, out) == 0); cl_assert_strequal(exp2, out);
} }
...@@ -45,7 +45,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void) ...@@ -45,7 +45,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
/* returns out as hex formatted c-string */ /* returns out as hex formatted c-string */
str = git_oid_tostr(out, sizeof(out), &in); str = git_oid_tostr(out, sizeof(out), &in);
cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0'); cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
cl_assert(strcmp(exp, out) == 0); cl_assert_strequal(exp, out);
} }
void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void) void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
...@@ -66,7 +66,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void) ...@@ -66,7 +66,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
/* returns big as hex formatted c-string */ /* returns big as hex formatted c-string */
str = git_oid_tostr(big, sizeof(big), &in); str = git_oid_tostr(big, sizeof(big), &in);
cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0'); cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
cl_assert(strcmp(exp, big) == 0); cl_assert_strequal(exp, big);
/* check tail material is untouched */ /* check tail material is untouched */
cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X'); cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
......
...@@ -6,19 +6,19 @@ ...@@ -6,19 +6,19 @@
void test_object_raw_type2string__convert_type_to_string(void) void test_object_raw_type2string__convert_type_to_string(void)
{ {
cl_assert(!strcmp(git_object_type2string(GIT_OBJ_BAD), "")); cl_assert_strequal(git_object_type2string(GIT_OBJ_BAD), "");
cl_assert(!strcmp(git_object_type2string(GIT_OBJ__EXT1), "")); cl_assert_strequal(git_object_type2string(GIT_OBJ__EXT1), "");
cl_assert(!strcmp(git_object_type2string(GIT_OBJ_COMMIT), "commit")); cl_assert_strequal(git_object_type2string(GIT_OBJ_COMMIT), "commit");
cl_assert(!strcmp(git_object_type2string(GIT_OBJ_TREE), "tree")); cl_assert_strequal(git_object_type2string(GIT_OBJ_TREE), "tree");
cl_assert(!strcmp(git_object_type2string(GIT_OBJ_BLOB), "blob")); cl_assert_strequal(git_object_type2string(GIT_OBJ_BLOB), "blob");
cl_assert(!strcmp(git_object_type2string(GIT_OBJ_TAG), "tag")); cl_assert_strequal(git_object_type2string(GIT_OBJ_TAG), "tag");
cl_assert(!strcmp(git_object_type2string(GIT_OBJ__EXT2), "")); cl_assert_strequal(git_object_type2string(GIT_OBJ__EXT2), "");
cl_assert(!strcmp(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA")); cl_assert_strequal(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA");
cl_assert(!strcmp(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA")); cl_assert_strequal(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA");
cl_assert(!strcmp(git_object_type2string(-2), "")); cl_assert_strequal(git_object_type2string(-2), "");
cl_assert(!strcmp(git_object_type2string(8), "")); cl_assert_strequal(git_object_type2string(8), "");
cl_assert(!strcmp(git_object_type2string(1234), "")); cl_assert_strequal(git_object_type2string(1234), "");
} }
void test_object_raw_type2string__convert_string_to_type(void) void test_object_raw_type2string__convert_string_to_type(void)
......
...@@ -54,7 +54,7 @@ void test_object_tag_read__parse(void) ...@@ -54,7 +54,7 @@ void test_object_tag_read__parse(void)
cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1)); cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1));
cl_assert(strcmp(git_tag_name(tag1), "test") == 0); cl_assert_strequal(git_tag_name(tag1), "test");
cl_assert(git_tag_type(tag1) == GIT_OBJ_TAG); cl_assert(git_tag_type(tag1) == GIT_OBJ_TAG);
cl_git_pass(git_tag_target((git_object **)&tag2, tag1)); cl_git_pass(git_tag_target((git_object **)&tag2, tag1));
...@@ -113,7 +113,7 @@ void test_object_tag_read__parse_without_tagger(void) ...@@ -113,7 +113,7 @@ void test_object_tag_read__parse_without_tagger(void)
cl_git_pass(git_tag_lookup(&bad_tag, bad_tag_repo, &id)); cl_git_pass(git_tag_lookup(&bad_tag, bad_tag_repo, &id));
cl_assert(bad_tag != NULL); cl_assert(bad_tag != NULL);
cl_assert(strcmp(git_tag_name(bad_tag), "e90810b") == 0); cl_assert_strequal(git_tag_name(bad_tag), "e90810b");
cl_assert(git_oid_cmp(&id, git_tag_id(bad_tag)) == 0); cl_assert(git_oid_cmp(&id, git_tag_id(bad_tag)) == 0);
cl_assert(bad_tag->tagger == NULL); cl_assert(bad_tag->tagger == NULL);
......
...@@ -103,12 +103,12 @@ void test_object_tag_write__basic(void) ...@@ -103,12 +103,12 @@ void test_object_tag_write__basic(void)
/* Check attributes were set correctly */ /* Check attributes were set correctly */
tagger1 = git_tag_tagger(tag); tagger1 = git_tag_tagger(tag);
cl_assert(tagger1 != NULL); cl_assert(tagger1 != NULL);
cl_assert(strcmp(tagger1->name, tagger_name) == 0); cl_assert_strequal(tagger1->name, tagger_name);
cl_assert(strcmp(tagger1->email, tagger_email) == 0); cl_assert_strequal(tagger1->email, tagger_email);
cl_assert(tagger1->when.time == 123456789); cl_assert(tagger1->when.time == 123456789);
cl_assert(tagger1->when.offset == 60); cl_assert(tagger1->when.offset == 60);
cl_assert(strcmp(git_tag_message(tag), tagger_message) == 0); cl_assert_strequal(git_tag_message(tag), tagger_message);
cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/the-tag")); cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/the-tag"));
cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0); cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
......
...@@ -18,7 +18,7 @@ static void diff_cmp(const git_tree_diff_data *a, const git_tree_diff_data *b) ...@@ -18,7 +18,7 @@ static void diff_cmp(const git_tree_diff_data *a, const git_tree_diff_data *b)
cl_assert(a->status - b->status == 0); cl_assert(a->status - b->status == 0);
cl_assert(strcmp(a->path, b->path) == 0); cl_assert_strequal(a->path, b->path);
} }
static int diff_cb(const git_tree_diff_data *diff, void *data) static int diff_cb(const git_tree_diff_data *diff, void *data)
......
...@@ -65,7 +65,7 @@ void test_object_tree_read__two(void) ...@@ -65,7 +65,7 @@ void test_object_tree_read__two(void)
entry = git_tree_entry_byname(tree, "README"); entry = git_tree_entry_byname(tree, "README");
cl_assert(entry != NULL); cl_assert(entry != NULL);
cl_assert(strcmp(git_tree_entry_name(entry), "README") == 0); cl_assert_strequal(git_tree_entry_name(entry), "README");
cl_git_pass(git_tree_entry_2object(&obj, g_repo, entry)); cl_git_pass(git_tree_entry_2object(&obj, g_repo, entry));
cl_assert(obj != NULL); cl_assert(obj != NULL);
......
...@@ -46,7 +46,7 @@ void test_ref_create__symbolic(void) ...@@ -46,7 +46,7 @@ void test_ref_create__symbolic(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC); cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(looked_up_ref) == 0); cl_assert(git_reference_is_packed(looked_up_ref) == 0);
cl_assert(strcmp(looked_up_ref->name, new_head_tracker) == 0); cl_assert_strequal(looked_up_ref->name, new_head_tracker);
/* ...peeled.. */ /* ...peeled.. */
cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref)); cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
...@@ -116,7 +116,7 @@ void test_ref_create__oid(void) ...@@ -116,7 +116,7 @@ void test_ref_create__oid(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_OID); cl_assert(git_reference_type(looked_up_ref) & GIT_REF_OID);
cl_assert(git_reference_is_packed(looked_up_ref) == 0); cl_assert(git_reference_is_packed(looked_up_ref) == 0);
cl_assert(strcmp(looked_up_ref->name, new_head) == 0); cl_assert_strequal(looked_up_ref->name, new_head);
/* ...and that it points to the current master tip */ /* ...and that it points to the current master tip */
cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0); cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
......
...@@ -38,7 +38,7 @@ void test_ref_overwrite__symbolic(void) ...@@ -38,7 +38,7 @@ void test_ref_overwrite__symbolic(void)
/* Ensure it points to the right place*/ /* Ensure it points to the right place*/
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name)); cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC); cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
cl_assert(!strcmp(git_reference_target(ref), ref_branch_name)); cl_assert_strequal(git_reference_target(ref), ref_branch_name);
git_reference_free(ref); git_reference_free(ref);
/* Ensure we can't create it unless we force it to */ /* Ensure we can't create it unless we force it to */
...@@ -49,7 +49,7 @@ void test_ref_overwrite__symbolic(void) ...@@ -49,7 +49,7 @@ void test_ref_overwrite__symbolic(void)
/* Ensure it points to the right place */ /* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name)); cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC); cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
cl_assert(!strcmp(git_reference_target(ref), ref_master_name)); cl_assert_strequal(git_reference_target(ref), ref_master_name);
git_reference_free(ref); git_reference_free(ref);
git_reference_free(branch_ref); git_reference_free(branch_ref);
...@@ -107,7 +107,7 @@ void test_ref_overwrite__object_id_with_symbolic(void) ...@@ -107,7 +107,7 @@ void test_ref_overwrite__object_id_with_symbolic(void)
/* Ensure it points to the right place */ /* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name)); cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC); cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
cl_assert(!strcmp(git_reference_target(ref), ref_master_name)); cl_assert_strequal(git_reference_target(ref), ref_master_name);
git_reference_free(ref); git_reference_free(ref);
} }
......
...@@ -43,7 +43,7 @@ void test_ref_pack__loose(void) ...@@ -43,7 +43,7 @@ void test_ref_pack__loose(void)
/* Ensure a known loose ref can be looked up */ /* Ensure a known loose ref can be looked up */
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name)); cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_is_packed(reference) == 0); cl_assert(git_reference_is_packed(reference) == 0);
cl_assert(strcmp(reference->name, loose_tag_ref_name) == 0); cl_assert_strequal(reference->name, loose_tag_ref_name);
git_reference_free(reference); git_reference_free(reference);
/* /*
...@@ -60,7 +60,7 @@ void test_ref_pack__loose(void) ...@@ -60,7 +60,7 @@ void test_ref_pack__loose(void)
/* Ensure the known ref can still be looked up but is now packed */ /* Ensure the known ref can still be looked up but is now packed */
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name)); cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_is_packed(reference)); cl_assert(git_reference_is_packed(reference));
cl_assert(strcmp(reference->name, loose_tag_ref_name) == 0); cl_assert_strequal(reference->name, loose_tag_ref_name);
/* Ensure the known ref has been removed from the loose folder structure */ /* Ensure the known ref has been removed from the loose folder structure */
cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, loose_tag_ref_name)); cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, loose_tag_ref_name));
......
...@@ -39,7 +39,7 @@ void test_ref_read__loose_tag(void) ...@@ -39,7 +39,7 @@ void test_ref_read__loose_tag(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name)); cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID); cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference) == 0); cl_assert(git_reference_is_packed(reference) == 0);
cl_assert(strcmp(reference->name, loose_tag_ref_name) == 0); cl_assert_strequal(reference->name, loose_tag_ref_name);
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY)); cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
cl_assert(object != NULL); cl_assert(object != NULL);
...@@ -47,7 +47,7 @@ void test_ref_read__loose_tag(void) ...@@ -47,7 +47,7 @@ void test_ref_read__loose_tag(void)
/* Ensure the name of the tag matches the name of the reference */ /* Ensure the name of the tag matches the name of the reference */
cl_git_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object))); cl_git_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object)));
cl_assert(strcmp(ref_name_from_tag_name.ptr, loose_tag_ref_name) == 0); cl_assert_strequal(ref_name_from_tag_name.ptr, loose_tag_ref_name);
git_buf_free(&ref_name_from_tag_name); git_buf_free(&ref_name_from_tag_name);
git_object_free(object); git_object_free(object);
...@@ -76,7 +76,7 @@ void test_ref_read__symbolic(void) ...@@ -76,7 +76,7 @@ void test_ref_read__symbolic(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE)); cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC); cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(reference) == 0); cl_assert(git_reference_is_packed(reference) == 0);
cl_assert(strcmp(reference->name, GIT_HEAD_FILE) == 0); cl_assert_strequal(reference->name, GIT_HEAD_FILE);
cl_git_pass(git_reference_resolve(&resolved_ref, reference)); cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
...@@ -104,7 +104,7 @@ void test_ref_read__nested_symbolic(void) ...@@ -104,7 +104,7 @@ void test_ref_read__nested_symbolic(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name)); cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC); cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(reference) == 0); cl_assert(git_reference_is_packed(reference) == 0);
cl_assert(strcmp(reference->name, head_tracker_sym_ref_name) == 0); cl_assert_strequal(reference->name, head_tracker_sym_ref_name);
cl_git_pass(git_reference_resolve(&resolved_ref, reference)); cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
...@@ -172,7 +172,7 @@ void test_ref_read__packed(void) ...@@ -172,7 +172,7 @@ void test_ref_read__packed(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name)); cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID); cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference)); cl_assert(git_reference_is_packed(reference));
cl_assert(strcmp(reference->name, packed_head_name) == 0); cl_assert_strequal(reference->name, packed_head_name);
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY)); cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
cl_assert(object != NULL); cl_assert(object != NULL);
...@@ -193,7 +193,7 @@ void test_ref_read__loose_first(void) ...@@ -193,7 +193,7 @@ void test_ref_read__loose_first(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_test_head_name)); cl_git_pass(git_reference_lookup(&reference, g_repo, packed_test_head_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID); cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference) == 0); cl_assert(git_reference_is_packed(reference) == 0);
cl_assert(strcmp(reference->name, packed_test_head_name) == 0); cl_assert_strequal(reference->name, packed_test_head_name);
git_reference_free(reference); git_reference_free(reference);
} }
...@@ -16,8 +16,8 @@ static git_repository *g_repo; ...@@ -16,8 +16,8 @@ static git_repository *g_repo;
static void assert_signature(git_signature *expected, git_signature *actual) static void assert_signature(git_signature *expected, git_signature *actual)
{ {
cl_assert(actual); cl_assert(actual);
cl_assert(0 == strcmp(expected->name, actual->name)); cl_assert_strequal(expected->name, actual->name);
cl_assert(0 == strcmp(expected->email, actual->email)); cl_assert_strequal(expected->email, actual->email);
cl_assert(expected->when.offset == actual->when.offset); cl_assert(expected->when.offset == actual->when.offset);
cl_assert(expected->when.time == actual->when.time); cl_assert(expected->when.time == actual->when.time);
} }
...@@ -73,18 +73,18 @@ void test_refs_reflog__write_then_read(void) ...@@ -73,18 +73,18 @@ void test_refs_reflog__write_then_read(void)
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 0); entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 0);
assert_signature(committer, entry->committer); assert_signature(committer, entry->committer);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old); git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
cl_assert(strcmp("0000000000000000000000000000000000000000", oid_str) == 0); cl_assert_strequal("0000000000000000000000000000000000000000", oid_str);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur); git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
cl_assert(strcmp(current_master_tip, oid_str) == 0); cl_assert_strequal(current_master_tip, oid_str);
cl_assert(entry->msg == NULL); cl_assert(entry->msg == NULL);
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 1); entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 1);
assert_signature(committer, entry->committer); assert_signature(committer, entry->committer);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old); git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
cl_assert(strcmp(current_master_tip, oid_str) == 0); cl_assert_strequal(current_master_tip, oid_str);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur); git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
cl_assert(strcmp(current_master_tip, oid_str) == 0); cl_assert_strequal(current_master_tip, oid_str);
cl_assert(strcmp(commit_msg, entry->msg) == 0); cl_assert_strequal(commit_msg, entry->msg);
git_signature_free(committer); git_signature_free(committer);
git_reflog_free(reflog); git_reflog_free(reflog);
......
...@@ -48,14 +48,14 @@ void test_refs_rename__loose(void) ...@@ -48,14 +48,14 @@ void test_refs_rename__loose(void)
/* Now that the reference is renamed... */ /* Now that the reference is renamed... */
cl_git_pass(git_reference_rename(looked_up_ref, new_name, 0)); cl_git_pass(git_reference_rename(looked_up_ref, new_name, 0));
cl_assert(!strcmp(looked_up_ref->name, new_name)); cl_assert_strequal(looked_up_ref->name, new_name);
/* ...It can't be looked-up with the old name... */ /* ...It can't be looked-up with the old name... */
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, loose_tag_ref_name)); cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, loose_tag_ref_name));
/* ...but the new name works ok... */ /* ...but the new name works ok... */
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, new_name)); cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, new_name));
cl_assert(!strcmp(another_looked_up_ref->name, new_name)); cl_assert_strequal(another_looked_up_ref->name, new_name);
/* .. the ref is still loose... */ /* .. the ref is still loose... */
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0); cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
...@@ -89,14 +89,14 @@ void test_refs_rename__packed(void) ...@@ -89,14 +89,14 @@ void test_refs_rename__packed(void)
/* Now that the reference is renamed... */ /* Now that the reference is renamed... */
cl_git_pass(git_reference_rename(looked_up_ref, brand_new_name, 0)); cl_git_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
cl_assert(!strcmp(looked_up_ref->name, brand_new_name)); cl_assert_strequal(looked_up_ref->name, brand_new_name);
/* ...It can't be looked-up with the old name... */ /* ...It can't be looked-up with the old name... */
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_head_name)); cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_head_name));
/* ...but the new name works ok... */ /* ...but the new name works ok... */
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, brand_new_name)); cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, brand_new_name));
cl_assert(!strcmp(another_looked_up_ref->name, brand_new_name)); cl_assert_strequal(another_looked_up_ref->name, brand_new_name);
/* .. the ref is no longer packed... */ /* .. the ref is no longer packed... */
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0); cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
...@@ -166,7 +166,7 @@ void test_refs_rename__name_collision(void) ...@@ -166,7 +166,7 @@ void test_refs_rename__name_collision(void)
/* Failure to rename it hasn't corrupted its state */ /* Failure to rename it hasn't corrupted its state */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
cl_assert(!strcmp(looked_up_ref->name, packed_head_name)); cl_assert_strequal(looked_up_ref->name, packed_head_name);
git_reference_free(looked_up_ref); git_reference_free(looked_up_ref);
} }
...@@ -188,7 +188,7 @@ void test_refs_rename__invalid_name(void) ...@@ -188,7 +188,7 @@ void test_refs_rename__invalid_name(void)
/* Failure to rename it hasn't corrupted its state */ /* Failure to rename it hasn't corrupted its state */
git_reference_free(looked_up_ref); git_reference_free(looked_up_ref);
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
cl_assert(!strcmp(looked_up_ref->name, packed_test_head_name)); cl_assert_strequal(looked_up_ref->name, packed_test_head_name);
git_reference_free(looked_up_ref); git_reference_free(looked_up_ref);
} }
...@@ -209,7 +209,7 @@ void test_refs_rename__force_loose_packed(void) ...@@ -209,7 +209,7 @@ void test_refs_rename__force_loose_packed(void)
/* Check we actually renamed it */ /* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
cl_assert(!strcmp(looked_up_ref->name, packed_test_head_name)); cl_assert_strequal(looked_up_ref->name, packed_test_head_name);
cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref))); cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
git_reference_free(looked_up_ref); git_reference_free(looked_up_ref);
...@@ -233,7 +233,7 @@ void test_refs_rename__force_loose(void) ...@@ -233,7 +233,7 @@ void test_refs_rename__force_loose(void)
/* Check we actually renamed it */ /* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test")); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test"));
cl_assert(!strcmp(looked_up_ref->name, "refs/heads/test")); cl_assert_strequal(looked_up_ref->name, "refs/heads/test");
cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref))); cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
git_reference_free(looked_up_ref); git_reference_free(looked_up_ref);
...@@ -298,7 +298,7 @@ void test_refs_rename__prefix(void) ...@@ -298,7 +298,7 @@ void test_refs_rename__prefix(void)
/* Check we actually renamed it */ /* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
cl_assert(!strcmp(looked_up_ref->name, ref_two_name_new)); cl_assert_strequal(looked_up_ref->name, ref_two_name_new);
git_reference_free(looked_up_ref); git_reference_free(looked_up_ref);
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name)); cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
...@@ -331,7 +331,7 @@ void test_refs_rename__move_up(void) ...@@ -331,7 +331,7 @@ void test_refs_rename__move_up(void)
/* Check we actually renamed it */ /* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
cl_assert(!strcmp(looked_up_ref->name, ref_two_name)); cl_assert_strequal(looked_up_ref->name, ref_two_name);
git_reference_free(looked_up_ref); git_reference_free(looked_up_ref);
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new)); cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
git_reference_free(ref); git_reference_free(ref);
......
...@@ -28,7 +28,7 @@ static void ensure_repository_discover(const char *start_path, const char *ceili ...@@ -28,7 +28,7 @@ static void ensure_repository_discover(const char *start_path, const char *ceili
char found_path[GIT_PATH_MAX]; char found_path[GIT_PATH_MAX];
cl_git_pass(git_repository_discover(found_path, sizeof(found_path), start_path, 0, ceiling_dirs)); cl_git_pass(git_repository_discover(found_path, sizeof(found_path), start_path, 0, ceiling_dirs));
//across_fs is always 0 as we can't automate the filesystem change tests //across_fs is always 0 as we can't automate the filesystem change tests
cl_assert(0 == strcmp(found_path, expected_path)); cl_assert_strequal(found_path, expected_path);
} }
static void write_file(const char *path, const char *content) static void write_file(const char *path, const char *content)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment