• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FAIL_IF函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FAIL_IF函数的典型用法代码示例。如果您正苦于以下问题:C++ FAIL_IF函数的具体用法?C++ FAIL_IF怎么用?C++ FAIL_IF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FAIL_IF函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: EstEID_loadCertInfo

int EstEID_loadCertInfo(EstEID_Certs *certs, int index) {
	CK_SLOT_ID slotID = certs->slotIDs[index];

	CK_SLOT_INFO slotInfo;
	FAIL_IF(EstEID_CK_failure("C_GetSlotInfo", fl->C_GetSlotInfo(slotID, &slotInfo)));

	if (!(slotInfo.flags & CKF_TOKEN_PRESENT)) return SUCCESS;

	CK_TOKEN_INFO tokenInfo;
	FAIL_IF(EstEID_CK_failure("C_GetTokenInfo", fl->C_GetTokenInfo(slotID, &tokenInfo)));

	certs->certs[index] = EstEID_createCertMap(tokenInfo);

	FAIL_UNLESS(EstEID_loadCertInfoEntries(certs, index));

	return SUCCESS;
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:17,代码来源:esteid_certinfo.c


示例2: DUMMY_INSTALL_COMPONENT

static bool
DUMMY_INSTALL_COMPONENT (gcs_backend_t* backend, const gcs_comp_msg_t* comp)
{
    bool primary = gcs_comp_msg_primary (comp);
    long my_idx  = gcs_comp_msg_self    (comp);
    long members = gcs_comp_msg_num     (comp);

    action_t act;

    FAIL_IF (gcs_dummy_set_component(Backend, comp), "", NULL);
    FAIL_IF (DUMMY_INJECT_COMPONENT (Backend, comp), "", NULL);
    FAIL_IF (CORE_RECV_ACT (&act, NULL, UNKNOWN_SIZE, GCS_ACT_CONF), "", NULL);
    FAIL_IF (core_test_check_conf(act.out, primary, my_idx, members),
             "", NULL);
    free (act.out);
    return false;
}
开发者ID:cyclefusion,项目名称:galera,代码行数:17,代码来源:gcs_core_test.c


示例3: test_bug33831

static int test_bug33831(MYSQL *mysql)
{
  FAIL_IF(mysql_real_connect(mysql, hostname, username,
                             password, schema, port, socketname, 0), 
         "Error expected");
  
  return OK;
}
开发者ID:leobackes,项目名称:mariadb-connector-c,代码行数:8,代码来源:connection.c


示例4: notify_parent_of_error

int notify_parent_of_error(union pipe write_pipe)
{
	char c = ~CHILD_TOKEN;

	FAIL_IF(write(write_pipe.write_fd, &c, 1) != 1);

	return 0;
}
开发者ID:020gzh,项目名称:linux,代码行数:8,代码来源:lib.c


示例5: create_dyncol_num

static int create_dyncol_num(MYSQL *mysql)
{
  DYNAMIC_COLUMN dyncol;
  DYNAMIC_COLUMN_VALUE vals[5];
  uint i, column_count= 5;
  uint my_count;
  MYSQL_LEX_STRING *my_keys;
  DYNAMIC_COLUMN_VALUE *my_vals;
  int rc;
  char *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5"};

  uint keys1[5]= {1,2,3,4,5},
       keys2[5]= {1,2,2,4,5};
  MYSQL_LEX_STRING key1= {"1",1};

  for (i=0; i < column_count; i++)
  {
    vals[i].type= DYN_COL_STRING;
    vals[i].x.string.value.str= strval[i];
    vals[i].x.string.value.length= strlen(strval[i]);
    vals[i].x.string.charset= (CHARSET_INFO *)mysql->charset;
  }
  FAIL_IF(mariadb_dyncol_create_many_num(&dyncol, column_count, keys1, vals, 1) <0, "Error (keys1)");

  vals[0].x.string.value.str= strval[1];
  rc= mariadb_dyncol_update_many_named(&dyncol,1, &key1, vals);
  diag("update: %d", rc);

  rc= mariadb_dyncol_unpack(&dyncol, &my_count, &my_keys, &my_vals);
  diag("unpack: %d %d", rc, my_count);

  diag("---------------__");
  for(i=0; i < 5; i++)
  {
    diag("%s %d", my_keys[i].str, my_keys[i].length);
  }
  free(my_keys);
  free(my_vals);

  FAIL_IF(mariadb_dyncol_column_count(&dyncol, &column_count) < 0, "Error");
  FAIL_IF(column_count != 5, "5 columns expected");
  mariadb_dyncol_free(&dyncol);
  FAIL_IF(mariadb_dyncol_create_many_num(&dyncol, column_count, keys2, vals, 1) >=0, "Error expected (keys2)");
  mariadb_dyncol_free(&dyncol);
  return OK;
}
开发者ID:bsmr-mariadb,项目名称:connector-c,代码行数:46,代码来源:dyncol.c


示例6: DetectAppLayerProtocolTest14

static int DetectAppLayerProtocolTest14(void)
{
    DetectAppLayerProtocolData *data = NULL;
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);
    de_ctx->flags |= DE_QUIET;

    Signature *s1 = DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any "
            "(app-layer-protocol:http; flowbits:set,blah; sid:1;)");
    FAIL_IF_NULL(s1);
    FAIL_IF(s1->alproto != ALPROTO_UNKNOWN);
    FAIL_IF_NULL(s1->sm_lists[DETECT_SM_LIST_MATCH]);
    FAIL_IF_NULL(s1->sm_lists[DETECT_SM_LIST_MATCH]->ctx);
    data = (DetectAppLayerProtocolData *)s1->sm_lists[DETECT_SM_LIST_MATCH]->ctx;
    FAIL_IF(data->alproto != ALPROTO_HTTP);
    FAIL_IF(data->negated);

    Signature *s2 = DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any "
            "(app-layer-protocol:http; flow:to_client; sid:2;)");
    FAIL_IF_NULL(s2);
    FAIL_IF(s2->alproto != ALPROTO_UNKNOWN);
    FAIL_IF_NULL(s2->sm_lists[DETECT_SM_LIST_MATCH]);
    FAIL_IF_NULL(s2->sm_lists[DETECT_SM_LIST_MATCH]->ctx);
    data = (DetectAppLayerProtocolData *)s2->sm_lists[DETECT_SM_LIST_MATCH]->ctx;
    FAIL_IF(data->alproto != ALPROTO_HTTP);
    FAIL_IF(data->negated);

    /* flow:established and other options not supported for PD-only */
    Signature *s3 = DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any "
            "(app-layer-protocol:http; flow:to_client,established; sid:3;)");
    FAIL_IF_NULL(s3);
    FAIL_IF(s3->alproto != ALPROTO_UNKNOWN);
    FAIL_IF_NULL(s3->sm_lists[DETECT_SM_LIST_MATCH]);
    FAIL_IF_NULL(s3->sm_lists[DETECT_SM_LIST_MATCH]->ctx);
    data = (DetectAppLayerProtocolData *)s3->sm_lists[DETECT_SM_LIST_MATCH]->ctx;
    FAIL_IF(data->alproto != ALPROTO_HTTP);
    FAIL_IF(data->negated);

    SigGroupBuild(de_ctx);
    FAIL_IF_NOT(s1->flags & SIG_FLAG_PDONLY);
    FAIL_IF_NOT(s2->flags & SIG_FLAG_PDONLY);
    FAIL_IF(s3->flags & SIG_FLAG_PDONLY); // failure now

    DetectEngineCtxFree(de_ctx);
    PASS;
}
开发者ID:bmeeks8,项目名称:suricata,代码行数:46,代码来源:detect-app-layer-protocol.c


