您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ torture_assert函数代码示例

51自学网 2021-06-03 08:55:41
  C++
这篇教程C++ torture_assert函数代码示例写得很实用,希望能帮到您。

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

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

示例1: torture_libsmbclient_options

bool torture_libsmbclient_options(struct torture_context *tctx){	SMBCCTX *ctx;	ctx = smbc_new_context();	torture_assert(tctx, ctx, "failed to get new context");	torture_assert(tctx, smbc_init_context(ctx), "failed to init context");	TEST_OPTION_INT(OptionDebugToStderr, true);	TEST_OPTION_INT(OptionFullTimeNames, true);	TEST_OPTION_INT(OptionOpenShareMode, SMBC_SHAREMODE_DENY_ALL);	/* FIXME: OptionUserData */	TEST_OPTION_INT(OptionSmbEncryptionLevel, SMBC_ENCRYPTLEVEL_REQUEST);	TEST_OPTION_INT(OptionCaseSensitive, false);	TEST_OPTION_INT(OptionBrowseMaxLmbCount, 2);	TEST_OPTION_INT(OptionUrlEncodeReaddirEntries, true);	TEST_OPTION_INT(OptionOneSharePerServer, true);	TEST_OPTION_INT(OptionUseKerberos, false);	TEST_OPTION_INT(OptionFallbackAfterKerberos, false);	TEST_OPTION_INT(OptionNoAutoAnonymousLogin, true);	TEST_OPTION_INT(OptionUseCCache, true);	smbc_free_context(ctx, 1);	return true;}
开发者ID:AIdrifter,项目名称:samba,代码行数:26,


示例2: test_guid_from_string

static bool test_guid_from_string(struct torture_context *tctx){	struct GUID g1, exp;	torture_assert_ntstatus_ok(tctx,				   GUID_from_string("00000001-0002-0003-0405-060708090a0b", &g1),				   "invalid return code");	exp.time_low = 1;	exp.time_mid = 2;	exp.time_hi_and_version = 3;	exp.clock_seq[0] = 4;	exp.clock_seq[1] = 5;	exp.node[0] = 6;	exp.node[1] = 7;	exp.node[2] = 8;	exp.node[3] = 9;	exp.node[4] = 10;	exp.node[5] = 11;	torture_assert(tctx, GUID_equal(&g1, &exp), "UUID parsed incorrectly");	torture_assert_ntstatus_ok(tctx,				   GUID_from_string("{00000001-0002-0003-0405-060708090a0b}", &g1),				   "invalid return code");	torture_assert(tctx, GUID_equal(&g1, &exp), "UUID parsed incorrectly");	return true;}
开发者ID:Arkhont,项目名称:samba,代码行数:25,


示例3: test_afdgets

static bool test_afdgets(struct torture_context *tctx){	int fd;	char *line;	TALLOC_CTX *mem_ctx = tctx;	bool ret = false;		torture_assert(tctx, file_save(TEST_FILENAME, (const void *)TEST_DATA, 							 strlen(TEST_DATA)),				   "saving file");	fd = open(TEST_FILENAME, O_RDONLY);		torture_assert(tctx, fd != -1, "opening file");	line = afdgets(fd, mem_ctx, 8);	torture_assert_goto(tctx, strcmp(line, TEST_LINE1) == 0, ret, done,			    "line 1 mismatch");	line = afdgets(fd, mem_ctx, 8);	torture_assert_goto(tctx, strcmp(line, TEST_LINE2) == 0, ret, done,			    "line 2 mismatch");	line = afdgets(fd, mem_ctx, 8);	torture_assert_goto(tctx, strcmp(line, TEST_LINE3) == 0, ret, done,			    "line 3 mismatch");	ret = true;done:	close(fd);	unlink(TEST_FILENAME);	return ret;}
开发者ID:Alexander--,项目名称:samba,代码行数:33,


示例4: test_Lookup_simple

