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

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

51自学网 2021-06-01 20:15:47
  C++
这篇教程C++ CuAssertIntEquals函数代码示例写得很实用,希望能帮到您。

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

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

示例1: run_client_and_mock_servers_loops_expect_ok

voidrun_client_and_mock_servers_loops_expect_ok(CuTest *tc, test_baton_t *tb,                                            int num_requests,                                            handler_baton_t handler_ctx[],                                            apr_pool_t *pool){    apr_status_t status;    status = run_client_and_mock_servers_loops(tb, num_requests, handler_ctx,                                               pool);    CuAssertIntEquals(tc, APR_SUCCESS, status);    /* Check that the requests were sent and reveived by the server in the order     we created them */    Verify(tb->mh)      CuAssert(tc, ErrorMessage, VerifyAllRequestsReceivedInOrder);    EndVerify    CuAssertIntEquals(tc, num_requests, tb->sent_requests->nelts);    CuAssertIntEquals(tc, num_requests, tb->accepted_requests->nelts);    CuAssertIntEquals(tc, num_requests, tb->handled_requests->nelts);}
开发者ID:KyleSanderson,项目名称:serf,代码行数:22,


示例2: Testbst_tree_insert

void Testbst_tree_insert(CuTest *tc)  {    test_bst_tree_t *root;    test_bst_tree_t *elem;    bool ret;    root = NULL;    elem = NULL;    ret = _bst_tree_insert(NULL, elem, 0, BTREE_COMPARE);    CuAssertTrue(tc, !ret);    ret = bst_tree_insert(root, NULL, btree, BTREE_COMPARE);//    ret = _bst_tree_insert(&(root),//            (NULL),//             (unsigned int)offsetof(typeof(*(root)), btree),//             BTREE_COMPARE);    CuAssertTrue(tc, !ret);    ret = bst_tree_insert(root, elem, btree, NULL);    CuAssertTrue(tc, !ret);    elem = malloc(sizeof(*elem));    elem->key = 2;    ret = bst_tree_insert(root, elem, btree, BTREE_COMPARE);    CuAssertTrue(tc, ret);    elem = malloc(sizeof(*elem));    elem->key = 1;    ret = bst_tree_insert(root, elem, btree, BTREE_COMPARE);    CuAssertTrue(tc, ret);    elem = malloc(sizeof(*elem));    elem->key = 1;    ret = bst_tree_insert(root, elem, btree, BTREE_COMPARE);    CuAssertTrue(tc, !ret);    elem = malloc(sizeof(*elem));    elem->key = 3;    ret = bst_tree_insert(root, elem, btree, BTREE_COMPARE);    CuAssertTrue(tc, ret);    elem = root;    CuAssertIntEquals(tc, 2, elem->key);    CuAssertIntEquals(tc, 1, ((test_bst_tree_t *)elem->btree.left)->key);    CuAssertIntEquals(tc, 3, ((test_bst_tree_t *)elem->btree.right)->key);  }
开发者ID:remysaissy,项目名称:libslds,代码行数:39,


示例3: gc_test_forward

void gc_test_forward(CuTest *T) {  PN_SIZE count;  char *fj = "frances johnson.";  PN ptr = potion_data_alloc(P, 16);  register unsigned long old = ptr & 0xFFFF;  memcpy(((struct PNData *)ptr)->data, fj, 16);  count = potion_mark_stack(P, 1);  CuAssert(T, "copied location identical to original", (old & 0xFFFF) != ptr);  CuAssertIntEquals(T, "copied object not still PN_TUSER", ((struct PNData *)ptr)->vt, PN_TUSER);  CuAssert(T, "copied data not identical to original",    strncmp(((struct PNData *)ptr)->data, fj, 16) == 0);}
开发者ID:edward,项目名称:potion,代码行数:13,


示例4: test_upkeep_free

void test_upkeep_free(CuTest * tc){    region *r;    unit *u;    const item_type *i_silver;    test_cleanup();    test_create_world();    i_silver = it_find("money");    assert(i_silver);    r = findregion(0, 0);    u = test_create_unit(test_create_faction(test_create_race("human")), r);    assert(r && u);    set_param(&global.parameters, "rules.food.flags", "4"); // FOOD_IS_FREE    get_food(r);    CuAssertIntEquals(tc, 0, i_get(u->items, i_silver));    CuAssertIntEquals(tc, 0, fval(u, UFL_HUNGER));    test_cleanup();}
开发者ID:philbooth,项目名称:server,代码行数:22,


示例5: test_cil_lexer_setup

void test_cil_lexer_setup(CuTest *tc) {   char *test_str = "(test /"qstring/");comment/n";   uint32_t str_size = strlen(test_str);   char *buffer = malloc(str_size + 2);   memset(buffer+str_size, 0, 2);   strncpy(buffer, test_str, str_size);   int rc = cil_lexer_setup(buffer, str_size + 2);   CuAssertIntEquals(tc, SEPOL_OK, rc);   free(buffer);}
开发者ID:Chainfire,项目名称:selinux,代码行数:13,


示例6: test_very_nasty

void test_very_nasty(CuTest* tc) {	initial_max_groups = 1;	int test_data[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	                   1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	                   1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0,	                   1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,	                   1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1,	                   0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1,	                   1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0,	                   0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,	                   0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0};	CuAssertIntEquals(tc, compare_inputs(test_data, 11, 9),0);}
开发者ID:Carl4,项目名称:astrometry.net,代码行数:13,


示例7: Test_matrix_from_items_example1

void Test_matrix_from_items_example1(CuTest *tc) {    // This example contains both items from which more than limit fit into a bin    // and items from which only less than limit fit into a bin.        double items[] = {        0.5,        0.33,        0.25    };        uint_matrix *A = matrix_from_items(items, 3, 3);        CuAssertIntEquals(tc, 7, A->height);        {        unsigned int combination[] = {0, 0, 3};        CuAssertTrue(tc, matrix_contains_exact_row(A, combination));    }        {        unsigned int combination[] = {0, 1, 2};        CuAssertTrue(tc, matrix_contains_exact_row(A, combination));    }        {        unsigned int combination[] = {0, 2, 1};        CuAssertTrue(tc, matrix_contains_exact_row(A, combination));    }        {        unsigned int combination[] = {0, 3, 0};        CuAssertTrue(tc, matrix_contains_exact_row(A, combination));    }        {        unsigned int combination[] = {1, 0, 2};        CuAssertTrue(tc, matrix_contains_exact_row(A, combination));    }        {        unsigned int combination[] = {1, 1, 0};        CuAssertTrue(tc, matrix_contains_exact_row(A, combination));    }        {        unsigned int combination[] = {2, 0, 0};        CuAssertTrue(tc, matrix_contains_exact_row(A, combination));    }        free_uint_matrix(A);}
开发者ID:hannesg,项目名称:binpacking,代码行数:51,


示例8: test_tokenize

void test_tokenize(CuTest *tc) {	char *file1 = "float bmi = weight/height;";	char *file2 = "float pi = 3.14159265;";	char *file3 = "print /"Hello World!/";/nfoo();/n";	char *file4 = "print /"///"Hello World!///"/";/nint i = 0;/n/nbar(i++);//";	char *file1_expected[7] = {"float", "bmi", "=", "weight", "/", "height", ";"};	char *file2_expected[5] = {"float", "pi", "=", "3.14159265", ";"};	char *file3_expected[7] = {"print", "/"Hello World!/"", ";", "foo", "(", ")", ";"};	char *file4_expected[15] = {"print", "/"///"Hello World!///"/"", ";", "int", "i", "=",/					 "0", ";", "bar", "(", "i", "++", ")", ";", "//" };	token_t *head = NULL;	CuAssertIntEquals(tc, 0, tokenize(file1, strlen(file1), &head));		check_tokens(tc, head,  file1_expected, 7);	free_tokens(head);	head = NULL;	CuAssertIntEquals(tc, 0, tokenize(file2, strlen(file2), &head));	check_tokens(tc, head,  file2_expected, 5);	free_tokens(head);	head = NULL;	CuAssertIntEquals(tc, 0, tokenize(file3, strlen(file3), &head));	check_tokens(tc, head, file3_expected, 7);	free_tokens(head);	head = NULL;	CuAssertIntEquals(tc, 0, tokenize(file4, strlen(file4), &head));	check_tokens(tc, head, file4_expected, 15);	free_tokens(head);	head = NULL;}
开发者ID:tlawler,项目名称:soos,代码行数:38,


示例9: test_named_spellbooks

void test_named_spellbooks(CuTest * tc){    spell *sp;    spellbook *sb;    spellbook_entry *sbe;    int counter = 0;    sb = create_spellbook(0);    CuAssertPtrNotNull(tc, sb);    CuAssertPtrEquals(tc, NULL, sb->name);    spellbook_clear(sb);    free(sb);    sb = create_spellbook("spells");    CuAssertPtrNotNull(tc, sb);    CuAssertStrEquals(tc, "spells", sb->name);    sp = create_spell("testspell");    spellbook_add(sb, sp, 1);    CuAssertPtrNotNull(tc, sb->spells);    sbe = spellbook_get(sb, sp);    CuAssertPtrNotNull(tc, sbe);    CuAssertIntEquals(tc, 1, sbe->level);    CuAssertPtrEquals(tc, sp, spellref_get(&sbe->spref));    spellbook_foreach(sb, count_spell_cb, &counter);    CuAssertIntEquals(tc, 1, counter);#ifdef TODO    /* try adding the same spell twice. that should fail */    spellbook_add(sb, sp, 1);    spellbook_foreach(sb, count_spell_cb, &counter);    CuAssertIntEquals(tc, 1, counter);#endif    spellbook_clear(sb);    free(sb);}
开发者ID:ennorehling,项目名称:eressea,代码行数:38,


示例10: test_get_direction_default

static void test_get_direction_default(CuTest *tc) {    struct locale *lang;    test_cleanup();    lang = get_or_create_locale("en");    CuAssertIntEquals(tc, NODIRECTION, get_direction("potato", lang));    CuAssertIntEquals(tc, D_SOUTHWEST, get_direction("southwest", lang));    CuAssertIntEquals(tc, D_SOUTHEAST, get_direction("southeast", lang));    CuAssertIntEquals(tc, D_NORTHWEST, get_direction("northwest", lang));    CuAssertIntEquals(tc, D_NORTHEAST, get_direction("northeast", lang));    CuAssertIntEquals(tc, D_WEST, get_direction("west", lang));    CuAssertIntEquals(tc, D_EAST, get_direction("east", lang));}
开发者ID:TomBraun,项目名称:server,代码行数:12,


示例11: check_term_docs

static voidcheck_term_docs(CuTest* tc,                lcn_index_reader_t *index_reader,                apr_pool_t *pool ){    {        apr_pool_t *td_pool;        lcn_term_docs_t *term_docs;        lcn_term_t *term;        apr_status_t next_status = APR_SUCCESS;        unsigned int i = 0;        LCN_TEST( apr_pool_create( &td_pool, pool ));        LCN_TEST( lcn_term_create( &term, "text", "a", LCN_TERM_TEXT_COPY, td_pool ));        LCN_TEST( lcn_index_reader_term_docs_from( index_reader, &term_docs, term, td_pool ));        while(APR_SUCCESS == next_status)        {            next_status = lcn_term_docs_next( term_docs );            if ( APR_SUCCESS != next_status )            {                break;            }            CuAssertIntEquals(tc, doc_freqs[i][0], lcn_term_docs_doc( term_docs ) );            CuAssertIntEquals(tc, doc_freqs[i][1], lcn_term_docs_freq( term_docs ) );            i++;        }        CuAssertIntEquals(tc, 47, i );        LCN_TEST( lcn_term_docs_close( term_docs ));        apr_pool_destroy( td_pool );    }}
开发者ID:Moddus,项目名称:lucino,代码行数:38,


示例12: test_sl_split_2

void test_sl_split_2(CuTest* tc) {    int i;    sl* s = sl_split(NULL, "hello  world  this  is  a  test     ", "  ");    CuAssertPtrNotNull(tc, s);    printf("got: ");    for (i=0; i<sl_size(s); i++)        printf("/%s/ ", sl_get(s, i));    printf("/n");    CuAssertIntEquals(tc, 8, sl_size(s));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 0), "hello"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 1), "world"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 2), "this"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 3), "is"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 4), "a"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 5), "test"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 6), ""));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 7), " "));    sl_free2(s);}
开发者ID:Carl4,项目名称:astrometry.net,代码行数:19,