示例7: test_conc70

static int test_conc70(MYSQL *my)
{
  int rc;
  MYSQL_RES *res;
  MYSQL_ROW row;
  MYSQL *mysql= mysql_init(NULL);

  rc= mysql_query(my, "SET @a:[email protected]@max_allowed_packet");
  check_mysql_rc(rc, my);

  mysql_query(my, "SET global max_allowed_packet=1024*1024*22");

  mysql_options(mysql, MYSQL_OPT_COMPRESS, (void *)1);
  FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
                         port, socketname, 0), mysql_error(my));

  rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
  check_mysql_rc(rc, mysql);

  rc= mysql_query(mysql, "CREATE TABLE t1 (a LONGBLOB) engine=MyISAM");
  check_mysql_rc(rc, mysql);

  rc= mysql_query(mysql, "INSERT INTO t1 VALUES (REPEAT('A', 1024 * 1024 * 20))");
  check_mysql_rc(rc, mysql); 

  rc= mysql_query(mysql, "SELECT a FROM t1");
  check_mysql_rc(rc, mysql);

  if (!(res= mysql_store_result(mysql)))
  {
    diag("Error: %s", mysql_error(mysql));
    return FAIL;
  }

  row= mysql_fetch_row(res);
  diag("Length: %ld", strlen(row[0]));
  FAIL_IF(strlen(row[0]) != 1024 * 1024 * 20, "Wrong length");

  mysql_free_result(res);
  mysql_close(mysql);

  rc= mysql_query(my, "SET global [email protected]");
  check_mysql_rc(rc, my);

  return OK;
}
开发者ID:inuyasha1027,项目名称:mariadb-connector-c,代码行数:46,代码来源:basic-t.c