static bool test_Lookup_simple(struct torture_context *tctx,			       struct dcerpc_pipe *p){	NTSTATUS status;	struct epm_Lookup r;	struct policy_handle entry_handle;	uint32_t num_ents = 0;	struct dcerpc_binding_handle *h = p->binding_handle;	ZERO_STRUCT(entry_handle);	torture_comment(tctx, "Testing epm_Lookup/n");	/* get all elements */	r.in.inquiry_type = RPC_C_EP_ALL_ELTS;	r.in.object = NULL;	r.in.interface_id = NULL;	r.in.vers_option = RPC_C_VERS_ALL;	r.in.entry_handle = &entry_handle;	r.in.max_ents = 10;	r.out.entry_handle = &entry_handle;	r.out.num_ents = &num_ents;	do {		int i;		status = dcerpc_epm_Lookup_r(h, tctx, &r);		if (!NT_STATUS_IS_OK(status) ||		    r.out.result != EPMAPPER_STATUS_OK) {			break;		}		torture_comment(tctx,				"epm_Lookup returned %d events, entry_handle: %s/n",				*r.out.num_ents,				GUID_string(tctx, &entry_handle.uuid));		for (i = 0; i < *r.out.num_ents; i++) {			torture_comment(tctx,					"/n  Found '%s'/n",					r.out.entries[i].annotation);			display_tower(tctx, &r.out.entries[i].tower->tower);		}	} while (NT_STATUS_IS_OK(status) &&		 r.out.result == EPMAPPER_STATUS_OK &&		 *r.out.num_ents == r.in.max_ents &&		 !ndr_policy_handle_empty(&entry_handle));	torture_assert_ntstatus_ok(tctx, status, "epm_Lookup failed");	torture_assert(tctx, r.out.result == EPMAPPER_STATUS_NO_MORE_ENTRIES, "epm_Lookup failed");	torture_assert(tctx,		       ndr_policy_handle_empty(&entry_handle),		       "epm_Lookup failed - The policy handle should be emtpy.");	return true;}
开发者ID:AIdrifter,项目名称:samba,代码行数:60,


示例5: whoami_sid_parse

static bool whoami_sid_parse(void *mem_ctx,		struct torture_context *torture,		DATA_BLOB *data, size_t *offset,		struct dom_sid **psid){	size_t remain = data->length - *offset;	int i;	*psid = talloc_zero(mem_ctx, struct dom_sid);	torture_assert(torture, *psid != NULL, "out of memory");	torture_assert(torture, remain >= 8,			"invalid SID format");        (*psid)->sid_rev_num = CVAL(data->data, *offset);        (*psid)->num_auths = CVAL(data->data, *offset + 1);        memcpy((*psid)->id_auth, data->data + *offset + 2, 6);	(*offset) += 8;	remain = data->length - *offset;	torture_assert(torture, remain >= ((*psid)->num_auths * 4),			"invalid sub_auth byte count");	torture_assert(torture, (*psid)->num_auths >= 0,			"invalid sub_auth value");	torture_assert(torture, (*psid)->num_auths <= 15,			"invalid sub_auth value");        for (i = 0; i < (*psid)->num_auths; i++) {                (*psid)->sub_auths[i] = IVAL(data->data, *offset);		(*offset) += 4;	}	return true;}
开发者ID:dmitry-shavyrin,项目名称:samba4_embedded_build,代码行数:35,


示例6: test_file_load_save

static bool test_file_load_save(struct torture_context *tctx){	size_t len;	char *data;	TALLOC_CTX *mem_ctx = tctx;		torture_assert(tctx, file_save(TEST_FILENAME, TEST_DATA, strlen(TEST_DATA)),				   "saving file");	torture_assert_file_contains_text(tctx, TEST_FILENAME, TEST_DATA, 								      "file contents");	data = file_load(TEST_FILENAME, &len, 0, mem_ctx);	torture_assert(tctx, data, "loading file");	torture_assert_int_equal(tctx, len, strlen(TEST_DATA), "Length");		torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents");	data = file_load(TEST_FILENAME, &len, 5, mem_ctx);	torture_assert_int_equal(tctx, len, 5, "Length");	torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents");	unlink(TEST_FILENAME);	return true;}
开发者ID:Alexander--,项目名称:samba,代码行数:28,


示例7: test_free_ref_null_context

static bool test_free_ref_null_context(void){	void *p1, *p2, *p3;	int ret;	talloc_disable_null_tracking();	p1 = talloc_new(NULL);	p2 = talloc_new(NULL);	p3 = talloc_reference(p2, p1);	torture_assert("reference", p3 == p1, "failed: reference on null");	ret = talloc_free(p1);	torture_assert("ref free with null parent", ret == 0, "failed: free with null parent");	talloc_free(p2);	talloc_enable_null_tracking_no_autofree();	p1 = talloc_new(NULL);	p2 = talloc_new(NULL);	p3 = talloc_reference(p2, p1);	torture_assert("reference", p3 == p1, "failed: reference on null");	ret = talloc_free(p1);	torture_assert("ref free with null tracked parent", ret == 0, "failed: free with null parent");	talloc_free(p2);	return true;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:29,


示例8: witness_GetInterfaceList_check

static bool witness_GetInterfaceList_check(struct torture_context *tctx,					   struct witness_GetInterfaceList *r){	struct witness_interfaceList *l;	torture_assert(tctx, r->out.interface_list, "r->out.interface_list");	l = *(r->out.interface_list);	torture_assert_int_equal(tctx, l->num_interfaces, 2, "l->num_interfaces");	torture_assert(tctx, l->interfaces, "l->interfaces");	torture_assert_str_equal(tctx, l->interfaces[0].group_name, "NODE2", "l->interfaces[0].group_name");	torture_assert_int_equal(tctx, l->interfaces[0].version, -1, "l->interfaces[0].version");	torture_assert_int_equal(tctx, l->interfaces[0].state, 1, "l->interfaces[0].state");	torture_assert_str_equal(tctx, l->interfaces[0].ipv4, "192.168.3.44", "l->interfaces[0].state");	torture_assert_int_equal(tctx, l->interfaces[0].flags, 5, "l->interfaces[0].flags");	torture_assert_str_equal(tctx, l->interfaces[1].group_name, "NODE1", "l->interfaces[0].group_name");	torture_assert_int_equal(tctx, l->interfaces[1].version, -1, "l->interfaces[0].version");	torture_assert_int_equal(tctx, l->interfaces[1].state, 1, "l->interfaces[0].state");	torture_assert_str_equal(tctx, l->interfaces[1].ipv4, "192.168.3.45", "l->interfaces[0].state");	torture_assert_int_equal(tctx, l->interfaces[1].flags, 1, "l->interfaces[0].flags");	torture_assert_werr_ok(tctx, r->out.result, "r->out.result");	return true;}
开发者ID:DanilKorotenko,项目名称:samba,代码行数:27,


示例9: test_netprintq

static bool test_netprintq(struct torture_context *tctx,			   struct smbcli_state *cli){	struct rap_NetPrintQEnum r;	int i;	r.in.level = 5;	r.in.bufsize = 8192;	torture_assert_ntstatus_ok(tctx,		smbcli_rap_netprintqenum(cli->tree, tctx, &r),		"failed to enum printq");	torture_assert_werr_ok(tctx, W_ERROR(r.out.status),		"failed to enum printq");	for (i=0; i < r.out.count; i++) {		const char *printqname = r.out.info[i].info5.PrintQueueName;		torture_assert(tctx,			test_netprintq_pause(tctx, cli, printqname),			"failed to pause print queue");		torture_assert(tctx,			test_netprintq_resume(tctx, cli, printqname),			"failed to resume print queue");	}	return true;}
开发者ID:AIdrifter,项目名称:samba,代码行数:30,


示例10: test_cmp

static bool test_cmp(struct torture_context *tctx){	DATA_BLOB a = data_blob_string_const("bla");	DATA_BLOB b = data_blob_string_const("blae");	torture_assert(tctx, data_blob_cmp(&a, &b) != 0, "cmp different");	torture_assert(tctx, data_blob_cmp(&a, &a) == 0, "cmp self");	return true;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:8,


示例11: test_null_time

static bool test_null_time(struct torture_context *tctx){	torture_assert(tctx, null_time(0), "0");	torture_assert(tctx, null_time(0xFFFFFFFF), "0xFFFFFFFF");	torture_assert(tctx, null_time(-1), "-1");	torture_assert(tctx, !null_time(42), "42");	return true;}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:8,


示例12: test_set_cmdline

static bool test_set_cmdline(struct torture_context *tctx){	struct loadparm_context *lp_ctx = loadparm_init(tctx);	torture_assert(tctx, lpcfg_set_cmdline(lp_ctx, "workgroup", "werkgroep"), "lpcfg_set_cmdline failed");	torture_assert(tctx, lpcfg_do_global_parameter(lp_ctx, "workgroup", "barbla"), "lpcfg_set_option failed");	torture_assert_str_equal(tctx, "WERKGROEP", lpcfg_workgroup(lp_ctx), "workgroup");	return true;}
开发者ID:srimalik,项目名称:samba,代码行数:8,


示例13: test_strhasupper

static bool test_strhasupper(struct torture_context *tctx){	torture_assert(tctx, strhasupper("B"), "one up char");	torture_assert(tctx, strhasupper("aB"), "one low, one up char");	torture_assert(tctx, !strhasupper("a"), "one low char");	torture_assert(tctx, !strhasupper(""), "empty string");	torture_assert(tctx, !strhasupper("3"), "one digit");	return true;}
开发者ID:DanilKorotenko,项目名称:samba,代码行数:9,


示例14: test_server_role_member_specified3

static bool test_server_role_member_specified3(struct torture_context *tctx){	struct loadparm_context *lp_ctx = loadparm_init(tctx);	torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=member"), "lpcfg_set_option failed");	torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=ads"), "lpcfg_set_option failed");	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_MEMBER, "ROLE should be member");	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_ADS, "security should be ads");	return true;}
开发者ID:srimalik,项目名称:samba,代码行数:9,


示例15: test_server_role_dc_domain_logons_and_not_master

static bool test_server_role_dc_domain_logons_and_not_master(struct torture_context *tctx){	struct loadparm_context *lp_ctx = loadparm_init(tctx);	torture_assert(tctx, lpcfg_set_option(lp_ctx, "domain logons=true"), "lpcfg_set_option failed");	torture_assert(tctx, lpcfg_set_option(lp_ctx, "domain master=false"), "lpcfg_set_option failed");	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_BDC, "ROLE should be BDC");	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be user");	return true;}
开发者ID:srimalik,项目名称:samba,代码行数:9,


示例16: test_realloc

/*  test realloc*/static bool test_realloc(void){	void *root, *p1, *p2;	printf("test: realloc/n# REALLOC/n");	root = talloc_new(NULL);	p1 = talloc_size(root, 10);	CHECK_SIZE("realloc", p1, 10);	p1 = talloc_realloc_size(NULL, p1, 20);	CHECK_SIZE("realloc", p1, 20);	talloc_new(p1);	p2 = talloc_realloc_size(p1, NULL, 30);	talloc_new(p1);	p2 = talloc_realloc_size(p1, p2, 40);	CHECK_SIZE("realloc", p2, 40);	CHECK_SIZE("realloc", root, 60);	CHECK_BLOCKS("realloc", p1, 4);	p1 = talloc_realloc_size(NULL, p1, 20);	CHECK_SIZE("realloc", p1, 60);	talloc_increase_ref_count(p2);	torture_assert("realloc", talloc_realloc_size(NULL, p2, 5) == NULL,		"failed: talloc_realloc() on a referenced pointer should fail/n");	CHECK_BLOCKS("realloc", p1, 4);	talloc_realloc_size(NULL, p2, 0);	talloc_realloc_size(NULL, p2, 0);	CHECK_BLOCKS("realloc", p1, 4);	talloc_realloc_size(p1, p2, 0);	CHECK_BLOCKS("realloc", p1, 3);	torture_assert("realloc", talloc_realloc_size(NULL, p1, 0x7fffffff) == NULL,		"failed: oversize talloc should fail/n");	talloc_realloc_size(NULL, p1, 0);	CHECK_BLOCKS("realloc", root, 4);	talloc_realloc_size(root, p1, 0);	CHECK_BLOCKS("realloc", root, 1);	CHECK_SIZE("realloc", root, 0);	talloc_free(root);	printf("success: realloc/n");	return true;}
开发者ID:urisimchoni,项目名称:samba,代码行数:59,


示例17: test_wbc_users

static bool test_wbc_users(struct torture_context *tctx){    const char *domain_name = NULL;    uint32_t num_users;    const char **users;    int i;    struct wbcInterfaceDetails *details;    torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),                          "%s", "wbcInterfaceDetails failed");    domain_name = talloc_strdup(tctx, details->netbios_domain);    wbcFreeMemory(details);    torture_assert_wbc_ok(tctx, wbcListUsers(domain_name, &num_users, &users),                          "%s", "wbcListUsers failed");    torture_assert(tctx, !(num_users > 0 && !users),                   "wbcListUsers returned invalid results");    for (i=0; i < MIN(num_users,100); i++) {        struct wbcDomainSid sid, *sids;        enum wbcSidType name_type;        char *domain;        char *name;        char *sid_string;        uint32_t num_sids;        torture_assert_wbc_ok(tctx, wbcLookupName(domain_name, users[i], &sid, &name_type),                              "wbcLookupName of %s failed", users[i]);        torture_assert_int_equal(tctx, name_type, WBC_SID_NAME_USER,                                 "wbcLookupName expected WBC_SID_NAME_USER");        wbcSidToString(&sid, &sid_string);        torture_assert_wbc_ok(tctx, wbcLookupSid(&sid, &domain, &name, &name_type),                              "wbcLookupSid of %s failed", sid_string);        torture_assert_int_equal(tctx, name_type, WBC_SID_NAME_USER,                                 "wbcLookupSid of expected WBC_SID_NAME_USER");        torture_assert(tctx, name,                       "wbcLookupSid returned no name");        wbcFreeMemory(domain);        wbcFreeMemory(name);        torture_assert_wbc_ok(tctx, wbcLookupUserSids(&sid, true, &num_sids, &sids),                              "wbcLookupUserSids of %s failed", sid_string);        torture_assert_wbc_ok(            tctx, wbcGetDisplayName(&sid, &domain, &name,                                    &name_type),            "wbcGetDisplayName of %s failed", sid_string);        wbcFreeMemory(domain);        wbcFreeMemory(name);        wbcFreeMemory(sids);        wbcFreeMemory(sid_string);    }    wbcFreeMemory(users);    return true;}
开发者ID:runt18,项目名称:samba,代码行数:56,


示例18: test_lp_parm_double

static bool test_lp_parm_double(struct torture_context *tctx){	struct loadparm_context *lp_ctx = loadparm_init(tctx);	torture_assert(tctx, lpcfg_set_option(lp_ctx, "some:thing=3.4"), "lpcfg_set_option failed");	torture_assert(tctx, lpcfg_parm_double(lp_ctx, NULL, "some", "thing", 2.0) == 3.4,				 "invalid parametric option");	torture_assert(tctx, lpcfg_parm_double(lp_ctx, NULL, "some", "bla", 2.0) == 2.0,				 "invalid parametric option");	return true;}
开发者ID:srimalik,项目名称:samba,代码行数:10,