示例13: Test__cstring_free

void Test__cstring_free(CuTest* tc){  CSTRING* a=NULL;  CSTRING* b=NULL;  CSTRING  c;  int error = 0;  // pass a null to the 'free' function  cstring_free(NULL);  error = errno;  errno = 0;  CuAssertIntEquals(tc, EFAULT, error);  // send non-alloc'd - passing static non-alloc address  a = cstring_import("ABCDE", 5);  c = cstring_strchr(a, 'C');  b=&c;  cstring_free(&b);  error = errno;  errno = 0;  CuAssertIntEquals(tc, EFAULT, error);  cstring_free(&a);  // passing argument returned from cstring_import  a = cstring_import("ABCDE", 5);  cstring_free(&a);  // check that the structure is null'd  CuAssertPtrEquals(tc, NULL, a);  // trying to double free an imported cstring  a = cstring_import("abcde", 5);  cstring_free(&a);  cstring_free(&a);  error = errno;  errno = 0;  CuAssertIntEquals(tc, EFAULT, error);}
开发者ID:wgm,项目名称:cerb2-cparser,代码行数:38,


示例14: test_sl_split_1

void test_sl_split_1(CuTest* tc) {    sl* s = sl_split(NULL, "hello world this is a test", " ");    CuAssertPtrNotNull(tc, s);    CuAssertIntEquals(tc, 6, sl_size(s));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 0), "hello"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 1), "world"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 2), "this"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 3), "is"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 4), "a"));    CuAssertIntEquals(tc, 0, strcmp(sl_get(s, 5), "test"));    sl_free2(s);}
开发者ID:Carl4,项目名称:astrometry.net,代码行数:12,


