这篇教程C++ ABTS_ASSERT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ABTS_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ ABTS_ASSERT函数的具体用法?C++ ABTS_ASSERT怎么用?C++ ABTS_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ABTS_ASSERT函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: test_partitionstatic void test_partition(abts_case *tc, void *data){ apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); apr_bucket_brigade *bb = apr_brigade_create(p, ba); apr_bucket *e; e = apr_bucket_immortal_create(hello, strlen(hello), ba); APR_BRIGADE_INSERT_HEAD(bb, e); apr_assert_success(tc, "partition brigade", apr_brigade_partition(bb, 5, &e)); test_bucket_content(tc, APR_BRIGADE_FIRST(bb), "hello", 5); test_bucket_content(tc, APR_BRIGADE_LAST(bb), ", world", 7); ABTS_ASSERT(tc, "partition returns APR_INCOMPLETE", apr_brigade_partition(bb, 8192, &e)); ABTS_ASSERT(tc, "APR_INCOMPLETE partition returned sentinel", e == APR_BRIGADE_SENTINEL(bb)); apr_brigade_destroy(bb); apr_bucket_alloc_destroy(ba);}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:27,
示例2: test_truncfile/* Regression test for PR 34708, where a file bucket will keep * duplicating itself on being read() when EOF is reached * prematurely. */static void test_truncfile(abts_case *tc, void *data){ apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); apr_bucket_brigade *bb = apr_brigade_create(p, ba); apr_file_t *f = make_test_file(tc, "testfile.txt", "hello"); apr_bucket *e; const char *buf; apr_size_t len; apr_brigade_insert_file(bb, f, 0, 5, p); apr_file_trunc(f, 0); e = APR_BRIGADE_FIRST(bb); ABTS_ASSERT(tc, "single bucket in brigade", APR_BUCKET_NEXT(e) == APR_BRIGADE_SENTINEL(bb)); apr_bucket_file_enable_mmap(e, 0); ABTS_ASSERT(tc, "read gave APR_EOF", apr_bucket_read(e, &buf, &len, APR_BLOCK_READ) == APR_EOF); ABTS_ASSERT(tc, "read length 0", len == 0); ABTS_ASSERT(tc, "still a single bucket in brigade", APR_BUCKET_NEXT(e) == APR_BRIGADE_SENTINEL(bb)); apr_file_close(f); apr_brigade_destroy(bb); apr_bucket_alloc_destroy(ba);}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:35,
示例3: string_strfsizestatic 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,
示例4: copy_helperstatic void copy_helper(abts_case *tc, const char *from, const char * to, apr_fileperms_t perms, int append, apr_pool_t *p){ apr_status_t rv; apr_status_t dest_rv; apr_finfo_t copy; apr_finfo_t orig; apr_finfo_t dest; dest_rv = apr_stat(&dest, to, APR_FINFO_SIZE, p); if (!append) { rv = apr_file_copy(from, to, perms, p); } else { rv = apr_file_append(from, to, perms, p); } APR_ASSERT_SUCCESS(tc, "Error copying file", rv); rv = apr_stat(&orig, from, APR_FINFO_SIZE, p); APR_ASSERT_SUCCESS(tc, "Couldn't stat original file", rv); rv = apr_stat(©, to, APR_FINFO_SIZE, p); APR_ASSERT_SUCCESS(tc, "Couldn't stat copy file", rv); if (!append) { ABTS_ASSERT(tc, "File size differs", orig.size == copy.size); } else { ABTS_ASSERT(tc, "File size differs", ((dest_rv == APR_SUCCESS) ? dest.size : 0) + orig.size == copy.size); }}
开发者ID:cmjonze,项目名称:apr,代码行数:34,
示例5: apr_crypto_initstatic const apr_crypto_driver_t *get_driver(abts_case *tc, apr_pool_t *pool, const char *name, const apr_array_header_t *params) { const apr_crypto_driver_t *driver = NULL; const apu_err_t *err = NULL; apr_status_t rv; rv = apr_crypto_init(pool, params); ABTS_ASSERT(tc, "failed to init apr_crypto", rv == APR_SUCCESS); rv = apr_crypto_get_driver(pool, name, &driver, params, &err); if (APR_SUCCESS != rv && err) { ABTS_NOT_IMPL(tc, err->msg); return NULL; } if (APR_ENOTIMPL == rv) { ABTS_NOT_IMPL(tc, (char *)driver); return NULL; } ABTS_ASSERT(tc, "failed to apr_crypto_get_driver", rv == APR_SUCCESS); ABTS_ASSERT(tc, "apr_crypto_get_driver returned NULL", driver != NULL); if (!driver || rv) { return NULL; } return driver;}
开发者ID:dtrebbien,项目名称:apr,代码行数:28,
示例6: overflow_strfsize/* random-ish checks for strfsize buffer overflows */static void overflow_strfsize(abts_case *tc, void *data){ apr_off_t off; char buf[7]; buf[5] = '$'; buf[6] = '@'; for (off = -9999; off < 20000; off++) { apr_strfsize(off, buf); } for (; off < 9999999; off += 9) { apr_strfsize(off, buf); } for (; off < 999999999; off += 999) { apr_strfsize(off, buf); } for (off = 1; off < LONG_MAX && off > 0; off *= 2) { apr_strfsize(off, buf); apr_strfsize(off + 1, buf); apr_strfsize(off - 1, buf); } ABTS_ASSERT(tc, "strfsize overflowed", buf[5] == '$'); ABTS_ASSERT(tc, "strfsize overflowed", buf[6] == '@');}
开发者ID:ohmann,项目名称:checkapi,代码行数:27,
示例7: 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,
示例8: launch_readerstatic int launch_reader(abts_case *tc){ apr_proc_t proc = {0}; apr_procattr_t *procattr; const char *args[2]; apr_status_t rv; apr_exit_why_e why; int exitcode; rv = apr_procattr_create(&procattr, p); APR_ASSERT_SUCCESS(tc, "Couldn't create procattr", rv); rv = apr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, APR_NO_PIPE); APR_ASSERT_SUCCESS(tc, "Couldn't set io in procattr", rv); rv = apr_procattr_error_check_set(procattr, 1); APR_ASSERT_SUCCESS(tc, "Couldn't set error check in procattr", rv); args[0] = "tryread" EXTENSION; args[1] = NULL; rv = apr_proc_create(&proc, "./tryread" EXTENSION, args, NULL, procattr, p); APR_ASSERT_SUCCESS(tc, "Couldn't launch program", rv); ABTS_ASSERT(tc, "wait for child process", apr_proc_wait(&proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE); ABTS_ASSERT(tc, "child terminated normally", why == APR_PROC_EXIT); return exitcode;}
开发者ID:TaoheGit,项目名称:hmi_sdl_android,代码行数:30,
示例9: 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,
示例10: test_pipe_writefullstatic void test_pipe_writefull(abts_case *tc, void *data){ int iterations = 1000; int i; int bytes_per_iteration = 8000; char *buf = (char *)malloc(bytes_per_iteration); char responsebuf[128]; apr_size_t nbytes; int bytes_processed; apr_proc_t proc = {0}; apr_procattr_t *procattr; const char *args[2]; apr_status_t rv; apr_exit_why_e why; rv = apr_procattr_create(&procattr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_procattr_io_set(procattr, APR_CHILD_BLOCK, APR_CHILD_BLOCK, APR_CHILD_BLOCK); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_procattr_error_check_set(procattr, 1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); args[0] = "readchild" EXTENSION; args[1] = NULL; rv = apr_proc_create(&proc, "./readchild" EXTENSION, args, NULL, procattr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_file_pipe_timeout_set(proc.in, apr_time_from_sec(10)); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_file_pipe_timeout_set(proc.out, apr_time_from_sec(10)); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); i = iterations; do { rv = apr_file_write_full(proc.in, buf, bytes_per_iteration, NULL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } while (--i); free(buf); rv = apr_file_close(proc.in); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); nbytes = sizeof(responsebuf); rv = apr_file_read(proc.out, responsebuf, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); bytes_processed = (int)apr_strtoi64(responsebuf, NULL, 10); ABTS_INT_EQUAL(tc, iterations * bytes_per_iteration, bytes_processed); ABTS_ASSERT(tc, "wait for child process", apr_proc_wait(&proc, NULL, &why, APR_WAIT) == APR_CHILD_DONE); ABTS_ASSERT(tc, "child terminated normally", why == APR_PROC_EXIT);}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:58,
示例11: test_insertfilestatic void test_insertfile(abts_case *tc, void *ctx){ apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); apr_bucket_brigade *bb; const apr_off_t bignum = (APR_INT64_C(2) << 32) + 424242; apr_off_t count; apr_file_t *f; apr_bucket *e; ABTS_ASSERT(tc, "open test file", apr_file_open(&f, TIF_FNAME, APR_FOPEN_WRITE | APR_FOPEN_TRUNCATE | APR_FOPEN_CREATE | APR_FOPEN_SPARSE, APR_OS_DEFAULT, p) == APR_SUCCESS); if (apr_file_trunc(f, bignum)) { apr_file_close(f); apr_file_remove(TIF_FNAME, p); ABTS_NOT_IMPL(tc, "Skipped: could not create large file"); return; } bb = apr_brigade_create(p, ba); e = apr_brigade_insert_file(bb, f, 0, bignum, p); ABTS_ASSERT(tc, "inserted file was not at end of brigade", e == APR_BRIGADE_LAST(bb)); /* check that the total size of inserted buckets is equal to the * total size of the file. */ count = 0; for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb); e = APR_BUCKET_NEXT(e)) { ABTS_ASSERT(tc, "bucket size sane", e->length != (apr_size_t)-1); count += e->length; } ABTS_ASSERT(tc, "total size of buckets incorrect", count == bignum); apr_brigade_destroy(bb); /* Truncate the file to zero size before close() so that we don't * actually write out the large file if we are on a non-sparse file * system - like Mac OS X's HFS. Otherwise, pity the poor user who * has to wait for the 8GB file to be written to disk. */ apr_file_trunc(f, 0); apr_file_close(f); apr_bucket_alloc_destroy(ba); apr_file_remove(TIF_FNAME, p);}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:55,
示例12: test_file_truncstatic void test_file_trunc(abts_case *tc, void *data){ apr_status_t rv; apr_file_t *f; const char *fname = "data/testtruncate.dat"; const char *s; apr_size_t nbytes; apr_finfo_t finfo; apr_file_remove(fname, p); /* Test unbuffered */ rv = apr_file_open(&f, fname, APR_FOPEN_CREATE | APR_FOPEN_READ | APR_FOPEN_WRITE, APR_FPROT_UREAD | APR_FPROT_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); s = "some data"; nbytes = strlen(s); rv = apr_file_write(f, s, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); rv = apr_file_trunc(f, 4); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File size mismatch, expected 4", finfo.size == 4); rv = apr_file_remove(fname, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Test buffered */ rv = apr_file_open(&f, fname, APR_FOPEN_CREATE | APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_BUFFERED, APR_FPROT_UREAD | APR_FPROT_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); nbytes = strlen(s); rv = apr_file_write(f, s, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); rv = apr_file_trunc(f, 4); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File size mismatch, expected 4", finfo.size == 4); rv = apr_file_remove(fname, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);}
开发者ID:cmjonze,项目名称:apr,代码行数:55,
示例13: wait_childstatic int wait_child(abts_case *tc, apr_proc_t *proc) { int exitcode; apr_exit_why_e why; ABTS_ASSERT(tc, "Error waiting for child process", apr_proc_wait(proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE); ABTS_ASSERT(tc, "child terminated normally", why == APR_PROC_EXIT); return exitcode;}
开发者ID:AAthresh,项目名称:quantlib,代码行数:11,
示例14: multi_event_pollsetstatic void multi_event_pollset(abts_case *tc, void *data){ apr_status_t rv; apr_pollfd_t socket_pollfd; int lrv; const apr_pollfd_t *descs = NULL; ABTS_PTR_NOTNULL(tc, s[0]); socket_pollfd.desc_type = APR_POLL_SOCKET; socket_pollfd.reqevents = APR_POLLIN | APR_POLLOUT; socket_pollfd.desc.s = s[0]; socket_pollfd.client_data = s[0]; rv = apr_pollset_add(pollset, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); send_msg(s, sa, 0, tc); rv = apr_pollset_poll(pollset, -1, &lrv, &descs); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); if (lrv == 1) { int ev = descs[0].rtnevents; ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s); ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data); ABTS_ASSERT(tc, "either or both of APR_POLLIN, APR_POLLOUT returned", ((ev & APR_POLLIN) != 0) || ((ev & APR_POLLOUT) != 0)); } else if (lrv == 2) { ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s); ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data); ABTS_PTR_EQUAL(tc, s[0], descs[1].desc.s); ABTS_PTR_EQUAL(tc, s[0], descs[1].client_data); ABTS_ASSERT(tc, "returned events incorrect", ((descs[0].rtnevents | descs[1].rtnevents) == (APR_POLLIN | APR_POLLOUT)) && descs[0].rtnevents != descs[1].rtnevents); } else { ABTS_ASSERT(tc, "either one or two events returned", lrv == 1 || lrv == 2); } recv_msg(s, 0, p, tc); rv = apr_pollset_poll(pollset, 0, &lrv, &descs); ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 1, lrv); ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s); ABTS_INT_EQUAL(tc, APR_POLLOUT, descs[0].rtnevents); ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data); rv = apr_pollset_remove(pollset, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);}
开发者ID:Ga-vin,项目名称:apache,代码行数:53,
示例15: test_inc_neg1static void test_inc_neg1(abts_case *tc, void *data){ apr_uint32_t y32 = -1; apr_uint32_t minus1 = -1; apr_uint32_t rv; char *str; rv = apr_atomic_inc32(&y32); ABTS_ASSERT(tc, "apr_atomic_inc32 on zero returned zero.", rv == minus1); str = apr_psprintf(p, "zero wrap failed: -1 + 1 = %d", y32); ABTS_ASSERT(tc, str, y32 == 0);}
开发者ID:AAthresh,项目名称:quantlib,代码行数:13,
示例16: string_strtoffstatic void string_strtoff(abts_case *tc, void *data){ apr_off_t off; ABTS_ASSERT(tc, "strtoff fails on out-of-range integer", apr_strtoff(&off, "999999999999999999999999999999", NULL, 10) != APR_SUCCESS); ABTS_ASSERT(tc, "strtoff failed for 1234", apr_strtoff(&off, "1234", NULL, 10) == APR_SUCCESS); ABTS_ASSERT(tc, "strtoff failed to parse 1234", off == 1234);}
开发者ID:ohmann,项目名称:checkapi,代码行数:13,
示例17: test_wrap_zerostatic void test_wrap_zero(abts_case *tc, void *data){ apr_uint32_t y32; apr_uint32_t rv; apr_uint32_t minus1 = -1; char *str; apr_atomic_set32(&y32, 0); rv = apr_atomic_dec32(&y32); ABTS_ASSERT(tc, "apr_atomic_dec32 on zero returned zero.", rv != 0); str = apr_psprintf(p, "zero wrap failed: 0 - 1 = %d", y32); ABTS_ASSERT(tc, str, y32 == minus1);}
开发者ID:AAthresh,项目名称:quantlib,代码行数:14,
示例18: test_createstatic void test_create(abts_case *tc, void *data){ apr_bucket_alloc_t *ba; apr_bucket_brigade *bb; ba = apr_bucket_alloc_create(p); bb = apr_brigade_create(p, ba); ABTS_ASSERT(tc, "new brigade not NULL", bb != NULL); ABTS_ASSERT(tc, "new brigade is empty", APR_BRIGADE_EMPTY(bb)); apr_brigade_destroy(bb); apr_bucket_alloc_destroy(ba);}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:14,
示例19: ABTS_ASSERT/* Make a test file named FNAME, and write CONTENTS to it. */static apr_file_t *make_test_file(abts_case *tc, const char *fname, const char *contents){ apr_file_t *f; ABTS_ASSERT(tc, "create test file", apr_file_open(&f, fname, APR_READ|APR_WRITE|APR_TRUNCATE|APR_CREATE, APR_OS_DEFAULT, p) == APR_SUCCESS); ABTS_ASSERT(tc, "write test file contents", apr_file_puts(contents, f) == APR_SUCCESS); return f;}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:16,
示例20: test_dec32static void test_dec32(abts_case *tc, void *data){ apr_uint32_t y32; int rv; apr_atomic_set32(&y32, 2); rv = apr_atomic_dec32(&y32); ABTS_INT_EQUAL(tc, 1, y32); ABTS_ASSERT(tc, "atomic_dec returned zero when it shouldn't", rv != 0); rv = apr_atomic_dec32(&y32); ABTS_INT_EQUAL(tc, 0, y32); ABTS_ASSERT(tc, "atomic_dec didn't returned zero when it should", rv == 0);}
开发者ID:AAthresh,项目名称:quantlib,代码行数:15,
示例21: test_atomics_threadedstatic void test_atomics_threaded(abts_case *tc, void *data){ apr_thread_t *t1[NUM_THREADS]; apr_thread_t *t2[NUM_THREADS]; apr_thread_t *t3[NUM_THREADS]; apr_status_t s1[NUM_THREADS]; apr_status_t s2[NUM_THREADS]; apr_status_t s3[NUM_THREADS]; apr_status_t rv; int i;#ifdef HAVE_PTHREAD_SETCONCURRENCY pthread_setconcurrency(8);#endif rv = apr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "Could not create lock", rv); for (i = 0; i < NUM_THREADS; i++) { apr_status_t r1, r2, r3; r1 = apr_thread_create(&t1[i], NULL, thread_func_mutex, NULL, p); r2 = apr_thread_create(&t2[i], NULL, thread_func_atomic, NULL, p); r3 = apr_thread_create(&t3[i], NULL, thread_func_none, NULL, p); ABTS_ASSERT(tc, "Failed creating threads", r1 == APR_SUCCESS && r2 == APR_SUCCESS && r3 == APR_SUCCESS); } for (i = 0; i < NUM_THREADS; i++) { apr_thread_join(&s1[i], t1[i]); apr_thread_join(&s2[i], t2[i]); apr_thread_join(&s3[i], t3[i]); ABTS_ASSERT(tc, "Invalid return value from thread_join", s1[i] == exit_ret_val && s2[i] == exit_ret_val && s3[i] == exit_ret_val); } ABTS_INT_EQUAL(tc, x, NUM_THREADS * NUM_ITERATIONS); ABTS_INT_EQUAL(tc, apr_atomic_read32(&y), NUM_THREADS * NUM_ITERATIONS); /* Comment out this test, because I have no clue what this test is * actually telling us. We are checking something that may or may not * be true, and it isn't really testing APR at all. ABTS_ASSERT(tc, "We expect this to fail, because we tried to update " "an integer in a non-thread-safe manner.", z != NUM_THREADS * NUM_ITERATIONS); */}
开发者ID:AAthresh,项目名称:quantlib,代码行数:48,
示例22: test_fail_write_flushstatic void test_fail_write_flush(abts_case *tc, void *data){ apr_file_t *f; const char *fname = "data/testflush.dat"; apr_status_t rv; char buf[APR_BUFFERSIZE]; int n; apr_file_remove(fname, p); APR_ASSERT_SUCCESS(tc, "open test file", apr_file_open(&f, fname, APR_CREATE|APR_READ|APR_BUFFERED, APR_UREAD|APR_UWRITE, p)); memset(buf, 'A', sizeof buf); /* Try three writes. One of these should fail when it exceeds the * internal buffer and actually tries to write to the file, which * was opened read-only and hence should be unwritable. */ for (n = 0, rv = APR_SUCCESS; n < 4 && rv == APR_SUCCESS; n++) { apr_size_t bytes = sizeof buf; rv = apr_file_write(f, buf, &bytes); } ABTS_ASSERT(tc, "failed to write to read-only buffered fd", rv != APR_SUCCESS); apr_file_close(f);}
开发者ID:aptana,项目名称:Jaxer,代码行数:30,
示例23: link_nonexistingstatic void link_nonexisting(abts_case *tc, void *data){ apr_status_t rv; rv = apr_file_link("data/does_not_exist.txt", "data/fake.txt"); ABTS_ASSERT(tc, "", rv != APR_SUCCESS);}
开发者ID:XianliangJ,项目名称:mtcp,代码行数:7,
示例24: 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,
示例25: test_md4sumstatic void test_md4sum(abts_case *tc, void *data){ apr_md4_ctx_t context; unsigned char digest[APR_MD4_DIGESTSIZE]; const void *string = md4sums[count].string; const void *sum = md4sums[count].md4sum; unsigned int len = strlen(string); ABTS_ASSERT(tc, "apr_md4_init", (apr_md4_init(&context) == 0)); ABTS_ASSERT(tc, "apr_md4_update", (apr_md4_update(&context, (unsigned char *)string, len) == 0)); ABTS_ASSERT(tc, "apr_md4_final", (apr_md4_final(digest, &context) ==0)); ABTS_ASSERT(tc, "check for correct md4 digest", (memcmp(digest, sum, APR_MD4_DIGESTSIZE) == 0));}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:17,
示例26: link_existingstatic void link_existing(abts_case *tc, void *data){ apr_status_t rv; rv = apr_file_link("data/file_datafile.txt", "data/file_datafile2.txt"); apr_file_remove("data/file_datafile2.txt", p); ABTS_ASSERT(tc, "Couldn't create hardlink to file", rv == APR_SUCCESS);}
开发者ID:XianliangJ,项目名称:mtcp,代码行数:8,
示例27: test_get_filesizestatic void test_get_filesize(abts_case *tc, void *data){ apr_status_t rv; rv = apr_file_info_get(&thisfinfo, APR_FINFO_NORM, thefile); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File size mismatch", thisfsize == thisfinfo.size);}
开发者ID:Arcterus,项目名称:MoarVM,代码行数:8,
示例28: insert_datastatic void insert_data(abts_case *tc, apr_dbd_t* handle, const apr_dbd_driver_t* driver, int count){ apr_pool_t* pool = p; const char* sql = "INSERT INTO apr_dbd_test VALUES('%d', '%d', %d)"; char* sqf = NULL; int i; int nrows; apr_status_t rv; for (i=0; i<count; i++) { sqf = apr_psprintf(pool, sql, i, i, i); rv = apr_dbd_query(driver, handle, &nrows, sqf); ABTS_ASSERT(tc, sqf, rv == APR_SUCCESS); ABTS_ASSERT(tc, sqf, 1 == nrows); }}
开发者ID:cookrn,项目名称:openamq,代码行数:17,
示例29: test_dbd_initstatic void test_dbd_init(abts_case *tc, void *data){ apr_pool_t *pool = p; apr_status_t rv; rv = apr_dbd_init(pool); ABTS_ASSERT(tc, "failed to init apr_dbd", rv == APR_SUCCESS);}
开发者ID:cookrn,项目名称:openamq,代码行数:8,
示例30: test_unload_librarystatic void test_unload_library(abts_case *tc, void *data){ apr_dso_handle_t *h = NULL; apr_status_t status; char errstr[256]; apr_dso_handle_sym_t func1 = NULL; status = apr_dso_load(&h, libname, p); ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); status = apr_dso_unload(h); ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); status = apr_dso_sym(&func1, h, "print_hello"); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ESYMNOTFOUND(status));}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:17,
注:本文中的ABTS_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ABTS_INT_EQUAL函数代码示例 C++ ABR函数代码示例 |