这篇教程C++ ABTS_PTR_NOTNULL函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ABTS_PTR_NOTNULL函数的典型用法代码示例。如果您正苦于以下问题:C++ ABTS_PTR_NOTNULL函数的具体用法?C++ ABTS_PTR_NOTNULL怎么用?C++ ABTS_PTR_NOTNULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ABTS_PTR_NOTNULL函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: read_write_notimeoutstatic 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,
示例2: broadcast_threadsstatic void broadcast_threads(abts_case *tc, void *data){ toolbox_t box; unsigned int i; apr_status_t rv; apr_uint32_t count = 0; apr_thread_cond_t *cond = NULL; apr_thread_mutex_t *mutex = NULL; apr_thread_t *thread[NTHREADS]; rv = apr_thread_cond_create(&cond, p); ABTS_SUCCESS(rv); ABTS_PTR_NOTNULL(tc, cond); rv = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, p); ABTS_SUCCESS(rv); ABTS_PTR_NOTNULL(tc, mutex); rv = apr_thread_mutex_lock(mutex); ABTS_SUCCESS(rv); box.tc = tc; box.data = &count; box.mutex = mutex; box.cond = cond; box.func = lock_and_wait; for (i = 0; i < NTHREADS; i++) { rv = apr_thread_create(&thread[i], NULL, thread_routine, &box, p); ABTS_SUCCESS(rv); } do { rv = apr_thread_mutex_unlock(mutex); ABTS_SUCCESS(rv); apr_sleep(100000); rv = apr_thread_mutex_lock(mutex); ABTS_SUCCESS(rv); } while (apr_atomic_read32(&count) != NTHREADS); rv = apr_thread_cond_broadcast(cond); ABTS_SUCCESS(rv); rv = apr_thread_mutex_unlock(mutex); ABTS_SUCCESS(rv); for (i = 0; i < NTHREADS; i++) { apr_status_t retval; rv = apr_thread_join(&retval, thread[i]); ABTS_SUCCESS(rv); } ABTS_INT_EQUAL(tc, 0, count); rv = apr_thread_cond_destroy(cond); ABTS_SUCCESS(rv); rv = apr_thread_mutex_destroy(mutex); ABTS_SUCCESS(rv);}
开发者ID:ohmann,项目名称:checkapi,代码行数:60,
示例3: merge_lowercasedrivestatic void merge_lowercasedrive(abts_case *tc, void *data){ char current_dir[1024]; char current_dir_on_C[1024]; char *dir_on_c; char *testdir; apr_status_t rv; /* Change the current directory on C: from something like "C:/dir" to something like "c:/dir" to replicate the failing case. */ ABTS_PTR_NOTNULL(tc, _getcwd(current_dir, sizeof(current_dir))); /* 3 stands for drive C: */ ABTS_PTR_NOTNULL(tc, _getdcwd(3, current_dir_on_C, sizeof(current_dir_on_C))); /* Use the same path, but now with a lower case driveletter */ dir_on_c = apr_pstrdup(p, current_dir_on_C); dir_on_c[0] = (char)tolower(dir_on_c[0]); chdir(dir_on_c); /* Now merge a drive relative path with an upper case drive letter. */ rv = apr_filepath_merge(&testdir, NULL, "C:hi", APR_FILEPATH_NOTRELATIVE, p); /* Change back to original directory for next tests */ chdir("C://"); /* Switch to upper case */ chdir(current_dir_on_C); /* Switch cwd on C: */ chdir(current_dir); /* Switch back to original cwd */ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);}
开发者ID:Kiddinglife,项目名称:geco-game-engine,代码行数:33,
示例4: test_dup2static void test_dup2(abts_case *tc, void *data){ apr_file_t *testfile = NULL; apr_file_t *errfile = NULL; apr_file_t *saveerr = NULL; apr_status_t rv; rv = apr_file_open(&testfile, FILEPATH "testdup2.file", APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_DELONCLOSE, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, testfile); rv = apr_file_open_stderr(&errfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Set aside the real errfile */ rv = apr_file_dup(&saveerr, errfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, saveerr); rv = apr_file_dup2(errfile, testfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, errfile); apr_file_close(testfile); rv = apr_file_dup2(errfile, saveerr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, errfile); apr_file_close(saveerr);}
开发者ID:Ga-vin,项目名称:apache,代码行数:33,
示例5: test_file_dupstatic void test_file_dup(abts_case *tc, void *data){ apr_file_t *file1 = NULL; apr_file_t *file3 = NULL; apr_status_t rv; apr_finfo_t finfo; /* First, create a new file, empty... */ rv = apr_file_open(&file1, FILEPATH "testdup.file", APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_DELONCLOSE, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, file1); rv = apr_file_dup(&file3, file1, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, file3); rv = apr_file_close(file1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* cleanup after ourselves */ rv = apr_file_close(file3); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_stat(&finfo, FILEPATH "testdup.file", APR_FINFO_NORM, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv));}
开发者ID:Ga-vin,项目名称:apache,代码行数:27,
示例6: test_dbd_sqlite3static 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,
示例7: test_dso_symstatic 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,
示例8: overlay_emptystatic 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 StrArray[MAX_DEPTH][MAX_LTH]; 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, StrArray); ABTS_STR_EQUAL(tc, "Key key1 (4) Value value1/n", StrArray[0]); ABTS_STR_EQUAL(tc, "Key key2 (4) Value value2/n", StrArray[1]); ABTS_STR_EQUAL(tc, "Key key3 (4) Value value3/n", StrArray[2]); ABTS_STR_EQUAL(tc, "Key key4 (4) Value value4/n", StrArray[3]); ABTS_STR_EQUAL(tc, "Key key5 (4) Value value5/n", StrArray[4]); ABTS_STR_EQUAL(tc, "#entries 5/n", StrArray[5]);}
开发者ID:ohmann,项目名称:checkapi,代码行数:33,
示例9: pollcb_defaultstatic void pollcb_default(abts_case *tc, void *data){ apr_status_t rv1, rv2; apr_pollcb_t *pollcb; /* verify that APR will successfully create a pollcb if an invalid method * is specified as long as APR_POLLSET_NODEFAULT isn't specified * (no platform has both APR_POLLSET_PORT and APR_POLLSET_KQUEUE, so at * least one create call will succeed after having to switch to the default * type) */ rv1 = apr_pollcb_create_ex(&pollcb, 1, p, 0, APR_POLLSET_PORT); if (rv1 == APR_ENOTIMPL) { ABTS_NOT_IMPL(tc, "pollcb interface not supported"); return; } ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); ABTS_PTR_NOTNULL(tc, pollcb); rv1 = apr_pollcb_create_ex(&pollcb, 1, p, 0, APR_POLLSET_KQUEUE); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); ABTS_PTR_NOTNULL(tc, pollcb); /* verify that APR will fail to create a pollcb if an invalid method is * specified along with APR_POLLSET_NODEFAULT * (no platform has both APR_POLLSET_PORT and APR_POLLSET_KQUEUE, so at * least one create call will fail since it can't switch to the default * type) */ rv1 = apr_pollcb_create_ex(&pollcb, 1, p, APR_POLLSET_NODEFAULT, APR_POLLSET_PORT); if (rv1 == APR_SUCCESS) { ABTS_PTR_NOTNULL(tc, pollcb); } rv2 = apr_pollcb_create_ex(&pollcb, 1, p, APR_POLLSET_NODEFAULT, APR_POLLSET_KQUEUE); if (rv2 == APR_SUCCESS) { ABTS_PTR_NOTNULL(tc, pollcb); } ABTS_ASSERT(tc, "failure using APR_POLLSET_NODEFAULT with unsupported method", rv1 != APR_SUCCESS || rv2 != APR_SUCCESS); /* verify basic behavior for another method fallback case (this caused * APR to crash before r834029) */ rv1 = apr_pollcb_create_ex(&pollcb, 1, p, 0, APR_POLLSET_POLL); if (rv1 != APR_ENOTIMPL) { ABTS_INT_EQUAL(tc, rv1, APR_SUCCESS); ABTS_PTR_NOTNULL(tc, pollcb); }}
开发者ID:Ga-vin,项目名称:apache,代码行数:58,
示例10: create_pipestatic void create_pipe(abts_case *tc, void *data){ apr_status_t rv; 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);}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:9,
示例11: root_from_cwd_and_backstatic 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,
示例12: test_mmap_contentsstatic void test_mmap_contents(abts_case *tc, void *data){ ABTS_PTR_NOTNULL(tc, themmap); ABTS_PTR_NOTNULL(tc, themmap->mm); ABTS_SIZE_EQUAL(tc, thisfsize, themmap->size); /* Must use nEquals since the string is not guaranteed to be NULL terminated */ ABTS_STR_NEQUAL(tc, themmap->mm, TEST_STRING, thisfsize);}
开发者ID:Arcterus,项目名称:MoarVM,代码行数:10,
示例13: test_strstatic void test_str(abts_case *tc, void *data){ apr_pool_t *pool = p; const apr_strmatch_pattern *pattern; const apr_strmatch_pattern *pattern_nocase; const apr_strmatch_pattern *pattern_onechar; const apr_strmatch_pattern *pattern_zero; const char *match = NULL; const char *input1 = "string that contains a patterN..."; const char *input2 = "string that contains a pattern..."; const char *input3 = "pattern at the start of a string"; const char *input4 = "string that ends with a pattern"; const char *input5 = "patter/200n not found, negative chars in input"; const char *input6 = "patter/200n, negative chars, contains pattern..."; pattern = apr_strmatch_precompile(pool, "pattern", 1); ABTS_PTR_NOTNULL(tc, pattern); pattern_nocase = apr_strmatch_precompile(pool, "pattern", 0); ABTS_PTR_NOTNULL(tc, pattern_nocase); pattern_onechar = apr_strmatch_precompile(pool, "g", 0); ABTS_PTR_NOTNULL(tc, pattern_onechar); pattern_zero = apr_strmatch_precompile(pool, "", 0); ABTS_PTR_NOTNULL(tc, pattern_zero); match = apr_strmatch(pattern, input1, strlen(input1)); ABTS_PTR_EQUAL(tc, match, NULL); match = apr_strmatch(pattern, input2, strlen(input2)); ABTS_PTR_EQUAL(tc, match, input2 + 23); match = apr_strmatch(pattern_onechar, input1, strlen(input1)); ABTS_PTR_EQUAL(tc, match, input1 + 5); match = apr_strmatch(pattern_zero, input1, strlen(input1)); ABTS_PTR_EQUAL(tc, match, input1); match = apr_strmatch(pattern_nocase, input1, strlen(input1)); ABTS_PTR_EQUAL(tc, match, input1 + 23); match = apr_strmatch(pattern, input3, strlen(input3)); ABTS_PTR_EQUAL(tc, match, input3); match = apr_strmatch(pattern, input4, strlen(input4)); ABTS_PTR_EQUAL(tc, match, input4 + 24); match = apr_strmatch(pattern, input5, strlen(input5)); ABTS_PTR_EQUAL(tc, match, NULL); match = apr_strmatch(pattern, input6, strlen(input6)); ABTS_PTR_EQUAL(tc, match, input6 + 35);}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:54,
示例14: test_condstatic void test_cond(abts_case *tc, void *data){ apr_thread_t *p1, *p2, *p3, *p4, *c1; apr_status_t s0, s1, s2, s3, s4; int count1, count2, count3, count4; int sum; APR_ASSERT_SUCCESS(tc, "create put mutex", apr_thread_mutex_create(&put.mutex, APR_THREAD_MUTEX_DEFAULT, p)); ABTS_PTR_NOTNULL(tc, put.mutex); APR_ASSERT_SUCCESS(tc, "create nready mutex", apr_thread_mutex_create(&nready.mutex, APR_THREAD_MUTEX_DEFAULT, p)); ABTS_PTR_NOTNULL(tc, nready.mutex); APR_ASSERT_SUCCESS(tc, "create condvar", apr_thread_cond_create(&nready.cond, p)); ABTS_PTR_NOTNULL(tc, nready.cond); count1 = count2 = count3 = count4 = 0; put.nput = put.nval = 0; nready.nready = 0; i = 0; x = 0; s0 = apr_thread_create(&p1, NULL, thread_cond_producer, &count1, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s0); s1 = apr_thread_create(&p2, NULL, thread_cond_producer, &count2, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s1); s2 = apr_thread_create(&p3, NULL, thread_cond_producer, &count3, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s2); s3 = apr_thread_create(&p4, NULL, thread_cond_producer, &count4, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s3); s4 = apr_thread_create(&c1, NULL, thread_cond_consumer, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s4); apr_thread_join(&s0, p1); apr_thread_join(&s1, p2); apr_thread_join(&s2, p3); apr_thread_join(&s3, p4); apr_thread_join(&s4, c1); APR_ASSERT_SUCCESS(tc, "destroy condvar", apr_thread_cond_destroy(nready.cond)); sum = count1 + count2 + count3 + count4; /* printf("count1 = %d count2 = %d count3 = %d count4 = %d/n", count1, count2, count3, count4); */ ABTS_INT_EQUAL(tc, MAX_COUNTER, sum);}
开发者ID:skizhak,项目名称:open-media-flow-controller,代码行数:54,
示例15: test_dup2_readwritestatic void test_dup2_readwrite(abts_case *tc, void *data){ apr_file_t *errfile = NULL; apr_file_t *testfile = NULL; apr_file_t *saveerr = NULL; apr_status_t rv; apr_size_t txtlen = sizeof(TEST); char buff[50]; apr_off_t fpos; rv = apr_file_open(&testfile, FILEPATH "testdup2.readwrite.file", APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_DELONCLOSE, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, testfile); rv = apr_file_open_stderr(&errfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Set aside the real errfile */ rv = apr_file_dup(&saveerr, errfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, saveerr); rv = apr_file_dup2(errfile, testfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, errfile); txtlen = sizeof(TEST2); rv = apr_file_write(errfile, TEST2, &txtlen); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_SIZE_EQUAL(tc, sizeof(TEST2), txtlen); fpos = 0; rv = apr_file_seek(testfile, APR_SET, &fpos); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File position mismatch, expected 0", fpos == 0); txtlen = 50; rv = apr_file_read(testfile, buff, &txtlen); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, TEST2, buff); apr_file_close(testfile); rv = apr_file_dup2(errfile, saveerr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, errfile); apr_file_close(saveerr);}
开发者ID:Ga-vin,项目名称:apache,代码行数:51,
示例16: select_rowsstatic void select_rows(abts_case *tc, apr_dbd_t* handle, const apr_dbd_driver_t* driver, int count){ apr_status_t rv; apr_pool_t* pool = p; apr_pool_t* tpool; const char* sql = "SELECT * FROM apr_dbd_test ORDER BY col1"; apr_dbd_results_t *res = NULL; apr_dbd_row_t *row = NULL; int i; rv = apr_dbd_select(driver, pool, handle, &res, sql, 0); ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); ABTS_PTR_NOTNULL(tc, res); apr_pool_create(&tpool, pool); i = count; while (i > 0) { row = NULL; rv = apr_dbd_get_row(driver, pool, res, &row, -1); ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); ABTS_PTR_NOTNULL(tc, row); apr_pool_clear(tpool); i--; } ABTS_ASSERT(tc, "Missing Rows!", i == 0); res = NULL; i = count; rv = apr_dbd_select(driver, pool, handle, &res, sql, 1); ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); ABTS_PTR_NOTNULL(tc, res); rv = apr_dbd_num_tuples(driver, res); ABTS_ASSERT(tc, "invalid row count", rv == count); while (i > 0) { row = NULL; rv = apr_dbd_get_row(driver, pool, res, &row, i); ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); ABTS_PTR_NOTNULL(tc, row); apr_pool_clear(tpool); i--; } ABTS_ASSERT(tc, "Missing Rows!", i == 0); rv = apr_dbd_get_row(driver, pool, res, &row, count+100); ABTS_ASSERT(tc, "If we overseek, get_row should return -1", rv == -1);}
开发者ID:cookrn,项目名称:openamq,代码行数:49,
示例17: test_shm_allocatestatic void test_shm_allocate(abts_case *tc, void *data){ apr_status_t rv; apr_shm_t *shm = NULL; rv = apr_shm_create(&shm, SHARED_SIZE, NULL, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); ABTS_PTR_NOTNULL(tc, shm); boxes = apr_shm_baseaddr_get(shm); ABTS_PTR_NOTNULL(tc, boxes); rv = apr_shm_destroy(shm); APR_ASSERT_SUCCESS(tc, "Error destroying shared memory block", rv);}
开发者ID:0jpq0,项目名称:kbengine,代码行数:15,
示例18: test_anonstatic void test_anon(abts_case *tc, void *data){ apr_proc_t proc; apr_status_t rv; apr_shm_t *shm; apr_size_t retsize; int cnt, i; int recvd; rv = apr_shm_create(&shm, SHARED_SIZE, NULL, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); ABTS_PTR_NOTNULL(tc, shm); retsize = apr_shm_size_get(shm); ABTS_INT_EQUAL(tc, SHARED_SIZE, retsize); boxes = apr_shm_baseaddr_get(shm); ABTS_PTR_NOTNULL(tc, boxes); rv = apr_proc_fork(&proc, p); if (rv == APR_INCHILD) { /* child */ int num = msgwait(5, 0, N_BOXES); /* exit with the number of messages received so that the parent * can check that all messages were received. */ exit(num); } else if (rv == APR_INPARENT) { /* parent */ i = N_BOXES; cnt = 0; while (cnt++ < N_MESSAGES) { if ((i-=3) < 0) { i += N_BOXES; /* start over at the top */ } msgput(i, MSG); apr_sleep(apr_time_make(0, 10000)); } } else { ABTS_FAIL(tc, "apr_proc_fork failed"); } /* wait for the child */ rv = apr_proc_wait(&proc, &recvd, NULL, APR_WAIT); ABTS_INT_EQUAL(tc, N_MESSAGES, recvd); rv = apr_shm_destroy(shm); APR_ASSERT_SUCCESS(tc, "Error destroying shared memory block", rv);}
开发者ID:0jpq0,项目名称:kbengine,代码行数:48,
示例19: test_dbd_genericstatic void test_dbd_generic(abts_case *tc, apr_dbd_t* handle, const apr_dbd_driver_t* driver){ void* native; apr_pool_t *pool = p; apr_status_t rv; native = apr_dbd_native_handle(driver, handle); ABTS_PTR_NOTNULL(tc, native); rv = apr_dbd_check_conn(driver, pool, handle); create_table(tc, handle, driver); select_rows(tc, handle, driver, 0); insert_data(tc, handle, driver, 5); select_rows(tc, handle, driver, 5); delete_rows(tc, handle, driver); select_rows(tc, handle, driver, 0); drop_table(tc, handle, driver); test_escape(tc, handle, driver); rv = apr_dbd_close(driver, handle); ABTS_ASSERT(tc, "failed to close database", rv == APR_SUCCESS);}
开发者ID:cookrn,项目名称:openamq,代码行数:25,
示例20: dynamic_bindingstatic void dynamic_binding(abts_case *tc, void *data){ unsigned int i; apr_status_t rv; toolbox_t box[NTHREADS]; apr_thread_t *thread[NTHREADS]; apr_thread_mutex_t *mutex[NTHREADS]; apr_thread_cond_t *cond = NULL; rv = apr_thread_cond_create(&cond, p); ABTS_SUCCESS(rv); ABTS_PTR_NOTNULL(tc, cond); for (i = 0; i < NTHREADS; i++) { rv = apr_thread_mutex_create(&mutex[i], APR_THREAD_MUTEX_DEFAULT, p); ABTS_SUCCESS(rv); rv = apr_thread_mutex_lock(mutex[i]); ABTS_SUCCESS(rv); box[i].tc = tc; box[i].cond = cond; box[i].mutex = mutex[i]; box[i].func = lock_and_signal; rv = apr_thread_create(&thread[i], NULL, thread_routine, &box[i], p); ABTS_SUCCESS(rv); } /* * The dynamic binding should be preserved because we use only one waiter */ for (i = 0; i < NTHREADS; i++) { rv = apr_thread_cond_wait(cond, mutex[i]); ABTS_SUCCESS(rv); } for (i = 0; i < NTHREADS; i++) { rv = apr_thread_cond_timedwait(cond, mutex[i], 10000); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); rv = apr_thread_mutex_unlock(mutex[i]); ABTS_SUCCESS(rv); } for (i = 0; i < NTHREADS; i++) { apr_status_t retval; rv = apr_thread_join(&retval, thread[i]); ABTS_SUCCESS(rv); } rv = apr_thread_cond_destroy(cond); ABTS_SUCCESS(rv); for (i = 0; i < NTHREADS; i++) { rv = apr_thread_mutex_destroy(mutex[i]); ABTS_SUCCESS(rv); }}
开发者ID:ohmann,项目名称:checkapi,代码行数:60,
示例21: summation_test/* 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 summation_test(abts_case *tc, void *data){ apr_hash_t *h; int sumKeys, sumVal, trySumKey, trySumVal; int i, j, *val, *key; h =apr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); sumKeys = 0; sumVal = 0; trySumKey = 0; trySumVal = 0; for (i = 0; i < 100; i++) { j = i * 10 + 1; sumKeys += j; sumVal += i; key = apr_palloc(p, sizeof(int)); *key = j; val = apr_palloc(p, sizeof(int)); *val = i; apr_hash_set(h, key, sizeof(int), val); } sum_hash(p, h, &i, &trySumKey, &trySumVal); ABTS_INT_EQUAL(tc, 100, i); ABTS_INT_EQUAL(tc, sumVal, trySumVal); ABTS_INT_EQUAL(tc, sumKeys, trySumKey);}
开发者ID:ohmann,项目名称:checkapi,代码行数:34,
示例22: timeout_pollin_pollcbstatic void timeout_pollin_pollcb(abts_case *tc, void *data){ apr_status_t rv; pollcb_baton_t pcb; apr_pollfd_t socket_pollfd; POLLCB_PREREQ; recv_msg(s, 0, p, tc); ABTS_PTR_NOTNULL(tc, s[0]); socket_pollfd.desc_type = APR_POLL_SOCKET; socket_pollfd.reqevents = APR_POLLIN; socket_pollfd.desc.s = s[0]; socket_pollfd.client_data = s[0]; rv = apr_pollcb_add(pollcb, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); pcb.count = 0; pcb.tc = tc; rv = apr_pollcb_poll(pollcb, 1, trigger_pollcb_cb, &pcb); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 0, pcb.count); rv = apr_pollcb_remove(pollcb, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);}
开发者ID:Ga-vin,项目名称:apache,代码行数:28,
示例23: trigger_pollcbstatic void trigger_pollcb(abts_case *tc, void *data){ apr_status_t rv; apr_pollfd_t socket_pollfd; pollcb_baton_t pcb; POLLCB_PREREQ; ABTS_PTR_NOTNULL(tc, s[0]); socket_pollfd.desc_type = APR_POLL_SOCKET; socket_pollfd.reqevents = APR_POLLIN; socket_pollfd.desc.s = s[0]; socket_pollfd.client_data = s[0]; rv = apr_pollcb_add(pollcb, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); send_msg(s, sa, 0, tc); pcb.tc = tc; pcb.count = 0; rv = apr_pollcb_poll(pollcb, -1, trigger_pollcb_cb, &pcb); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, pcb.count); rv = apr_pollcb_remove(pollcb, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);}
开发者ID:Ga-vin,项目名称:apache,代码行数:26,
示例24: hash_makestatic void hash_make(abts_case *tc, void *data){ apr_hash_t *h = NULL; h = apr_hash_make(p); ABTS_PTR_NOTNULL(tc, h);}
开发者ID:ohmann,项目名称:checkapi,代码行数:7,
示例25: delete_keystatic 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,
示例26: test_thread_mutexstatic void test_thread_mutex(abts_case *tc, void *data){ apr_thread_t *t1, *t2, *t3, *t4; apr_status_t s1, s2, s3, s4; s1 = apr_thread_mutex_create(&thread_mutex, APR_THREAD_MUTEX_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s1); ABTS_PTR_NOTNULL(tc, thread_mutex); i = 0; x = 0; s1 = apr_thread_create(&t1, NULL, thread_mutex_function, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s1); s2 = apr_thread_create(&t2, NULL, thread_mutex_function, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s2); s3 = apr_thread_create(&t3, NULL, thread_mutex_function, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s3); s4 = apr_thread_create(&t4, NULL, thread_mutex_function, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s4); apr_thread_join(&s1, t1); apr_thread_join(&s2, t2); apr_thread_join(&s3, t3); apr_thread_join(&s4, t4); ABTS_INT_EQUAL(tc, MAX_ITER, x);}
开发者ID:skizhak,项目名称:open-media-flow-controller,代码行数:28,
示例27: test_thread_rwlockstatic void test_thread_rwlock(abts_case *tc, void *data){ apr_thread_t *t1, *t2, *t3, *t4; apr_status_t s1, s2, s3, s4; s1 = apr_thread_rwlock_create(&rwlock, p); if (s1 == APR_ENOTIMPL) { ABTS_NOT_IMPL(tc, "rwlocks not implemented"); return; } APR_ASSERT_SUCCESS(tc, "rwlock_create", s1); ABTS_PTR_NOTNULL(tc, rwlock); i = 0; x = 0; s1 = apr_thread_create(&t1, NULL, thread_rwlock_func, NULL, p); APR_ASSERT_SUCCESS(tc, "create thread 1", s1); s2 = apr_thread_create(&t2, NULL, thread_rwlock_func, NULL, p); APR_ASSERT_SUCCESS(tc, "create thread 2", s2); s3 = apr_thread_create(&t3, NULL, thread_rwlock_func, NULL, p); APR_ASSERT_SUCCESS(tc, "create thread 3", s3); s4 = apr_thread_create(&t4, NULL, thread_rwlock_func, NULL, p); APR_ASSERT_SUCCESS(tc, "create thread 4", s4); apr_thread_join(&s1, t1); apr_thread_join(&s2, t2); apr_thread_join(&s3, t3); apr_thread_join(&s4, t4); ABTS_INT_EQUAL(tc, MAX_ITER, x); apr_thread_rwlock_destroy(rwlock);}
开发者ID:skizhak,项目名称:open-media-flow-controller,代码行数:34,
示例28: 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,
示例29: overlay_samestatic void overlay_same(abts_case *tc, void *data){ apr_hash_t *base = NULL; apr_hash_t *result = NULL; int count; char StrArray[MAX_DEPTH][MAX_LTH]; 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, StrArray); ABTS_STR_EQUAL(tc, "Key base1 (5) Value value1/n", StrArray[0]); ABTS_STR_EQUAL(tc, "Key base2 (5) Value value2/n", StrArray[1]); ABTS_STR_EQUAL(tc, "Key base3 (5) Value value3/n", StrArray[2]); ABTS_STR_EQUAL(tc, "Key base4 (5) Value value4/n", StrArray[3]); ABTS_STR_EQUAL(tc, "Key base5 (5) Value value5/n", StrArray[4]); ABTS_STR_EQUAL(tc, "#entries 5/n", StrArray[5]);}
开发者ID:ohmann,项目名称:checkapi,代码行数:30,
示例30: overlay_samestatic 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,
注:本文中的ABTS_PTR_NOTNULL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ABTS_STR_EQUAL函数代码示例 C++ ABTS_INT_EQUAL函数代码示例 |