示例15: test_otherfaction

static void test_otherfaction(CuTest *tc) {    unit *u;    faction *f;    test_setup();    u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));    f = test_create_faction(NULL);    config_set("stealth.faction.other", "1");    CuAssertIntEquals(tc, true, rule_stealth_other());    CuAssertPtrEquals(tc, u->faction, visible_faction(f, u));    a_add(&u->attribs, make_otherfaction(f));    CuAssertPtrEquals(tc, f, visible_faction(f, u));    test_teardown();}
开发者ID:ennorehling,项目名称:eressea,代码行数:14,


示例16: test_memstream

static void test_memstream(CuTest *tc) {    storage store;    stream out = { 0 };    char buf[1024];    int val=0;    mstream_init(&out);    binstore_init(&store, &out);    store.handle.data = &out;    WRITE_INT(&store, 999999);    WRITE_TOK(&store, "fortytwo");    WRITE_INT(&store, 42);    out.api->rewind(out.handle);    READ_INT(&store, &val);    READ_TOK(&store, buf, 1024);    CuAssertIntEquals(tc, 999999, val);    CuAssertStrEquals(tc, "fortytwo", buf);    READ_INT(&store, &val);    CuAssertIntEquals(tc, 42, val);    mstream_done(&out);}
开发者ID:philbooth,项目名称:server,代码行数:23,