示例8: DetectTemplateParseTest01

static int DetectTemplateParseTest01 (void)
{
    DetectTemplateData *templated = DetectTemplateParse("1,10");
    FAIL_IF_NULL(templated);
    FAIL_IF(!(templated->arg1 == 1 && templated->arg2 == 10));
    DetectTemplateFree(templated);
    PASS;
}
开发者ID:bmeeks8,项目名称:suricata,代码行数:8,代码来源:detect-template.c


示例9: create_prog_store

/* create_prog_store()
Create a program store and its descendants or die.

The program store holds some basic program and system info.
*/
void create_prog_store( 
	struct prog **const out   // out deref
)
{
	struct prog *prog = NULL;
	
	FAIL_IF( !out );
	FAIL_IF( *out );
	
	
	/* allocate a prog store */
	prog = must_calloc( 1, sizeof( *prog ) );
	
	
	*out = prog;
	return;
}
开发者ID:tigros,项目名称:HookTools,代码行数:22,代码来源:prog.c


示例10: test_newfree

static int
test_newfree(void){
	struct disassembler *dis;

	dis = new_disassembler(0);
	FAIL_IF(dis == NULL);
	free_disassembler(dis);
	return 0;
}
开发者ID:wjlandryiii,项目名称:dis,代码行数:9,代码来源:disassembler-test.c


示例11: bug_conc1

static int bug_conc1(MYSQL *mysql)
{
  mysql_real_connect(mysql, hostname, username, password, schema,
                     port, socketname, 0);
  diag("errno: %d", mysql_errno(mysql));
  FAIL_IF(mysql_errno(mysql) != CR_ALREADY_CONNECTED,
          "Expected errno=CR_ALREADY_CONNECTED");
  return OK;
}
开发者ID:Torndeco,项目名称:mariadb-connector-c,代码行数:9,代码来源:basic-t.c


示例12: reg_access

/*
 * Test basic access to the EBB regs, they should be user accessible with no
 * kernel interaction required.
 */
int reg_access(void)
{
	uint64_t val, expected;

	expected = 0x8000000100000000ull;
	mtspr(SPRN_BESCR, expected);
	val = mfspr(SPRN_BESCR);

	FAIL_IF(val != expected);

	expected = 0x0000000001000000ull;
	mtspr(SPRN_EBBHR, expected);
	val = mfspr(SPRN_EBBHR);

	FAIL_IF(val != expected);

	return 0;
}
开发者ID:19Dan01,项目名称:linux,代码行数:22,代码来源:reg_access_test.c


示例13: Test_ParseStringTwoTables

void Test_ParseStringTwoTables(void)
{
	struct CfgParser * parser;
	char * string = \
		"TestTable0:\n"  \
		"    - TestValue0:  yes\n" \
		"TestTable1:\n"  \
		"    - TestValue1:  no\n";

	struct CfgTable table, table0, table1;
	bool b0 = false, b1 = true;

	struct CfgItem	items[2] =
	{
		{TYPE_TABLE, "TestTable0", &table0},
		{TYPE_TABLE, "TestTable1", &table1},
	};
	struct CfgItem	items0[1] =
	{
		{TYPE_BOOL, "TestValue0", &b0},
	};
	struct CfgItem	items1[1] =
	{
		{TYPE_BOOL, "TestValue1", &b1},
	};

	table1.count = 1;
	table1.items = items1;

	table0.count = 1;
	table0.items = items0;

	table.count = 2;
	table.items = items;

	parser = YamlCfgParser_Create();
	YamlCfgParser_SetTable(parser, &table);
	YamlCfgParser_ParseString(parser, string);

	FAIL_IF (b0 != true);
	FAIL_IF (b1 != false);

	PASS();
}
开发者ID:zale-pu,项目名称:typhon,代码行数:44,代码来源:yaml_config.c


