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


C++ CuAssertIntEquals函数代码示例

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


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

示例1: run_client_and_mock_servers_loops_expect_ok

void
run_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,代码来源:test_util.c

示例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,代码来源:bst_treeTesting.c

示例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,代码来源:gc-test.c

示例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,代码来源:upkeep.test.c

示例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,代码来源:test_cil_lexer.c

示例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,代码来源:test_dfind.c

示例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,代码来源:test_binpacking.c

示例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,代码来源:test_tokenizer.c

示例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,代码来源:spellbook.test.c

示例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,代码来源:direction.test.c

示例11: check_term_docs

static void
check_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,代码来源:t_term_docs.c

示例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,代码来源:test_bl.c

示例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,代码来源:cstring_free.c

示例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,代码来源:test_bl.c

示例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,代码来源:otherfaction.test.c


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