示例19: enumkey_out_check

static bool enumkey_out_check(struct torture_context *tctx, struct winreg_EnumKey *r){	torture_assert_int_equal(tctx, r->out.name->size, 1044, "name size");	torture_assert_int_equal(tctx, r->out.name->length, 8, "name len");	torture_assert(tctx, r->out.keyclass != NULL, "keyclass pointer");	torture_assert(tctx, r->out.keyclass->name == NULL, "keyclass");	torture_assert(tctx, r->out.last_changed_time != NULL, "last_changed_time pointer");	/* FIXME: *last_changed_time */	return true;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:10,


示例20: enumkey_in_check

static bool enumkey_in_check(struct torture_context *tctx, struct winreg_EnumKey *r){	torture_assert_int_equal(tctx, r->in.enum_index, 0, "enum index");	torture_assert_int_equal(tctx, r->in.name->size, 1044, "name size");	torture_assert_int_equal(tctx, r->in.name->length, 0, "name len");	torture_assert(tctx, r->in.keyclass != NULL, "keyclass pointer");	torture_assert(tctx, r->in.keyclass->name == NULL, "keyclass");	torture_assert(tctx, r->in.last_changed_time != NULL, "last_changed_time != NULL");	return true;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:10,


示例21: notifychangekeyvalue_in_check

static bool notifychangekeyvalue_in_check(struct torture_context *tctx, struct winreg_NotifyChangeKeyValue *r){	torture_assert_int_equal(tctx, r->in.watch_subtree, 1, "watch subtree");	torture_assert_int_equal(tctx, r->in.notify_filter, 0, "notify filter");	torture_assert_int_equal(tctx, r->in.unknown, 0, "unknown");	torture_assert(tctx, r->in.string1.name == NULL, "string1");	torture_assert(tctx, r->in.string2.name == NULL, "string2");	torture_assert_int_equal(tctx, r->in.unknown2, 0, "unknown2");	return true;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:10,


示例22: createkey_out_check

static bool createkey_out_check(struct torture_context *tctx, 								  struct winreg_CreateKey *r){	torture_assert(tctx, GUID_all_zero(&r->out.new_handle->uuid), "new_handle");	torture_assert(tctx, r->out.action_taken == NULL, "action_taken pointer");	torture_assert_werr_equal(tctx, r->out.result, WERR_INVALID_PARAM, 							  "return code");	return true;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:10,


示例23: test_lp_parm_bool

static bool test_lp_parm_bool(struct torture_context *tctx){	struct loadparm_context *lp_ctx = loadparm_init(tctx);	torture_assert(tctx, lpcfg_set_option(lp_ctx, "some:thing=true"), "lpcfg_set_option failed");	torture_assert(tctx, lpcfg_parm_bool(lp_ctx, NULL, "some", "thing", false) == true,				 "invalid parametric option");	torture_assert(tctx, lpcfg_parm_bool(lp_ctx, NULL, "some", "bla", true) == true,				 "invalid parametric option");	return true;}
开发者ID:srimalik,项目名称:samba,代码行数:10,


示例24: torture_unlinktest

/*  This test checks that   1) the server does not allow an unlink on a file that is open*/BOOL torture_unlinktest(struct torture_context *tctx, struct smbcli_state *cli){	const char *fname = BASEDIR "//unlink.tst";	int fnum;	BOOL correct = True;	union smb_open io;	NTSTATUS status;	torture_assert(tctx, torture_setup_dir(cli, BASEDIR), 				   talloc_asprintf(tctx, "Failed setting up %s", BASEDIR));	cli->session->pid = 1;	torture_comment(tctx, "Opening a file/n");	fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);	torture_assert(tctx, fnum != -1, talloc_asprintf(tctx, "open of %s failed (%s)", fname, smbcli_errstr(cli->tree)));	torture_comment(tctx, "Unlinking a open file/n");	torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_unlink(cli->tree, fname)),		"server allowed unlink on an open file");		correct = check_error(__location__, cli, ERRDOS, ERRbadshare, 				      NT_STATUS_SHARING_VIOLATION);	smbcli_close(cli->tree, fnum);	smbcli_unlink(cli->tree, fname);	torture_comment(tctx, "testing unlink after ntcreatex with DELETE access/n");	io.ntcreatex.level = RAW_OPEN_NTCREATEX;	io.ntcreatex.in.root_fid = 0;	io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;	io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;	io.ntcreatex.in.file_attr = 0;	io.ntcreatex.in.alloc_size = 0;	io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;	io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION;	io.ntcreatex.in.security_flags = 0;	io.ntcreatex.in.fname = fname;	io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE;	io.ntcreatex.in.access_mask  = SEC_RIGHTS_FILE_ALL;	status = smb_raw_open(cli->tree, cli, &io);	torture_assert_ntstatus_ok(tctx, status, talloc_asprintf(tctx, "failed to open %s", fname));	torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_unlink(cli->tree, fname)),		"server allowed unlink on an open file");	correct = check_error(__location__, cli, ERRDOS, ERRbadshare, 				      NT_STATUS_SHARING_VIOLATION);	return correct;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:60,