示例14: test_bug19671

static int test_bug19671(MYSQL *mysql)
{
  MYSQL_RES *result;
  MYSQL_FIELD *field;
  int rc, retcode= OK;


  rc= mysql_query(mysql, "set sql_mode=''");
  check_mysql_rc(rc, mysql);
  rc= mysql_query(mysql, "drop table if exists t1");
  check_mysql_rc(rc, mysql);

  rc= mysql_query(mysql, "drop view if exists v1");
  check_mysql_rc(rc, mysql);

  rc= mysql_query(mysql, "create table t1(f1 int)");
  check_mysql_rc(rc, mysql);

  rc= mysql_query(mysql, "create view v1 as select va.* from t1 va");
  check_mysql_rc(rc, mysql);

  rc= mysql_query(mysql, "SELECT * FROM v1");
  check_mysql_rc(rc, mysql);

  result= mysql_store_result(mysql);
  FAIL_IF(!result, "Invalid result set");

  field= mysql_fetch_field(result);
  FAIL_IF(!field, "Can't fetch field");

  if (strcmp(field->table, "v1") != 0) {
    diag("Wrong value '%s' for field_table. Expected 'v1'. (%s: %d)", field->table, __FILE__, __LINE__);
    retcode= FAIL;
  }

  mysql_free_result(result);

  rc= mysql_query(mysql, "drop view v1");
  check_mysql_rc(rc, mysql);
  rc= mysql_query(mysql, "drop table t1");
  check_mysql_rc(rc, mysql);

  return retcode;
}
开发者ID:hp-sam,项目名称:mariadb-connector-c,代码行数:44,代码来源:view.c


示例15: test_bug15752

static int test_bug15752(MYSQL *mysql)
{
  int rc, i;
  const int ITERATION_COUNT= 100;
  const char *query= "CALL p1()";


  rc= mysql_query(mysql, "drop procedure if exists p1");
  check_mysql_rc(rc, mysql);
  rc= mysql_query(mysql, "create procedure p1() select 1");
  check_mysql_rc(rc, mysql);

  rc= mysql_real_query(mysql, query, strlen(query));
  check_mysql_rc(rc, mysql);
  mysql_free_result(mysql_store_result(mysql));

  rc= mysql_real_query(mysql, query, strlen(query));
  FAIL_UNLESS(rc && mysql_errno(mysql) == CR_COMMANDS_OUT_OF_SYNC, "Error expected");

  rc= mysql_next_result(mysql);
  check_mysql_rc(rc, mysql);

  mysql_free_result(mysql_store_result(mysql));

  rc= mysql_next_result(mysql);
  FAIL_IF(rc != -1, "rc != -1");

  for (i = 0; i < ITERATION_COUNT; i++)
  {
    rc= mysql_real_query(mysql, query, strlen(query));
    check_mysql_rc(rc, mysql);
    mysql_free_result(mysql_store_result(mysql));
    rc= mysql_next_result(mysql);
    check_mysql_rc(rc, mysql);
    mysql_free_result(mysql_store_result(mysql));
    rc= mysql_next_result(mysql);
    FAIL_IF(rc != -1, "rc != -1");

  }
  rc= mysql_query(mysql, "drop procedure p1");
  check_mysql_rc(rc, mysql);

  return OK;
}
开发者ID:dparnell,项目名称:MariaDB,代码行数:44,代码来源:sp.c


示例16: test_connection_timeout3

