本文整理汇总了C++中ABTS_STR_EQUAL函数的典型用法代码示例。如果您正苦于以下问题:C++ ABTS_STR_EQUAL函数的具体用法?C++ ABTS_STR_EQUAL怎么用?C++ ABTS_STR_EQUAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ABTS_STR_EQUAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_addr_info
static void test_addr_info(abts_case *tc, void *data)
{
apr_status_t rv;
apr_sockaddr_t *sa;
int rc;
rv = apr_sockaddr_info_get(&sa, NULL, APR_UNSPEC, 80, 0, p);
APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
rc = apr_sockaddr_is_wildcard(sa);
ABTS_INT_NEQUAL(tc, 0, rc);
rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_UNSPEC, 80, 0, p);
APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
ABTS_STR_EQUAL(tc, "127.0.0.1", sa->hostname);
rc = apr_sockaddr_is_wildcard(sa);
ABTS_INT_EQUAL(tc, 0, rc);
rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_UNSPEC, 0, 0, p);
APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
ABTS_STR_EQUAL(tc, "127.0.0.1", sa->hostname);
ABTS_INT_EQUAL(tc, 0, sa->port);
ABTS_INT_EQUAL(tc, 0, ntohs(sa->sa.sin.sin_port));
}
开发者ID:TaoheGit,项目名称:hmi_sdl_android,代码行数:25,代码来源:testsock.c
示例2: delete_key
static void delete_key(abts_case *tc, void *data)
{
apr_hash_t *h = NULL;
char *result = NULL;
h = apr_hash_make(p);
ABTS_PTR_NOTNULL(tc, h);
apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value");
apr_hash_set(h, "key2", APR_HASH_KEY_STRING, "value2");
result = apr_hash_get(h, "key", APR_HASH_KEY_STRING);
ABTS_STR_EQUAL(tc, "value", result);
result = apr_hash_get(h, "key2", APR_HASH_KEY_STRING);
ABTS_STR_EQUAL(tc, "value2", result);
apr_hash_set(h, "key", APR_HASH_KEY_STRING, NULL);
result = apr_hash_get(h, "key", APR_HASH_KEY_STRING);
ABTS_PTR_EQUAL(tc, NULL, result);
result = apr_hash_get(h, "key2", APR_HASH_KEY_STRING);
ABTS_STR_EQUAL(tc, "value2", result);
}
开发者ID:ohmann,项目名称:checkapi,代码行数:25,代码来源:testhash.c
示例3: optional_option_notgiven
static void optional_option_notgiven(abts_case *tc, void *data)
{
int largc = 2;
const char * const largv[] = {"testprog", "-a"};
apr_getopt_t *opt;
apr_status_t rv;
char ch;
const char *optarg;
char str[8196];
str[0] = '\0';
rv = apr_getopt_init(&opt, p, largc, largv);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
opt->errfn = unknown_arg;
opt->errarg = str;
while (apr_getopt(opt, "a::", &ch, &optarg) == APR_SUCCESS) {
switch (ch) {
case 'a':
format_arg(str, ch, optarg);
break;
default:
break;
}
}
#if 0
/* Our version of getopt doesn't allow for optional arguments. */
ABTS_STR_EQUAL(tc, "option: a\n", str);
#endif
ABTS_STR_EQUAL(tc, "testprog: option requires an argument -- a\n", str);
}
开发者ID:ohmann,项目名称:checkapi,代码行数:32,代码来源:testargs.c
示例4: test_print_addr
static void test_print_addr(abts_case *tc, void *data)
{
apr_sockaddr_t *sa;
apr_status_t rv;
char *s;
rv = apr_sockaddr_info_get(&sa, "0.0.0.0", APR_INET, 80, 0, p);
APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
s = apr_psprintf(p, "foo %pI bar", sa);
ABTS_STR_EQUAL(tc, "foo 0.0.0.0:80 bar", s);
#if APR_HAVE_IPV6
rv = apr_sockaddr_info_get(&sa, "::ffff:0.0.0.0", APR_INET6, 80, 0, p);
APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
if (rv == APR_SUCCESS)
ABTS_TRUE(tc, sa != NULL);
if (rv == APR_SUCCESS && sa) {
/* sa should now be a v4-mapped IPv6 address. */
char buf[128];
int rc;
rc = apr_sockaddr_is_wildcard(sa);
ABTS_INT_NEQUAL(tc, 0, rc);
memset(buf, 'z', sizeof buf);
APR_ASSERT_SUCCESS(tc, "could not get IP address",
apr_sockaddr_ip_getbuf(buf, 22, sa));
ABTS_STR_EQUAL(tc, "0.0.0.0", buf);
}
#endif
}
开发者ID:TaoheGit,项目名称:hmi_sdl_android,代码行数:35,代码来源:testsock.c
示例5: root_from_cwd_and_back
static void root_from_cwd_and_back(abts_case *tc, void *data)
{
apr_status_t rv;
const char *root = NULL;
const char *path = "//";
char *origpath;
char *testpath;
int hadfailed;
ABTS_INT_EQUAL(tc, APR_SUCCESS, apr_filepath_get(&origpath, 0, p));
path = origpath;
rv = apr_filepath_root(&root, &path, APR_FILEPATH_TRUENAME, p);
#if defined(WIN32) || defined(OS2)
hadfailed = tc->failed;
/* It appears some mingw/cygwin and more modern builds can return
* a lowercase drive designation, but we canonicalize to uppercase
*/
ABTS_INT_EQUAL(tc, toupper(origpath[0]), root[0]);
ABTS_INT_EQUAL(tc, ':', root[1]);
ABTS_INT_EQUAL(tc, '/', root[2]);
ABTS_INT_EQUAL(tc, 0, root[3]);
ABTS_STR_EQUAL(tc, origpath + 3, path);
#elif defined(NETWARE)
ABTS_INT_EQUAL(tc, origpath[0], root[0]);
{
char *pt = strchr(root, ':');
ABTS_PTR_NOTNULL(tc, pt);
ABTS_INT_EQUAL(tc, ':', pt[0]);
ABTS_INT_EQUAL(tc, '/', pt[1]);
ABTS_INT_EQUAL(tc, 0, pt[2]);
pt = strchr(origpath, ':');
ABTS_PTR_NOTNULL(tc, pt);
ABTS_STR_EQUAL(tc, (pt+2), path);
}
#else
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_STR_EQUAL(tc, "/", root);
ABTS_STR_EQUAL(tc, origpath + 1, path);
#endif
rv = apr_filepath_merge(&testpath, root, path,
APR_FILEPATH_TRUENAME
| APR_FILEPATH_NOTABOVEROOT
| APR_FILEPATH_NOTRELATIVE, p);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
hadfailed = tc->failed;
/* The API doesn't promise equality!!!
* apr_filepath_get never promised a canonical filepath.
* We'll emit noise under verbose so the user is aware,
* but translate this back to success.
*/
ABTS_STR_EQUAL(tc, origpath, testpath);
#if defined(WIN32) || defined(OS2) || defined(NETWARE)
if (!hadfailed) tc->failed = 0;
#endif
}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:57,代码来源:testnames.c
示例6: int64_t_fmt
static void int64_t_fmt(abts_case *tc, void *data)
{
char buf[100];
apr_int64_t var = 0;
sprintf(buf, "%" APR_INT64_T_FMT, var);
ABTS_STR_EQUAL(tc, "0", buf);
apr_snprintf(buf, sizeof(buf), "%" APR_INT64_T_FMT, var);
ABTS_STR_EQUAL(tc, "0", buf);
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:10,代码来源:testfmt.c
示例7: uint64_t_hex_fmt
static void uint64_t_hex_fmt(abts_case *tc, void *data)
{
char buf[100];
apr_uint64_t var = APR_UINT64_C(14000000);
sprintf(buf, "%" APR_UINT64_T_HEX_FMT, var);
ABTS_STR_EQUAL(tc, "d59f80", buf);
apr_snprintf(buf, sizeof(buf), "%" APR_UINT64_T_HEX_FMT, var);
ABTS_STR_EQUAL(tc, "d59f80", buf);
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:10,代码来源:testfmt.c
示例8: test_seek
static void test_seek(abts_case *tc, void *data)
{
apr_status_t rv;
apr_off_t offset = 5;
apr_size_t nbytes = 256;
char *str = apr_pcalloc(p, nbytes + 1);
apr_file_t *filetest = NULL;
rv = apr_file_open(&filetest, FILENAME,
APR_READ,
APR_UREAD | APR_UWRITE | APR_GREAD, p);
APR_ASSERT_SUCCESS(tc, "Open test file " FILENAME, rv);
rv = apr_file_read(filetest, str, &nbytes);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, strlen(TESTSTR), nbytes);
ABTS_STR_EQUAL(tc, TESTSTR, str);
memset(str, 0, nbytes + 1);
rv = apr_file_seek(filetest, SEEK_SET, &offset);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
rv = apr_file_read(filetest, str, &nbytes);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, strlen(TESTSTR) - 5, nbytes);
ABTS_STR_EQUAL(tc, TESTSTR + 5, str);
apr_file_close(filetest);
/* Test for regression of sign error bug with SEEK_END and
buffered files. */
rv = apr_file_open(&filetest, FILENAME,
APR_READ | APR_BUFFERED,
APR_UREAD | APR_UWRITE | APR_GREAD, p);
APR_ASSERT_SUCCESS(tc, "Open test file " FILENAME, rv);
offset = -5;
rv = apr_file_seek(filetest, SEEK_END, &offset);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, strlen(TESTSTR) - 5, nbytes);
memset(str, 0, nbytes + 1);
nbytes = 256;
rv = apr_file_read(filetest, str, &nbytes);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, 5, nbytes);
ABTS_STR_EQUAL(tc, TESTSTR + strlen(TESTSTR) - 5, str);
apr_file_close(filetest);
}
开发者ID:aptana,项目名称:Jaxer,代码行数:51,代码来源:testfile.c
示例9: hash_traverse
/* This is kind of a hack, but I am just keeping an existing test. This is
* really testing apr_hash_first, apr_hash_next, and apr_hash_this which
* should be tested in three separate tests, but this will do for now.
*/
static void hash_traverse(abts_case *tc, void *data)
{
apr_hash_t *h;
char StrArray[MAX_DEPTH][MAX_LTH];
h = apr_hash_make(p);
ABTS_PTR_NOTNULL(tc, h);
apr_hash_set(h, "OVERWRITE", APR_HASH_KEY_STRING, "should not see this");
apr_hash_set(h, "FOO3", APR_HASH_KEY_STRING, "bar3");
apr_hash_set(h, "FOO3", APR_HASH_KEY_STRING, "bar3");
apr_hash_set(h, "FOO1", APR_HASH_KEY_STRING, "bar1");
apr_hash_set(h, "FOO2", APR_HASH_KEY_STRING, "bar2");
apr_hash_set(h, "FOO4", APR_HASH_KEY_STRING, "bar4");
apr_hash_set(h, "SAME1", APR_HASH_KEY_STRING, "same");
apr_hash_set(h, "SAME2", APR_HASH_KEY_STRING, "same");
apr_hash_set(h, "OVERWRITE", APR_HASH_KEY_STRING, "Overwrite key");
dump_hash(p, h, StrArray);
ABTS_STR_EQUAL(tc, "Key FOO1 (4) Value bar1\n", StrArray[0]);
ABTS_STR_EQUAL(tc, "Key FOO2 (4) Value bar2\n", StrArray[1]);
ABTS_STR_EQUAL(tc, "Key FOO3 (4) Value bar3\n", StrArray[2]);
ABTS_STR_EQUAL(tc, "Key FOO4 (4) Value bar4\n", StrArray[3]);
ABTS_STR_EQUAL(tc, "Key OVERWRITE (9) Value Overwrite key\n", StrArray[4]);
ABTS_STR_EQUAL(tc, "Key SAME1 (5) Value same\n", StrArray[5]);
ABTS_STR_EQUAL(tc, "Key SAME2 (5) Value same\n", StrArray[6]);
ABTS_STR_EQUAL(tc, "#entries 7\n", StrArray[7]);
}
开发者ID:ohmann,项目名称:checkapi,代码行数:33,代码来源:testhash.c
示例10: optional_option
static void optional_option(abts_case *tc, void *data)
{
int largc = 3;
const char * const largv[] = {"testprog", "-a", "foo"};
apr_getopt_t *opt;
apr_status_t rv;
char ch;
const char *optarg;
char str[8196];
str[0] = '\0';
rv = apr_getopt_init(&opt, p, largc, largv);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
opt->errfn = unknown_arg;
opt->errarg = str;
while (apr_getopt(opt, "a::", &ch, &optarg) == APR_SUCCESS) {
switch (ch) {
case 'a':
format_arg(str, ch, optarg);
break;
default:
break;
}
}
ABTS_STR_EQUAL(tc, "option: a with foo\n", str);
}
开发者ID:ohmann,项目名称:checkapi,代码行数:28,代码来源:testargs.c
示例11: overlay_same
static void overlay_same(abts_case *tc, void *data)
{
apr_hash_t *base = NULL;
apr_hash_t *result = NULL;
int count;
char str[8196];
base = apr_hash_make(p);
ABTS_PTR_NOTNULL(tc, base);
apr_hash_set(base, "base1", APR_HASH_KEY_STRING, "value1");
apr_hash_set(base, "base2", APR_HASH_KEY_STRING, "value2");
apr_hash_set(base, "base3", APR_HASH_KEY_STRING, "value3");
apr_hash_set(base, "base4", APR_HASH_KEY_STRING, "value4");
apr_hash_set(base, "base5", APR_HASH_KEY_STRING, "value5");
result = apr_hash_overlay(p, base, base);
count = apr_hash_count(result);
ABTS_INT_EQUAL(tc, 5, count);
dump_hash(p, result, str);
/* I don't know why these are out of order, but they are. I would probably
* consider this a bug, but others should comment.
*/
ABTS_STR_EQUAL(tc, "Key base5 (5) Value value5\n"
"Key base1 (5) Value value1\n"
"Key base2 (5) Value value2\n"
"Key base3 (5) Value value3\n"
"Key base4 (5) Value value4\n"
"#entries 5\n", str);
}
开发者ID:TaoheGit,项目名称:hmi_sdl_android,代码行数:32,代码来源:testhash.c
示例12: test_dbd_sqlite3
static void test_dbd_sqlite3(abts_case *tc, void *data)
{
apr_pool_t *pool = p;
apr_status_t rv;
const apr_dbd_driver_t* driver = NULL;
apr_dbd_t* handle = NULL;
rv = apr_dbd_get_driver(pool, "sqlite3", &driver);
ABTS_ASSERT(tc, "failed to fetch sqlite3 driver", rv == APR_SUCCESS);
ABTS_PTR_NOTNULL(tc, driver);
if (!driver) {
return;
}
ABTS_STR_EQUAL(tc, "sqlite3", apr_dbd_name(driver));
rv = apr_dbd_open(driver, pool, "data/sqlite3.db", &handle);
ABTS_ASSERT(tc, "failed to open sqlite3 database", rv == APR_SUCCESS);
ABTS_PTR_NOTNULL(tc, handle);
if (!handle) {
return;
}
test_dbd_generic(tc, handle, driver);
}
开发者ID:0jpq0,项目名称:kbengine,代码行数:25,代码来源:testdbd.c
示例13: read_write_notimeout
static void read_write_notimeout(abts_case *tc, void *data)
{
apr_status_t rv;
char *buf = "this is a test";
char *input;
apr_size_t nbytes;
nbytes = strlen("this is a test");
rv = apr_file_pipe_create(&readp, &writep, p);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_PTR_NOTNULL(tc, readp);
ABTS_PTR_NOTNULL(tc, writep);
rv = apr_file_write(writep, buf, &nbytes);
ABTS_INT_EQUAL(tc, strlen("this is a test"), nbytes);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
nbytes = 256;
input = apr_pcalloc(p, nbytes + 1);
rv = apr_file_read(readp, input, &nbytes);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, strlen("this is a test"), nbytes);
ABTS_STR_EQUAL(tc, "this is a test", input);
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:25,代码来源:testpipe.c
示例14: test_badmask_str
static void test_badmask_str(abts_case *tc, void *data)
{
char buf[128];
ABTS_STR_EQUAL(tc, apr_strerror(APR_EBADMASK, buf, sizeof buf),
"The specified network mask is invalid.");
}
开发者ID:AAthresh,项目名称:quantlib,代码行数:7,代码来源:testipsub.c
示例15: test_badip_str
static void test_badip_str(abts_case *tc, void *data)
{
char buf[128];
ABTS_STR_EQUAL(tc, apr_strerror(APR_EBADIP, buf, sizeof buf),
"The specified IP address is invalid.");
}
开发者ID:AAthresh,项目名称:quantlib,代码行数:7,代码来源:testipsub.c
示例16: test_escape
static void test_escape(abts_case *tc, apr_dbd_t *handle,
const apr_dbd_driver_t *driver)
{
const char *escaped = apr_dbd_escape(driver, p, "foo'bar", handle);
ABTS_STR_EQUAL(tc, "foo''bar", escaped);
}
开发者ID:cookrn,项目名称:openamq,代码行数:7,代码来源:testdbd.c
示例17: test_dso_sym
static void test_dso_sym(abts_case *tc, void *data)
{
apr_dso_handle_t *h = NULL;
apr_dso_handle_sym_t func1 = NULL;
apr_status_t status;
void (*function)(char str[256]);
char teststr[256];
char errstr[256];
status = apr_dso_load(&h, modname, p);
ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status);
ABTS_PTR_NOTNULL(tc, h);
status = apr_dso_sym(&func1, h, "print_hello");
ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status);
ABTS_PTR_NOTNULL(tc, func1);
if (!tc->failed) {
function = (void (*)(char *))func1;
(*function)(teststr);
ABTS_STR_EQUAL(tc, "Hello - I'm a DSO!\n", teststr);
}
apr_dso_unload(h);
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:25,代码来源:testdso.c
示例18: string_strfsize
static void string_strfsize(abts_case *tc, void *data)
{
static const struct {
apr_off_t size;
const char *buf;
} ts[] = {
{ -1, " - " },
{ 0, " 0 " },
{ 666, "666 " },
{ 1024, "1.0K" },
{ 1536, "1.5K" },
{ 2048, "2.0K" },
{ 1293874, "1.2M" },
{ 9999999, "9.5M" },
{ 103809024, " 99M" },
{ 1047527424, "1.0G" } /* "999M" would be more correct */
};
apr_size_t n;
for (n = 0; n < sizeof(ts)/sizeof(ts[0]); n++) {
char buf[6], *ret;
buf[5] = '%';
ret = apr_strfsize(ts[n].size, buf);
ABTS_ASSERT(tc, "strfsize returned wrong buffer", ret == buf);
ABTS_ASSERT(tc, "strfsize overflowed", buf[5] == '%');
ABTS_STR_EQUAL(tc, ts[n].buf, ret);
}
}
开发者ID:ohmann,项目名称:checkapi,代码行数:31,代码来源:teststr.c
示例19: overlay_empty
static void overlay_empty(abts_case *tc, void *data)
{
apr_hash_t *base = NULL;
apr_hash_t *overlay = NULL;
apr_hash_t *result = NULL;
int count;
char str[8196];
base = apr_hash_make(p);
overlay = apr_hash_make(p);
ABTS_PTR_NOTNULL(tc, base);
ABTS_PTR_NOTNULL(tc, overlay);
apr_hash_set(base, "key1", APR_HASH_KEY_STRING, "value1");
apr_hash_set(base, "key2", APR_HASH_KEY_STRING, "value2");
apr_hash_set(base, "key3", APR_HASH_KEY_STRING, "value3");
apr_hash_set(base, "key4", APR_HASH_KEY_STRING, "value4");
apr_hash_set(base, "key5", APR_HASH_KEY_STRING, "value5");
result = apr_hash_overlay(p, overlay, base);
count = apr_hash_count(result);
ABTS_INT_EQUAL(tc, 5, count);
dump_hash(p, result, str);
ABTS_STR_EQUAL(tc, "Key key1 (4) Value value1\n"
"Key key2 (4) Value value2\n"
"Key key3 (4) Value value3\n"
"Key key4 (4) Value value4\n"
"Key key5 (4) Value value5\n"
"#entries 5\n", str);
}
开发者ID:TaoheGit,项目名称:hmi_sdl_android,代码行数:32,代码来源:testhash.c
示例20: test_strtok
static void test_strtok(abts_case *tc, void *data)
{
struct {
char *input;
char *sep;
}
cases[] = {
{
"",
"Z"
},
{
" asdf jkl; 77889909 \r\n\1\2\3Z",
" \r\n\3\2\1"
},
{
NULL, /* but who cares if apr_strtok() segfaults? */
" \t"
},
#if 0 /* don't do this... you deserve to segfault */
{
"a b c ",
NULL
},
#endif
{
" a b c ",
""
},
{
"a b c ",
" "
}
};
int curtc;
for (curtc = 0; curtc < sizeof cases / sizeof cases[0]; curtc++) {
char *retval1, *retval2;
char *str1, *str2;
char *state;
str1 = apr_pstrdup(p, cases[curtc].input);
str2 = apr_pstrdup(p, cases[curtc].input);
do {
retval1 = apr_strtok(str1, cases[curtc].sep, &state);
retval2 = strtok(str2, cases[curtc].sep);
if (!retval1) {
ABTS_TRUE(tc, retval2 == NULL);
}
else {
ABTS_TRUE(tc, retval2 != NULL);
ABTS_STR_EQUAL(tc, retval2, retval1);
}
str1 = str2 = NULL; /* make sure we pass NULL on subsequent calls */
} while (retval1);
}
}
开发者ID:ohmann,项目名称:checkapi,代码行数:60,代码来源:teststr.c
注:本文中的ABTS_STR_EQUAL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论