本文整理汇总了C++中cl_assert_equal_i函数的典型用法代码示例。如果您正苦于以下问题:C++ cl_assert_equal_i函数的具体用法?C++ cl_assert_equal_i怎么用?C++ cl_assert_equal_i使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cl_assert_equal_i函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD
void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD(void)
{
git_reference *head, *branch;
cl_git_pass(git_reference_lookup(&head, 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);
/* Detach HEAD and make it target the commit that "master" points to */
git_repository_detach_head(repo);
cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL));
cl_git_pass(git_branch_delete(branch));
git_reference_free(branch);
}
开发者ID:0CV0,项目名称:libgit2,代码行数:16,代码来源:delete.c
示例2: test_status_worktree__update_index_with_symlink_doesnt_change_mode
void test_status_worktree__update_index_with_symlink_doesnt_change_mode(void)
{
git_repository *repo = cl_git_sandbox_init("testrepo");
git_reference *head;
git_object *head_object;
git_index *index;
const git_index_entry *idx_entry;
git_status_options opts = GIT_STATUS_OPTIONS_INIT;
status_entry_counts counts = {0};
const char *expected_paths[] = { "README" };
const unsigned int expected_statuses[] = {GIT_STATUS_WT_NEW};
opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
opts.flags = GIT_STATUS_OPT_DEFAULTS | GIT_STATUS_OPT_UPDATE_INDEX;
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL));
cl_git_rewritefile("testrepo/README", "This was rewritten.");
/* this status rewrites the index because we have changed the
* contents of a tracked file
*/
counts.expected_entry_count = 1;
counts.expected_paths = expected_paths;
counts.expected_statuses = expected_statuses;
cl_git_pass(
git_status_foreach_ext(repo, &opts, cb_status__normal, &counts));
cl_assert_equal_i(1, counts.entry_count);
/* now ensure that the status's rewrite of the index did not screw
* up the mode of the symlink `link_to_new.txt`, particularly
* on platforms that don't support symlinks
*/
cl_git_pass(git_repository_index(&index, repo));
cl_git_pass(git_index_read(index, true));
cl_assert(idx_entry = git_index_get_bypath(index, "link_to_new.txt", 0));
cl_assert(S_ISLNK(idx_entry->mode));
git_index_free(index);
git_object_free(head_object);
git_reference_free(head);
}
开发者ID:azyx3,项目名称:libgit2,代码行数:47,代码来源:worktree.c
示例3: test_config_read__read_git_config_entry
void test_config_read__read_git_config_entry(void)
{
git_config *cfg;
git_config_entry *entry;
cl_git_pass(git_config_new(&cfg));
cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"),
GIT_CONFIG_LEVEL_SYSTEM, NULL, 0));
cl_git_pass(git_config_get_entry(&entry, cfg, "core.dummy2"));
cl_assert_equal_s("core.dummy2", entry->name);
cl_assert_equal_s("42", entry->value);
cl_assert_equal_i(GIT_CONFIG_LEVEL_SYSTEM, entry->level);
git_config_entry_free(entry);
git_config_free(cfg);
}
开发者ID:CodeSmithyIDE,项目名称:libgit2,代码行数:17,代码来源:read.c
示例4: test_index_filemodes__read
void test_index_filemodes__read(void)
{
git_index *index;
unsigned int i;
static bool expected[6] = { 0, 1, 0, 1, 0, 1 };
cl_git_pass(git_repository_index(&index, g_repo));
cl_assert_equal_i(6, (int)git_index_entrycount(index));
for (i = 0; i < 6; ++i) {
const git_index_entry *entry = git_index_get_byindex(index, i);
cl_assert(entry != NULL);
cl_assert(((entry->mode & 0100) ? 1 : 0) == expected[i]);
}
git_index_free(index);
}
开发者ID:ANNAVARAMVENKATESH,项目名称:libgit2,代码行数:17,代码来源:filemodes.c
示例5: test_status_worktree__line_endings_dont_count_as_changes_with_autocrlf
void test_status_worktree__line_endings_dont_count_as_changes_with_autocrlf(void)
{
git_repository *repo = cl_git_sandbox_init("status");
unsigned int status;
cl_repo_set_bool(repo, "core.autocrlf", true);
cl_git_rewritefile("status/current_file", "current_file\r\n");
cl_git_pass(git_status_file(&status, repo, "current_file"));
/* stat data on file should no longer match stat cache, even though
* file diff will be empty because of line-ending conversion - matches
* the Git command-line behavior here.
*/
cl_assert_equal_i(GIT_STATUS_WT_MODIFIED, status);
}
开发者ID:azyx3,项目名称:libgit2,代码行数:17,代码来源:worktree.c
示例6: test_stash_apply__conflict_workdir_with_reinstate_index
void test_stash_apply__conflict_workdir_with_reinstate_index(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
opts.flags = GIT_STASH_APPLY_REINSTATE_INDEX;
cl_git_rewritefile("stash/what", "ciao\n");
cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_ENOTFOUND);
}
开发者ID:Angeldude,项目名称:sonic-pi,代码行数:17,代码来源:apply.c
示例7: test_object_blob_filter__unfiltered
void test_object_blob_filter__unfiltered(void)
{
int i;
git_blob *blob;
for (i = 0; i < CRLF_NUM_TEST_OBJECTS; i++) {
size_t raw_len = (size_t)g_crlf_raw_len[i];
cl_git_pass(git_blob_lookup(&blob, g_repo, &g_crlf_oids[i]));
cl_assert_equal_sz(raw_len, (size_t)git_blob_rawsize(blob));
cl_assert_equal_i(
0, memcmp(g_crlf_raw[i], git_blob_rawcontent(blob), raw_len));
git_blob_free(blob);
}
}
开发者ID:1336,项目名称:libgit2,代码行数:17,代码来源:filter.c
示例8: test_bsp__tree_can_clone
void test_bsp__tree_can_clone(void) {
bsp_node_t *cube_clone = clone_bsp_tree(cube_bsp);
cl_assert(cube_clone != NULL);
klist_t(poly) *clone_polys = bsp_to_polygons(cube_clone, 0, NULL);
klist_t(poly) *orig_polys = bsp_to_polygons(cube_bsp, 0, NULL);
cl_assert_equal_i(clone_polys->size, orig_polys->size);
kl_destroy(poly, clone_polys);
kl_destroy(poly, orig_polys);
cl_assert(clone_polys != orig_polys);
free_bsp_tree(cube_clone);
}
开发者ID:JennYung,项目名称:csgtool,代码行数:17,代码来源:bsp.c
示例9: test_revwalk_basic__push_head_hide_ref_nobase
void test_revwalk_basic__push_head_hide_ref_nobase(void)
{
int i = 0;
git_oid oid;
revwalk_basic_setup_walk(NULL);
cl_git_pass(git_revwalk_push_head(_walk));
cl_git_pass(git_revwalk_hide_ref(_walk, "refs/heads/packed"));
while (git_revwalk_next(&oid, _walk) == 0) {
i++;
}
/* git log HEAD --oneline --not refs/heads/packed | wc -l => 7 */
cl_assert_equal_i(i, 7);
}
开发者ID:Darthholi,项目名称:WDX_GitCommander,代码行数:17,代码来源:basic.c
示例10: test_stash_apply__merges_new_file
void test_stash_apply__merges_new_file(void)
{
const git_index_entry *ancestor, *our, *their;
cl_git_mkfile("stash/where", "committed before stash\n");
cl_git_pass(git_index_add_bypath(repo_index, "where"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Other commit");
cl_git_pass(git_stash_apply(repo, 0, NULL));
cl_assert_equal_i(1, git_index_has_conflicts(repo_index));
assert_status(repo, "what", GIT_STATUS_INDEX_MODIFIED);
cl_git_pass(git_index_conflict_get(&ancestor, &our, &their, repo_index, "where")); /* unmerged */
assert_status(repo, "who", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
}
开发者ID:Angeldude,项目名称:sonic-pi,代码行数:17,代码来源:apply.c
示例11: test_online_fetch__ls_disconnected
void test_online_fetch__ls_disconnected(void)
{
const git_remote_head **refs;
size_t refs_len_before, refs_len_after;
git_remote *remote;
cl_git_pass(git_remote_create(&remote, _repo, "test",
"http://github.com/libgit2/TestGitRepository.git"));
cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH));
cl_git_pass(git_remote_ls(&refs, &refs_len_before, remote));
git_remote_disconnect(remote);
cl_git_pass(git_remote_ls(&refs, &refs_len_after, remote));
cl_assert_equal_i(refs_len_before, refs_len_after);
git_remote_free(remote);
}
开发者ID:DaneTheory,项目名称:libgit2,代码行数:17,代码来源:fetch.c
示例12: test_checkout_conflict__report_progress
void test_checkout_conflict__report_progress(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
git_vector paths = GIT_VECTOR_INIT;
char *path;
size_t i;
struct checkout_index_entry checkout_index_entries[] = {
{ 0100644, CONFLICTING_ANCESTOR_OID, 1, "conflicting-1.txt" },
{ 0100644, CONFLICTING_OURS_OID, 2, "conflicting-1.txt" },
{ 0100644, CONFLICTING_THEIRS_OID, 3, "conflicting-1.txt" },
{ 0100644, CONFLICTING_ANCESTOR_OID, 1, "conflicting-2.txt" },
{ 0100644, CONFLICTING_OURS_OID, 2, "conflicting-2.txt" },
{ 0100644, CONFLICTING_THEIRS_OID, 3, "conflicting-2.txt" },
{ 0100644, AUTOMERGEABLE_ANCESTOR_OID, 1, "conflicting-3.txt" },
{ 0100644, AUTOMERGEABLE_OURS_OID, 2, "conflicting-3.txt" },
{ 0100644, AUTOMERGEABLE_THEIRS_OID, 3, "conflicting-3.txt" },
{ 0100644, AUTOMERGEABLE_ANCESTOR_OID, 1, "conflicting-4.txt" },
{ 0100644, AUTOMERGEABLE_OURS_OID, 2, "conflicting-4.txt" },
{ 0100644, AUTOMERGEABLE_THEIRS_OID, 3, "conflicting-4.txt" },
};
opts.progress_cb = collect_progress;
opts.progress_payload = &paths;
create_index(checkout_index_entries, 12);
git_index_write(g_index);
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
cl_assert_equal_i(4, git_vector_length(&paths));
cl_assert_equal_s("conflicting-1.txt", git_vector_get(&paths, 0));
cl_assert_equal_s("conflicting-2.txt", git_vector_get(&paths, 1));
cl_assert_equal_s("conflicting-3.txt", git_vector_get(&paths, 2));
cl_assert_equal_s("conflicting-4.txt", git_vector_get(&paths, 3));
git_vector_foreach(&paths, i, path)
git__free(path);
git_vector_free(&paths);
}
开发者ID:Angeldude,项目名称:sonic-pi,代码行数:45,代码来源:conflict.c
示例13: test_odb_largefiles__streamread
void test_odb_largefiles__streamread(void)
{
git_oid oid, read_oid;
git_odb_stream *stream;
char buf[10240];
char hdr[64];
size_t len, hdr_len, total = 0;
git_hash_ctx hash;
git_otype type;
int ret;
#ifndef GIT_ARCH_64
cl_skip();
#endif
if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE") ||
!cl_is_env_set("GITTEST_SLOW"))
cl_skip();
writefile(&oid);
cl_git_pass(git_odb_open_rstream(&stream, &len, &type, odb, &oid));
cl_assert_equal_sz(LARGEFILE_SIZE, len);
cl_assert_equal_i(GIT_OBJ_BLOB, type);
cl_git_pass(git_hash_ctx_init(&hash));
cl_git_pass(git_odb__format_object_header(&hdr_len, hdr, sizeof(hdr), len, type));
cl_git_pass(git_hash_update(&hash, hdr, hdr_len));
while ((ret = git_odb_stream_read(stream, buf, 10240)) > 0) {
cl_git_pass(git_hash_update(&hash, buf, ret));
total += ret;
}
cl_assert_equal_sz(LARGEFILE_SIZE, total);
git_hash_final(&read_oid, &hash);
cl_assert_equal_oid(&oid, &read_oid);
git_hash_ctx_cleanup(&hash);
git_odb_stream_free(stream);
}
开发者ID:csware,项目名称:libgit2,代码行数:45,代码来源:largefiles.c
示例14: test_diff_tree__larger_hunks
void test_diff_tree__larger_hunks(void)
{
const char *a_commit = "d70d245ed97ed2aa596dd1af6536e4bfdb047b69";
const char *b_commit = "7a9e0b02e63179929fed24f0a3e0f19168114d10";
size_t d, num_d, h, num_h, l, num_l;
git_patch *patch;
const git_diff_hunk *hunk;
const git_diff_line *line;
g_repo = cl_git_sandbox_init("diff");
cl_assert((a = resolve_commit_oid_to_tree(g_repo, a_commit)) != NULL);
cl_assert((b = resolve_commit_oid_to_tree(g_repo, b_commit)) != NULL);
opts.context_lines = 1;
opts.interhunk_lines = 0;
cl_git_pass(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts));
num_d = git_diff_num_deltas(diff);
for (d = 0; d < num_d; ++d) {
cl_git_pass(git_patch_from_diff(&patch, diff, d));
cl_assert(patch);
num_h = git_patch_num_hunks(patch);
for (h = 0; h < num_h; h++) {
cl_git_pass(git_patch_get_hunk(&hunk, &num_l, patch, h));
for (l = 0; l < num_l; ++l) {
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, h, l));
cl_assert(line);
}
cl_git_fail(git_patch_get_line_in_hunk(&line, patch, h, num_l));
}
cl_git_fail(git_patch_get_hunk(&hunk, &num_l, patch, num_h));
git_patch_free(patch);
}
cl_git_fail(git_patch_from_diff(&patch, diff, num_d));
cl_assert_equal_i(2, (int)num_d);
}
开发者ID:Angeldude,项目名称:sonic-pi,代码行数:45,代码来源:tree.c
示例15: test_object_blob_filter__stats
void test_object_blob_filter__stats(void)
{
int i;
git_blob *blob;
git_buf buf = GIT_BUF_INIT;
git_buf_text_stats stats;
for (i = 0; i < CRLF_NUM_TEST_OBJECTS; i++) {
cl_git_pass(git_blob_lookup(&blob, g_repo, &g_crlf_oids[i]));
cl_git_pass(git_blob__getbuf(&buf, blob));
git_buf_text_gather_stats(&stats, &buf, false);
cl_assert_equal_i(
0, memcmp(&g_crlf_filtered_stats[i], &stats, sizeof(stats)));
git_blob_free(blob);
}
git_buf_free(&buf);
}
开发者ID:1336,项目名称:libgit2,代码行数:18,代码来源:filter.c
示例16: test_win32_name
static void test_win32_name(const char *name)
{
git_reference *new_reference = NULL;
git_oid id;
int ret;
git_oid_fromstr(&id, current_master_tip);
ret = git_reference_create(&new_reference, g_repo, name, &id, 0, NULL);
#ifdef GIT_WIN32
cl_assert_equal_i(GIT_EINVALIDSPEC, ret);
#else
cl_git_pass(ret);
#endif
git_reference_free(new_reference);
}
开发者ID:YueLinHo,项目名称:libgit2,代码行数:18,代码来源:create.c
示例17: test_network_remote_rename__renamed_name_is_persisted
void test_network_remote_rename__renamed_name_is_persisted(void)
{
git_remote *renamed;
git_repository *another_repo;
git_strarray problems = {0};
cl_git_fail(git_remote_lookup(&renamed, _repo, "just/renamed"));
cl_git_pass(git_remote_rename(&problems, _repo, _remote_name, "just/renamed"));
cl_assert_equal_i(0, problems.count);
git_strarray_free(&problems);
cl_git_pass(git_repository_open(&another_repo, "testrepo.git"));
cl_git_pass(git_remote_lookup(&renamed, _repo, "just/renamed"));
git_remote_free(renamed);
git_repository_free(another_repo);
}
开发者ID:Darthholi,项目名称:WDX_GitCommander,代码行数:18,代码来源:rename.c
示例18: test_read_header
static void test_read_header(object_data *data)
{
git_oid id;
git_odb *odb;
size_t len;
git_object_t type;
write_object_files(data);
cl_git_pass(git_odb_open(&odb, "test-objects"));
cl_git_pass(git_oid_fromstr(&id, data->id));
cl_git_pass(git_odb_read_header(&len, &type, odb, &id));
cl_assert_equal_sz(data->dlen, len);
cl_assert_equal_i(git_object_string2type(data->type), type);
git_odb_free(odb);
}
开发者ID:CodeSmithyIDE,项目名称:libgit2,代码行数:18,代码来源:loose.c
示例19: ensure_workdir_mode
static void ensure_workdir_mode(const char *path, int mode)
{
#ifdef GIT_WIN32
GIT_UNUSED(path);
GIT_UNUSED(mode);
#else
git_buf fullpath = GIT_BUF_INIT;
struct stat st;
cl_git_pass(
git_buf_joinpath(&fullpath, git_repository_workdir(g_repo), path));
cl_git_pass(p_stat(git_buf_cstr(&fullpath), &st));
cl_assert_equal_i((mode & S_IRWXU), (st.st_mode & S_IRWXU));
git_buf_free(&fullpath);
#endif
}
开发者ID:Angeldude,项目名称:sonic-pi,代码行数:18,代码来源:conflict.c
示例20: test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND
void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
{
git_oid result, one, two;
size_t ahead, behind;
int error;
cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af"));
cl_git_pass(git_oid_fromstr(&two, "e90810b8df3e80c413d903f631643c716887138d"));
error = git_merge_base(&result, _repo, &one, &two);
cl_git_fail(error);
cl_assert_equal_i(GIT_ENOTFOUND, error);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
cl_assert_equal_sz(2, ahead);
cl_assert_equal_sz(4, behind);
}
开发者ID:ANNAVARAMVENKATESH,项目名称:libgit2,代码行数:18,代码来源:mergebase.c
注:本文中的cl_assert_equal_i函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论