int test_connection_timeout3(MYSQL *my)
{
  unsigned int timeout= 5;
  unsigned int read_write_timeout= 10;
  int rc;
  time_t start, elapsed;
  MYSQL *mysql= mysql_init(NULL);
  mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (unsigned int *)&timeout);
  mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (unsigned int *)&read_write_timeout);
  mysql_options(mysql, MYSQL_OPT_WRITE_TIMEOUT, (unsigned int *)&read_write_timeout);
  mysql_options(mysql, MYSQL_INIT_COMMAND, "set @a:=SLEEP(6)");
  start= time(NULL);
  if (mysql_real_connect(mysql, hostname, username, password, schema, port, NULL, CLIENT_REMEMBER_OPTIONS))
  {
    diag("timeout error expected");
    elapsed= time(NULL) - start;
    diag("elapsed: %lu", (unsigned long)elapsed);
    return FAIL;
  }
  elapsed= time(NULL) - start;
  diag("elapsed: %lu", (unsigned long)elapsed);
  FAIL_IF(elapsed > timeout + 1, "timeout ignored")

  mysql_close(mysql);
  mysql= mysql_init(NULL);
  mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (unsigned int *)&timeout);
  mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (unsigned int *)&read_write_timeout);
  mysql_options(mysql, MYSQL_OPT_WRITE_TIMEOUT, (unsigned int *)&read_write_timeout);

  if (!mysql_real_connect(mysql, hostname, username, password, schema, port, NULL, CLIENT_REMEMBER_OPTIONS))
  {
    diag("Error: %s", mysql_error(mysql));
    return FAIL;
  }

  start= time(NULL);
  rc= mysql_query(mysql, "SET @a:=SLEEP(12)");
  elapsed= time(NULL) - start;
  diag("elapsed: %lu", (unsigned long)elapsed);
  FAIL_IF(!rc, "timeout expected");
  mysql_close(mysql);
  return OK;
}
开发者ID:patrislav1,项目名称:mariadb-connector-c,代码行数:43,代码来源:connection.c


示例17: no_handler_test

static int no_handler_test(void)
{
	struct event event;
	u64 val;
	int i;

	SKIP_IF(!ebb_is_supported());

	event_init_named(&event, 0x1001e, "cycles");
	event_leader_ebb_init(&event);

	event.attr.exclude_kernel = 1;
	event.attr.exclude_hv = 1;
	event.attr.exclude_idle = 1;

	FAIL_IF(event_open(&event));
	FAIL_IF(ebb_event_enable(&event));

	val = mfspr(SPRN_EBBHR);
	FAIL_IF(val != 0);

	/* Make sure it overflows quickly */
	sample_period = 1000;
	mtspr(SPRN_PMC1, pmc_sample_period(sample_period));

	/* Spin to make sure the event has time to overflow */
	for (i = 0; i < 1000; i++)
		mb();

	dump_ebb_state();

	/* We expect to see the PMU frozen & PMAO set */
	val = mfspr(SPRN_MMCR0);
	FAIL_IF(val != 0x0000000080000080);

	event_close(&event);

	dump_ebb_state();

	/* The real test is that we never took an EBB at 0x0 */

	return 0;
}
开发者ID:020gzh,项目名称:linux,代码行数:43,代码来源:no_handler_test.c


示例18: test_disassemble_instruction_x86

static int
test_disassemble_instruction_x86(void){
	struct disassembler *dis;
	uint8_t inst[8];
	char line[512];
	size_t inst_size;

	dis = new_disassembler(0);
	FAIL_IF(dis == NULL);

	inst[0] = 0x90;
	disassemble_instruction(dis, inst, sizeof(inst), 0x100,
			line, sizeof(line),
			&inst_size);
	FAIL_IF(inst_size != 1);
	FAIL_IF(strncmp(line, "nop", 3) != 0);
	free_disassembler(dis);
	return 0;
}
开发者ID:wjlandryiii,项目名称:dis,代码行数:19,代码来源:disassembler-test.c


示例19: DUMMY_INJECT_COMPONENT

static bool
DUMMY_INJECT_COMPONENT (gcs_backend_t* backend, const gcs_comp_msg_t* comp)
{
    long ret = gcs_dummy_inject_msg (Backend, comp,
                                     gcs_comp_msg_size(comp),
                                     GCS_MSG_COMPONENT, GCS_SENDER_NONE);
    FAIL_IF (ret <= 0, "gcs_dummy_inject_msg(): %ld (%s)", ret, strerror(ret));

    return false;
}
开发者ID:cyclefusion,项目名称:galera,代码行数:10,代码来源:gcs_core_test.c


示例20: test_conc129

static int test_conc129(MYSQL *my)
{
  MYSQL *mysql;
  
  if (skip_async)
    return SKIP;

  mysql= mysql_init(NULL);
  FAIL_IF(mysql_close_start(mysql), "No error expected");
  return OK;
}
开发者ID:Torndeco,项目名称:mariadb-connector-c,代码行数:11,代码来源:async.c



注:本文中的FAIL_IF函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FAIL_IF_NULL函数代码示例发布时间:2022-05-30
下一篇:
C++ FAILURE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap