这篇教程C++ will_return函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中will_return函数的典型用法代码示例。如果您正苦于以下问题:C++ will_return函数的具体用法?C++ will_return怎么用?C++ will_return使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了will_return函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cmd_account_show_message_for_invalid_otr_policyvoid cmd_account_show_message_for_invalid_otr_policy(void **state){ gchar *args[] = { "set", "a_account", "otr", "bad_otr_policy", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); expect_cons_show("OTR policy must be one of: manual, opportunistic or always."); gboolean result = cmd_account(NULL, CMD_ACCOUNT, args); assert_true(result);}
开发者ID:0xPoly,项目名称:profanity,代码行数:12,
示例2: cmd_account_set_eval_password_sets_eval_passwordvoid cmd_account_set_eval_password_sets_eval_password(void **state){ gchar *args[] = { "set", "a_account", "eval_password", "a_password", NULL }; ProfAccount *account = account_new("a_account", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); expect_string(accounts_get_account, name, "a_account"); will_return(accounts_get_account, account); expect_string(accounts_set_eval_password, account_name, "a_account"); expect_string(accounts_set_eval_password, value, "a_password"); expect_cons_show("Updated eval_password for account a_account"); expect_cons_show(""); gboolean result = cmd_account(NULL, CMD_ACCOUNT, args); assert_true(result);}
开发者ID:0xPoly,项目名称:profanity,代码行数:21,
示例3: cmd_account_set_jid_shows_message_for_malformed_jidvoid cmd_account_set_jid_shows_message_for_malformed_jid(void **state){ gchar *args[] = { "set", "a_account", "jid", "@malformed", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); expect_cons_show("Malformed jid: @malformed"); gboolean result = cmd_account(NULL, CMD_ACCOUNT, args); assert_true(result);}
开发者ID:0xPoly,项目名称:profanity,代码行数:12,
示例4: test_read_pid_fail_if_access_failstatic voidtest_read_pid_fail_if_access_fail() { // Test if correctly access. char path[] = "/home/yasuhito/trema/tmp/chess.pid"; expect_string( mock_access, pathname, path ); expect_value( mock_access, mode, R_OK ); will_return( mock_access, -1 ); // Go pid_t pid = read_pid( "/home/yasuhito/trema/tmp", "chess" ); assert_true( pid == -1 );}
开发者ID:axsh,项目名称:trema-edge,代码行数:12,
示例5: test_write_pid_fail_if_lockf_failstatic voidtest_write_pid_fail_if_lockf_fail() { will_return( mock_open, 1111 ); will_return( mock_lockf, -1 ); // Test if correctly locked. char path[] = "/home/yasuhito/trema/tmp/chess.pid"; expect_string( mock_open, pathname, path ); expect_value( mock_open, flags, ( O_RDWR | O_CREAT ) ); expect_value( mock_open, mode, 0600 ); // Test if correctly locked. expect_value( mock_lockf, fd, 1111 ); expect_value( mock_lockf, cmd, F_TLOCK ); expect_value( mock_lockf, len, 0 ); // lockf_return_value = -1; expect_string( mock_die, message, "Could not acquire a lock on a PID file: /home/yasuhito/trema/tmp/chess.pid" ); expect_assert_failure( write_pid( "/home/yasuhito/trema/tmp", "chess" ) );}
开发者ID:axsh,项目名称:trema-edge,代码行数:21,
示例6: cmd_account_set_status_shows_message_when_invalid_statusvoid cmd_account_set_status_shows_message_when_invalid_status(void **state){ gchar *args[] = { "set", "a_account", "status", "bad_status", NULL }; expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); expect_cons_show("Invalid status: bad_status"); expect_cons_show(""); gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args); assert_true(result);}
开发者ID:NiklausHofer,项目名称:profanity,代码行数:13,
示例7: cmd_account_disable_shows_message_when_account_doesnt_existvoid cmd_account_disable_shows_message_when_account_doesnt_exist(void **state){ gchar *args[] = { "disable", "account_name", NULL }; expect_any(accounts_disable, name); will_return(accounts_disable, FALSE); expect_cons_show("No such account: account_name"); expect_cons_show(""); gboolean result = cmd_account_disable(NULL, CMD_ACCOUNT, args); assert_true(result);}
开发者ID:NiklausHofer,项目名称:profanity,代码行数:13,
示例8: cmd_account_disable_disables_accountvoid cmd_account_disable_disables_account(void **state){ gchar *args[] = { "disable", "account_name", NULL }; expect_string(accounts_disable, name, "account_name"); will_return(accounts_disable, TRUE); expect_cons_show("Account disabled."); expect_cons_show(""); gboolean result = cmd_account_disable(NULL, CMD_ACCOUNT, args); assert_true(result);}
开发者ID:NiklausHofer,项目名称:profanity,代码行数:13,
示例9: test_cbt_util_coalesce_set_file_pointer_failure/* * Test failure to set file pointer to start of bitmap area */void test_cbt_util_coalesce_set_file_pointer_failure(void **state){ int result; int file_size; char* args[] = { "cbt-util", "coalesce", "-p", "test_parent.log", "-c" , "test_child.log"}; void *parent_data; void *child_data; uint64_t size = 4194304; uint64_t bmsize = bitmap_size(size); file_size = sizeof(struct cbt_log_metadata) + bmsize; parent_data = malloc(file_size); child_data = malloc(file_size); //Intialise size in metadata file ((struct cbt_log_metadata*)parent_data)->size = size; //Fill bitmap with random bytes memcpy(parent_data + sizeof(struct cbt_log_metadata), (void*)memcpy, bmsize ); FILE *parent_log = fmemopen((void*)parent_data, file_size, "w+"); //Intialise size in metadata file ((struct cbt_log_metadata*)child_data)->size = size; //Fill bitmap with random bytes memcpy(child_data + sizeof(struct cbt_log_metadata), (void*)memcpy, bmsize ); FILE *child_log = fmemopen((void*)child_data, file_size, "w+"); will_return(__wrap_fopen, parent_log); expect_value(__wrap_fclose, fp, parent_log); will_return(__wrap_fopen, child_log); expect_value(__wrap_fclose, fp, child_log); fail_fseek(EIO); result = cbt_util_coalesce(6, args); assert_int_equal(result, -EIO); free(parent_data); free(child_data);}
开发者ID:MarkSymsCtx,项目名称:blktap,代码行数:42,
示例10: test_cbt_util_coalesce_no_child_meta_failure/* * Test failure to read log metadata for child */void test_cbt_util_coalesce_no_child_meta_failure(void **state){ int result; char* args[] = { "cbt-util", "coalesce", "-p", "test_parent.log", "-c" , "test_child.log"}; void *parent_meta; void *child_meta[1]; parent_meta = malloc(sizeof(struct cbt_log_metadata)); FILE *parent_log = fmemopen((void*)parent_meta, sizeof(struct cbt_log_metadata), "r"); FILE *child_log = fmemopen((void*)child_meta, 1, "r"); will_return(__wrap_fopen, parent_log); expect_value(__wrap_fclose, fp, parent_log); will_return(__wrap_fopen, child_log); expect_value(__wrap_fclose, fp, child_log); result = cbt_util_coalesce(6, args); assert_int_equal(result, -EIO); free(parent_meta);}
开发者ID:MarkSymsCtx,项目名称:blktap,代码行数:25,
示例11: _init_cdbdisp_dispatchPlan/* * Mocked object initializations required for dispatchPlan. */void_init_cdbdisp_dispatchPlan(QueryDesc *queryDesc){ queryDesc->estate = (struct EState *)palloc0(sizeof(struct EState)); queryDesc->estate->es_sliceTable = (struct SliceTable *) palloc0(sizeof(struct SliceTable)); queryDesc->operation = CMD_NOTHING; queryDesc->plannedstmt = (PlannedStmt *)palloc0(sizeof(PlannedStmt)); will_be_called(clear_relsize_cache); expect_any(RootSliceIndex, estate); will_return(RootSliceIndex,0);}
开发者ID:MicroMirror,项目名称:gpdb,代码行数:16,
示例12: cmd_account_clear_shows_message_when_account_doesnt_existvoid cmd_account_clear_shows_message_when_account_doesnt_exist(void **state){ gchar *args[] = { "clear", "a_account", "a_property", NULL }; expect_string(accounts_account_exists, account_name, "a_account"); will_return(accounts_account_exists, FALSE); expect_cons_show("Account a_account doesn't exist"); expect_cons_show(""); gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args); assert_true(result);}
开发者ID:NiklausHofer,项目名称:profanity,代码行数:13,
示例13: test__AOSegmentFilePathNameLenvoid test__AOSegmentFilePathNameLen(void **state) { RelationData reldata; char* basepath = "base/21381/123"; expect_any(relpath, &rnode); will_return(relpath, strdup(basepath)); int r = AOSegmentFilePathNameLen(&reldata); assert_in_range(r, strlen(basepath) + 3, strlen(basepath) + 10);}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:13,
示例14: test_with_connection_statusstatic void test_with_connection_status(jabber_conn_status_t status){ CommandHelp *help = malloc(sizeof(CommandHelp)); will_return(jabber_get_connection_status, status); expect_cons_show("You are not currently connected."); gboolean result = cmd_rooms(NULL, NULL, *help); assert_true(result); free(help);}
开发者ID:diagprov,项目名称:profanity,代码行数:13,
示例15: test_with_connection_statusstatic void test_with_connection_status(jabber_conn_status_t status){ CommandHelp *help = malloc(sizeof(CommandHelp)); will_return(jabber_get_connection_status, status); expect_cons_show("You are either connected already, or a login is in process."); gboolean result = cmd_connect(NULL, NULL, *help); assert_true(result); free(help);}
开发者ID:diagprov,项目名称:profanity,代码行数:13,
示例16: cmd_account_show_shows_message_when_account_does_not_existvoid cmd_account_show_shows_message_when_account_does_not_exist(void **state){ gchar *args[] = { "show", "account_name", NULL }; expect_any(accounts_get_account, name); will_return(accounts_get_account, NULL); expect_cons_show("No such account."); expect_cons_show(""); gboolean result = cmd_account_show(NULL, CMD_ACCOUNT, args); assert_true(result);}
开发者ID:NiklausHofer,项目名称:profanity,代码行数:13,
示例17: cmd_connect_connects_with_account |