示例25: queryinfokey_out_check

static bool queryinfokey_out_check(struct torture_context *tctx, struct winreg_QueryInfoKey *r){	torture_assert(tctx, r->out.classname != NULL, "class out");	torture_assert(tctx, r->out.classname->name != NULL, "class out name");	torture_assert_str_equal(tctx, r->out.classname->name, "", "class out name");	torture_assert_int_equal(tctx, *r->out.num_subkeys, 0, "num subkeys");	torture_assert_int_equal(tctx, *r->out.max_subkeylen, 0, "subkey length");	torture_assert_int_equal(tctx, *r->out.max_classlen, 140, "subkey size");	torture_assert_werr_ok(tctx, r->out.result, "return code");	return true;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:11,


示例26: test_next_token_quote_wrong

static bool test_next_token_quote_wrong(struct torture_context *tctx){	const char *teststr = "/"foo bar bla";	char buf[20];	torture_assert(tctx, next_token(&teststr, buf, " ", 20), "finding token works");	torture_assert_str_equal(tctx, buf, "foo bar bla", "token matches");	torture_assert_str_equal(tctx, teststr, "", "ptr modified correctly");	torture_assert(tctx, !next_token(&teststr, buf, " ", 20), "finding token doesn't work");	return true;}
开发者ID:DanilKorotenko,项目名称:samba,代码行数:11,


示例27: jobenum_in_check

static bool jobenum_in_check(struct torture_context *tctx, 							 struct atsvc_JobEnum *r){	torture_assert(tctx, r->in.servername != NULL, "servername ptr");	torture_assert_str_equal(tctx, r->in.servername, "WIN2KDC1", "servername");	torture_assert_int_equal(tctx, r->in.ctr->entries_read, 0, "ctr entries read");	torture_assert(tctx, r->in.ctr->first_entry == NULL, "ctr entries first_entry");	torture_assert_int_equal(tctx, r->in.preferred_max_len, -1, "preferred max len");	torture_assert(tctx, r->in.resume_handle != NULL, "resume handle ptr");	torture_assert_int_equal(tctx, *r->in.resume_handle, 0, "resume handle");	return true;}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:12,


示例28: createkey_in_check

static bool createkey_in_check(struct torture_context *tctx, 								  struct winreg_CreateKey *r){	torture_assert_str_equal(tctx, r->in.name.name, "spottyfoot", "name");	torture_assert(tctx, r->in.keyclass.name == NULL, "keyclass");	torture_assert_int_equal(tctx, r->in.options, 0, "option");	torture_assert_int_equal(tctx, r->in.access_mask, 0x2000000, "access mask");	torture_assert(tctx, r->in.secdesc == NULL, "secdesc");	torture_assert(tctx, r->in.action_taken == NULL, "action_taken");	return true;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:12,


示例29: torture_rpc_spoolss_access_teardown_common

static bool torture_rpc_spoolss_access_teardown_common(struct torture_context *tctx, struct torture_access_context *t){    if (t->user.testuser) {        torture_leave_domain(tctx, t->user.testuser);    }    /* remove membership ? */    if (t->user.num_builtin_memberships) {    }    /* remove privs ? */    if (t->user.num_privs) {    }    /* restore sd */    if (t->user.sd && t->printername) {        struct policy_handle handle;        struct spoolss_SetPrinterInfoCtr info_ctr;        struct spoolss_SetPrinterInfo3 info3;        struct spoolss_DevmodeContainer devmode_ctr;        struct sec_desc_buf secdesc_ctr;        struct dcerpc_pipe *spoolss_pipe;        struct dcerpc_binding_handle *b;        torture_assert_ntstatus_ok(tctx,                                   torture_rpc_connection(tctx, &spoolss_pipe, &ndr_table_spoolss),                                   "Error connecting to server");        b = spoolss_pipe->binding_handle;        ZERO_STRUCT(info_ctr);        ZERO_STRUCT(info3);        ZERO_STRUCT(devmode_ctr);        ZERO_STRUCT(secdesc_ctr);        info_ctr.level = 3;        info_ctr.info.info3 = &info3;        secdesc_ctr.sd = t->sd_orig;        torture_assert(tctx,                       test_openprinter_handle(tctx, spoolss_pipe, "", t->printername, "", SEC_FLAG_MAXIMUM_ALLOWED, WERR_OK, &handle),                       "failed to open printer");        torture_assert(tctx,                       test_SetPrinter(tctx, b, &handle, &info_ctr, &devmode_ctr, &secdesc_ctr, 0),                       "failed to set sd");        talloc_free(spoolss_pipe);    }    return true;}
开发者ID:rchicoli,项目名称:samba,代码行数:52,


示例30: torture_bench_treeconnect

/* Test the rate at which the server will accept connections.  */bool torture_bench_treeconnect(struct torture_context *tctx){	const char *host = torture_setting_string(tctx, "host", NULL);	const char *share = torture_setting_string(tctx, "share", NULL);	int timelimit = torture_setting_int(tctx, "timelimit",					TIME_LIMIT_SECS);	int nprocs = torture_setting_int(tctx, "nprocs", 4);	int *curr_counts = map_count_buffer(nprocs, sizeof(int));	int *last_counts = talloc_array(NULL, int, nprocs);	struct timeval now, last, start;	int i, delta;	torture_assert(tctx, nprocs > 0, "bad proc count");	torture_assert(tctx, timelimit > 0, "bad timelimit");	torture_assert(tctx, curr_counts, "allocation failure");	torture_assert(tctx, last_counts, "allocation failure");	start = last = timeval_current();	for (i = 0; i < nprocs; ++i) {		fork_tcon_client(tctx, &curr_counts[i], timelimit, host, share);	}	while (children_remain()) {		sleep(1);		now = timeval_current();		for (i = 0, delta = 0; i < nprocs; ++i) {			delta += curr_counts[i] - last_counts[i];		}		printf("%u connections/sec/n",			(unsigned)rate_convert_secs(delta, &last, &now));		memcpy(last_counts, curr_counts, nprocs * sizeof(int));		last = timeval_current();	}	now = timeval_current();	for (i = 0, delta = 0; i < nprocs; ++i) {		delta += curr_counts[i];	}	printf("TOTAL: %u connections/sec over %u secs/n",			(unsigned)rate_convert_secs(delta, &start, &now),			timelimit);	return true;}
开发者ID:AIdrifter,项目名称:samba,代码行数:53,



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


C++ torture_assert_int_equal函数代码示例
C++ tor_strdup函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。