本文整理汇总了C++中cl_assert_equal_s函数的典型用法代码示例。如果您正苦于以下问题:C++ cl_assert_equal_s函数的具体用法?C++ cl_assert_equal_s怎么用?C++ cl_assert_equal_s使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cl_assert_equal_s函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_refs_branches_delete__can_not_delete_a_branch_pointed_at_by_HEAD
void test_refs_branches_delete__can_not_delete_a_branch_pointed_at_by_HEAD(void)
{
git_reference *head;
git_reference *branch;
/* Ensure HEAD targets the local master branch */
cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
git_reference_free(head);
cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL));
cl_git_fail(git_branch_delete(branch));
git_reference_free(branch);
}
示例2: test_diff_stats__numstat
void test_diff_stats__numstat(void)
{
git_buf buf = GIT_BUF_INIT;
const char *stat =
"3 2 file2.txt\n"
"4 2 file3.txt\n";
diff_stats_from_commit_oid(
&_stats, "cd471f0d8770371e1bc78bcbb38db4c7e4106bd2", false);
cl_git_pass(git_diff_stats_to_buf(&buf, _stats, GIT_DIFF_STATS_NUMBER, 0));
cl_assert_equal_s(stat, git_buf_cstr(&buf));
git_buf_free(&buf);
}
示例3: test_refs_branches_move__moving_the_branch_pointed_at_by_HEAD_updates_HEAD
void test_refs_branches_move__moving_the_branch_pointed_at_by_HEAD_updates_HEAD(void)
{
git_reference *branch;
git_reference *new_branch;
cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0));
git_reference_free(branch);
git_reference_free(new_branch);
cl_git_pass(git_repository_head(&branch, repo));
cl_assert_equal_s("refs/heads/master2", git_reference_name(branch));
git_reference_free(branch);
}
示例4: test_odb_backend_nobackend__write_fails_gracefully
void test_odb_backend_nobackend__write_fails_gracefully(void)
{
git_oid id;
git_odb *odb;
const git_error *err;
git_repository_odb(&odb, _repo);
cl_git_fail(git_odb_write(&id, odb, "Hello world!\n", 13, GIT_OBJ_BLOB));
err = giterr_last();
cl_assert_equal_s(err->message, "cannot write object - unsupported in the loaded odb backends");
git_odb_free(odb);
}
示例5: test_repo_init__can_reinit_an_initialized_repository
void test_repo_init__can_reinit_an_initialized_repository(void)
{
git_repository *reinit;
cl_git_pass(git_futils_mkdir("extended", NULL, 0775, 0));
cl_git_pass(git_repository_init(&_repo, "extended", false));
cl_git_pass(git_repository_init(&reinit, "extended", false));
cl_assert_equal_s(git_repository_path(_repo), git_repository_path(reinit));
git_repository_free(reinit);
cleanup_repository("extended");
}
示例6: confirm_submodule_status
static int confirm_submodule_status(
const char *path, unsigned int status_flags, void *payload)
{
submodule_expectations *exp = payload;
while (git__suffixcmp(exp->paths[exp->counter], "/") == 0)
exp->counter++;
cl_assert_equal_s(exp->paths[exp->counter++], path);
GIT_UNUSED(status_flags);
return 0;
}
示例7: check_fromurl
static void check_fromurl(const char *expected_result, const char *input, int should_fail)
{
git_buf buf = GIT_BUF_INIT;
assert(should_fail || expected_result);
if (!should_fail) {
cl_git_pass(git_path_fromurl(&buf, input));
cl_assert_equal_s(expected_result, git_buf_cstr(&buf));
} else
cl_git_fail(git_path_fromurl(&buf, input));
git_buf_dispose(&buf);
}
示例8: test_refs_read__loose_first
void test_refs_read__loose_first(void)
{
// assure that a loose reference is looked up before a packed reference
git_reference *reference;
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
git_reference_free(reference);
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_is_packed(reference) == 0);
cl_assert_equal_s(reference->name, packed_test_head_name);
git_reference_free(reference);
}
示例9: test_rebase_merge__finish_with_ids
void test_rebase_merge__finish_with_ids(void)
{
git_rebase *rebase;
git_reference *head_ref;
git_oid branch_id, upstream_id;
git_annotated_commit *branch_head, *upstream_head;
git_rebase_operation *rebase_operation;
git_oid commit_id;
git_reflog *reflog;
const git_reflog_entry *reflog_entry;
int error;
cl_git_pass(git_oid_fromstr(&branch_id, "d616d97082eb7bb2dc6f180a7cca940993b7a56f"));
cl_git_pass(git_oid_fromstr(&upstream_id, "f87d14a4a236582a0278a916340a793714256864"));
cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id));
cl_git_pass(git_annotated_commit_lookup(&upstream_head, repo, &upstream_id));
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL));
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
cl_assert_equal_i(GIT_ITEROVER, error);
cl_git_pass(git_rebase_finish(rebase, signature));
cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
cl_git_pass(git_reference_lookup(&head_ref, repo, "HEAD"));
cl_assert_equal_i(GIT_REF_OID, git_reference_type(head_ref));
cl_assert_equal_oid(&commit_id, git_reference_target(head_ref));
/* reflogs are not updated as if we were operating on proper
* branches. check that the last reflog entry is the rebase.
*/
cl_git_pass(git_reflog_read(&reflog, repo, "HEAD"));
cl_assert(reflog_entry = git_reflog_entry_byindex(reflog, 0));
cl_assert_equal_oid(&commit_id, git_reflog_entry_id_new(reflog_entry));
cl_assert_equal_s("rebase: Modification 3 to gravy", git_reflog_entry_message(reflog_entry));
git_reflog_free(reflog);
git_annotated_commit_free(branch_head);
git_annotated_commit_free(upstream_head);
git_reference_free(head_ref);
git_rebase_free(rebase);
}
示例10: test_reset_hard__resetting_reverts_modified_files
void test_reset_hard__resetting_reverts_modified_files(void)
{
git_buf path = GIT_BUF_INIT, content = GIT_BUF_INIT;
int i;
static const char *files[4] = {
"current_file",
"modified_file",
"staged_new_file",
"staged_changes_modified_file"
};
static const char *before[4] = {
"current_file\n",
"modified_file\nmodified_file\n",
"staged_new_file\n",
"staged_changes_modified_file\nstaged_changes_modified_file\nstaged_changes_modified_file\n"
};
static const char *after[4] = {
"current_file\n",
"modified_file\n",
NULL,
"staged_changes_modified_file\n"
};
const char *wd = git_repository_workdir(repo);
cl_assert(wd);
for (i = 0; i < 4; ++i) {
cl_git_pass(git_buf_joinpath(&path, wd, files[i]));
cl_git_pass(git_futils_readbuffer(&content, path.ptr));
cl_assert_equal_s(before[i], content.ptr);
}
cl_git_pass(git_revparse_single(&target, repo, "26a125e"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL));
for (i = 0; i < 4; ++i) {
cl_git_pass(git_buf_joinpath(&path, wd, files[i]));
if (after[i]) {
cl_git_pass(git_futils_readbuffer(&content, path.ptr));
cl_assert(strequal_ignore_eol(after[i], content.ptr));
} else {
cl_assert(!git_path_exists(path.ptr));
}
}
git_buf_free(&content);
git_buf_free(&path);
}
示例11: index_iterator_test
static void index_iterator_test(
const char *sandbox,
const char *start,
const char *end,
git_iterator_flag_t flags,
int expected_count,
const char **expected_names,
const char **expected_oids)
{
git_index *index;
git_iterator *i;
const git_index_entry *entry;
int error, count = 0, caps;
git_repository *repo = cl_git_sandbox_init(sandbox);
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
cl_git_pass(git_repository_index(&index, repo));
caps = git_index_caps(index);
iter_opts.flags = flags;
iter_opts.start = start;
iter_opts.end = end;
cl_git_pass(git_iterator_for_index(&i, repo, index, &iter_opts));
while (!(error = git_iterator_advance(&entry, i))) {
cl_assert(entry);
if (expected_names != NULL)
cl_assert_equal_s(expected_names[count], entry->path);
if (expected_oids != NULL) {
git_oid oid;
cl_git_pass(git_oid_fromstr(&oid, expected_oids[count]));
cl_assert_equal_oid(&oid, &entry->id);
}
count++;
}
cl_assert_equal_i(GIT_ITEROVER, error);
cl_assert(!entry);
cl_assert_equal_i(expected_count, count);
git_iterator_free(i);
cl_assert(caps == git_index_caps(index));
git_index_free(index);
}
示例12: test_online_clone__empty_repository
void test_online_clone__empty_repository(void)
{
git_reference *head;
cl_git_pass(git_clone(&g_repo, LIVE_EMPTYREPO_URL, "./foo", &g_options));
cl_assert_equal_i(true, git_repository_is_empty(g_repo));
cl_assert_equal_i(true, git_repository_head_unborn(g_repo));
cl_git_pass(git_reference_lookup(&head, g_repo, GIT_HEAD_FILE));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
git_reference_free(head);
}
示例13: test_network_remote_remotes__pushurl
void test_network_remote_remotes__pushurl(void)
{
const char *name = git_remote_name(_remote);
git_remote *mod;
cl_git_pass(git_remote_set_pushurl(_repo, name, "git://github.com/libgit2/notlibgit2"));
cl_git_pass(git_remote_lookup(&mod, _repo, name));
cl_assert_equal_s(git_remote_pushurl(mod), "git://github.com/libgit2/notlibgit2");
git_remote_free(mod);
cl_git_pass(git_remote_set_pushurl(_repo, name, NULL));
cl_git_pass(git_remote_lookup(&mod, _repo, name));
cl_assert(git_remote_pushurl(mod) == NULL);
git_remote_free(mod);
}
示例14: test_object_shortid__select
void test_object_shortid__select(void)
{
git_oid full;
git_object *obj;
git_buf shorty = {0};
git_oid_fromstr(&full, "ce013625030ba8dba906f756967f9e9ca394464a");
cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY));
cl_git_pass(git_object_short_id(&shorty, obj));
cl_assert_equal_i(7, shorty.size);
cl_assert_equal_s("ce01362", shorty.ptr);
git_object_free(obj);
git_oid_fromstr(&full, "038d718da6a1ebbc6a7780a96ed75a70cc2ad6e2");
cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY));
cl_git_pass(git_object_short_id(&shorty, obj));
cl_assert_equal_i(7, shorty.size);
cl_assert_equal_s("038d718", shorty.ptr);
git_object_free(obj);
git_oid_fromstr(&full, "dea509d097ce692e167dfc6a48a7a280cc5e877e");
cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY));
cl_git_pass(git_object_short_id(&shorty, obj));
cl_assert_equal_i(9, shorty.size);
cl_assert_equal_s("dea509d09", shorty.ptr);
git_object_free(obj);
git_oid_fromstr(&full, "dea509d0b3cb8ee0650f6ca210bc83f4678851ba");
cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY));
cl_git_pass(git_object_short_id(&shorty, obj));
cl_assert_equal_i(9, shorty.size);
cl_assert_equal_s("dea509d0b", shorty.ptr);
git_object_free(obj);
git_buf_free(&shorty);
}
示例15: test_diff_stats__mode_change
void test_diff_stats__mode_change(void)
{
git_buf buf = GIT_BUF_INIT;
const char *stat =
" file1.txt.renamed | 0\n" \
" 1 file changed, 0 insertions(+), 0 deletions(-)\n" \
" mode change 100644 => 100755 file1.txt.renamed\n";
diff_stats_from_commit_oid(
&_stats, "7ade76dd34bba4733cf9878079f9fd4a456a9189", false);
cl_git_pass(git_diff_stats_to_buf(&buf, _stats, GIT_DIFF_STATS_FULL | GIT_DIFF_STATS_INCLUDE_SUMMARY, 0));
cl_assert_equal_s(stat, git_buf_cstr(&buf));
git_buf_free(&buf);
}