当前位置: 首页>>代码示例>>C++>>正文


C++ ABTS_STR_EQUAL函数代码示例

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


在下文中一共展示了ABTS_STR_EQUAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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