示例17: Test_serialize_int

void Test_serialize_int(CuTest * tc){    printf("Int serialization tests and experiments /n");    printf("maximum int = %d/n",INT_MAX);    printf("size of int in bytes= %zu/n",sizeof(int));    int a = 18505;    int value;    unsigned char buffer[sizeof(int)];    serialize_int(buffer,a);    printf(" serialized is %s/n",buffer);    deserialize_int(buffer,&value);    printf(" deserialized is %d/n",value);    CuAssertIntEquals(tc,value,a);    a = INT_MAX;    serialize_int(buffer,a);    deserialize_int(buffer,&value);    CuAssertIntEquals(tc,value,a);    a = INT_MIN;    serialize_int(buffer,a);    deserialize_int(buffer,&value);    CuAssertIntEquals(tc,value,a);}
开发者ID:goroda,项目名称:Compressed-Continuous-Computation,代码行数:23,


示例18: clear_all_signalled

static void clear_all_signalled(CuTest *tc){    apr_status_t rv;    int srv = SMALL_NUM_SOCKETS;    recv_msg(s, 0, p, tc);    recv_msg(s, 2, p, tc);    rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC);    CuAssertIntEquals(tc, 1, APR_STATUS_IS_TIMEUP(rv));    check_sockets(pollarray, s, 0, 0, tc);    check_sockets(pollarray, s, 1, 0, tc);    check_sockets(pollarray, s, 2, 0, tc);}
开发者ID:kheradmand,项目名称:Break,代码行数:14,


示例19: recv_1_send_0

static void recv_1_send_0(CuTest *tc){    apr_status_t rv;    int srv = SMALL_NUM_SOCKETS;    recv_msg(s, 1, p, tc);    send_msg(s, sa, 0, tc);    rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC);    CuAssertIntEquals(tc, APR_SUCCESS, rv);    check_sockets(pollarray, s, 0, 1, tc);    check_sockets(pollarray, s, 1, 0, tc);    check_sockets(pollarray, s, 2, 1, tc);}
开发者ID:kheradmand,项目名称:Break,代码行数:14,


示例20: test_user_get_record_returns_requested_user

void test_user_get_record_returns_requested_user(CuTest *tc){    struct user_record *rec;    setup();    rec = user_get_record("tom");    CuAssertIntEquals(tc, 2, rec->uid);    CuAssertStrEquals(tc, "tom", rec->login);    CuAssertStrEquals(tc, "$1$3$def", rec->password);    CuAssertStrEquals(tc, "Tom Jones", rec->name);    CuAssertStrEquals(tc, "[email
C++ CuAssertStrEquals函数代码示例
C++ CuAssertDblEquals函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。