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


C++ CuAssertTrue函数代码示例

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


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

示例1: TestBencodeDictWontGetNextIfEmpty

void TestBencodeDictWontGetNextIfEmpty(
    CuTest * tc
)
{
    bencode_t ben, ben2;

    char *str = strdup("de");

    const char *ren;

    int len, ret;

    bencode_init(&ben, str, strlen(str));
    ret = bencode_dict_get_next(&ben, &ben2, &ren, &len);
    CuAssertTrue(tc, 0 == ret);
    free(str);
}
开发者ID:saeschdivara,项目名称:CHeaplessBencodeReader,代码行数:17,代码来源:test_bencode.c

示例2: testCuFree

void testCuFree(CuTest_t* tc){
    int *iVar = (int*)CuAlloc(sizeof(int));
    CuSize_t freecount = CuAlloc_getFreeCount();
    CuSize_t alloccount = CuAlloc_getAllocCount();
    bool freeResult = CuFree(iVar);


   // CuAssertTrue(tc, !CuAlloc_getBufferValidity(iVar));
    CuAssertIntEquals(tc, true, freeResult);
    CuAssertIntEquals(tc, alloccount, CuAlloc_getAllocCount());
    CuAssertIntEquals(tc, freecount+1, CuAlloc_getFreeCount());

    freeResult = CuFree(iVar);
    //CuAssertTrue(tc, !CuAlloc_getBufferValidity(iVar));
    CuAssertTrue(tc, !freeResult);

}
开发者ID:MonteCarlos,项目名称:Cutest-CC65-Version,代码行数:17,代码来源:testCuAlloc.c

示例3: TestBencodeStringValue2

void TestBencodeStringValue2(
    CuTest * tc
)
{
    bencode_t ben;

    char *str = strdup("12:flyinganimal");

    const char *ren;

    int len;

    bencode_init(&ben, str, strlen(str));
    bencode_string_value(&ben, &ren, &len);
    CuAssertTrue(tc, !strncmp("flyinganimal", ren, len));
    free(str);
}
开发者ID:saeschdivara,项目名称:CHeaplessBencodeReader,代码行数:17,代码来源:test_bencode.c

示例4: TestBencodeStringInvalid

/**
 * The string value function errors when the string is of insufficient length
 * */
void TestBencodeStringInvalid(
    CuTest * tc
)
{
    bencode_t ben;

    char *str = strdup("5:test");

    const char *ren;

    int len;

    bencode_init(&ben, str, strlen(str));
    bencode_string_value(&ben, &ren, &len);
    CuAssertTrue(tc, !ren);
    free(str);
}
开发者ID:saeschdivara,项目名称:CHeaplessBencodeReader,代码行数:20,代码来源:test_bencode.c

示例5: alloc_bytes

static void alloc_bytes(CuTest *tc)
{
    int i;
    char *alloc;
    
    alloc = apr_palloc(pmain, ALLOC_BYTES);
    CuAssertPtrNotNull(tc, alloc);

    for (i=0;i<ALLOC_BYTES;i++) {
        char *ptr = alloc + i;
        *ptr = 0xa;
    }
    /* This is just added to get the positive.  If this test fails, the
     * suite will seg fault.
     */
    CuAssertTrue(tc, 1);
}
开发者ID:Garridon,项目名称:windowsrtdev,代码行数:17,代码来源:testpools.c

示例6: TestRaft_follower_becomes_candidate_when_election_timeout_occurs

void TestRaft_follower_becomes_candidate_when_election_timeout_occurs(
    CuTest * tc)
{
    void *r = raft_new();

    /*  1 second election timeout */
    raft_set_election_timeout(r, 1000);

    raft_add_node(r, (void*)1, 1);
    raft_add_node(r, (void*)2, 0);

    /*  1.001 seconds have passed */
    raft_periodic(r, 1001);

    /* is a candidate now */
    CuAssertTrue(tc, 1 == raft_is_candidate(r));
}
开发者ID:apitests,项目名称:libjl777,代码行数:17,代码来源:test_server.c

示例7: test_entries_as_list

static void
test_entries_as_list ( CuTest* tc )
{
    const char *index = "_1.cfs";
    lcn_compound_file_reader_t *cfr;
    lcn_directory_t *cf_dir;
    lcn_list_t *entries;
    apr_pool_t *pool;

    apr_pool_create( &pool, NULL );

    LCN_TEST( lcn_fs_directory_create(&cf_dir, cf_static, LCN_FALSE, pool ) );
    LCN_TEST( lcn_compound_file_reader_create(&cfr, cf_dir, index, pool) );
    LCN_TEST( lcn_compound_file_reader_entries_as_list(cfr, &entries, pool) );

    CuAssertTrue( tc, lcn_list_size(entries) == 7);
}
开发者ID:Moddus,项目名称:lucino,代码行数:17,代码来源:t_compound_file.c

示例8: testCall0StackAlignment1

static void testCall0StackAlignment1(CuTest* tc) {
    // The first 6 ptr/int values are passed in registers. We need to push
    // at least 7 ptrs to start using the stack. 
    CallInfo* ci = CALL0_ALLOCATE_CALL_INFO(NULL, stackPointer, 7, 0, 0, 0, 0);
    CuAssertPtrNotNull(tc, ci);
    call0AddPtr(ci, (void*) 1);
    call0AddPtr(ci, (void*) 2);
    call0AddPtr(ci, (void*) 3);
    call0AddPtr(ci, (void*) 4);
    call0AddPtr(ci, (void*) 5);
    call0AddPtr(ci, (void*) 6);
    call0AddPtr(ci, (void*) 7);

    void* (*f)(CallInfo*) = (void* (*)(CallInfo*)) _call0;
    void* result = f(ci);
    CuAssertTrue(tc, (((ptrdiff_t) result) & 0xf) == 8);
}
开发者ID:pacificIT,项目名称:robovm,代码行数:17,代码来源:test_call0.c

示例9: testCap_getSegment

void testCap_getSegment(CuTest* testCase) {
    cactusCapTestSetup();
    Block *block = block_construct(2, flower);
    Segment *segment = segment_construct(block, rootEvent);
    CuAssertTrue(testCase, cap_getSegment(segment_get5Cap(segment)) == segment);
    CuAssertTrue(testCase, cap_getSegment(segment_get3Cap(segment)) == segment);
    CuAssertTrue(testCase, cap_getOrientation(segment_get5Cap(segment)) == segment_getOrientation(segment));
    CuAssertTrue(testCase, cap_getOrientation(segment_get3Cap(segment)) == segment_getOrientation(segment));
    CuAssertTrue(testCase, cap_getSegment(cap_getReverse(segment_get5Cap(segment))) == segment_getReverse(segment));
    CuAssertTrue(testCase, cap_getSegment(cap_getReverse(segment_get3Cap(segment))) == segment_getReverse(segment));
    cactusCapTestTeardown();
}
开发者ID:benedictpaten,项目名称:cactus,代码行数:12,代码来源:cactusCapTest.c

示例10: TestSetLockDetect

int TestSetLockDetect(CuTest *ct) {
	DB_ENV *dbenv;
	u_int32_t v;

	dbenv = NULL;
	/* lk_detect: NOT reset at run-time. */
	ENV
	CuAssertTrue(ct, dbenv->set_lk_detect(dbenv, DB_LOCK_MAXLOCKS) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv,
	    TEST_ENV, DB_CREATE | DB_INIT_LOCK, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_lk_detect(dbenv, &v) == 0);
	CuAssertTrue(ct, v == DB_LOCK_MAXLOCKS);
	ENV
	CuAssertTrue(ct, dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv, TEST_ENV, DB_JOINENV, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_lk_detect(dbenv, &v) == 0);
	CuAssertTrue(ct, v == DB_LOCK_MAXLOCKS);
	return (0);
}
开发者ID:CompassHXM,项目名称:h-store,代码行数:19,代码来源:TestEnvConfig.c

示例11: TestSetLogRegionSize

int TestSetLogRegionSize(CuTest *ct) {
	DB_ENV *dbenv;
	u_int32_t v;

	dbenv = NULL;
	/* lg_regionmax: NOT reset at run-time. */
	ENV
	CuAssertTrue(ct, dbenv->set_lg_regionmax(dbenv, 137 * 1024) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv,
	    TEST_ENV, DB_CREATE | DB_INIT_LOG, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_lg_regionmax(dbenv, &v) == 0);
	CuAssertTrue(ct, v == 137 * 1024);
	ENV
	CuAssertTrue(ct, dbenv->set_lg_regionmax(dbenv, 163 * 1024) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv, TEST_ENV, DB_JOINENV, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_lg_regionmax(dbenv, &v) == 0);
	CuAssertTrue(ct, v == 137 * 1024);
	return (0);
}
开发者ID:CompassHXM,项目名称:h-store,代码行数:19,代码来源:TestEnvConfig.c

示例12: TestSetLockMaxObjects

int TestSetLockMaxObjects(CuTest *ct) {
	DB_ENV *dbenv;
	u_int32_t v;

	dbenv = NULL;
	/* lk_max_objects: NOT reset at run-time. */
	ENV
	CuAssertTrue(ct, dbenv->set_lk_max_objects(dbenv, 1037) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv,
	    TEST_ENV, DB_CREATE | DB_INIT_LOCK, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_lk_max_objects(dbenv, &v) == 0);
	CuAssertTrue(ct, v == 1037);
	ENV
	CuAssertTrue(ct, dbenv->set_lk_max_objects(dbenv, 1063) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv, TEST_ENV, DB_JOINENV, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_lk_max_objects(dbenv, &v) == 0);
	CuAssertTrue(ct, v == 1037);
	return (0);
}
开发者ID:CompassHXM,项目名称:h-store,代码行数:19,代码来源:TestEnvConfig.c

示例13: test_stSortedSetUnion

static void test_stSortedSetUnion(CuTest* testCase) {
    sonLibSortedSetTestSetup();
    //Check intersection of empty sets is okay..
    stSortedSet *sortedSet3 = stSortedSet_getUnion(sortedSet, sortedSet2);
    CuAssertTrue(testCase, stSortedSet_size(sortedSet3) == 0);
    stSortedSet_destruct(sortedSet3);

    int32_t i;
    for(i=0; i<size; i++) {
        stSortedSet_insert(sortedSet, stIntTuple_construct(1, input[i]));
    }

    //Check intersection of empty and non-empty set is equal to the non-empty set.
    sortedSet3 = stSortedSet_getUnion(sortedSet, sortedSet2);
    CuAssertTrue(testCase, stSortedSet_equals(sortedSet, sortedSet3));
    stSortedSet_destruct(sortedSet3);

    //Check intersection of two non-empty, overlapping sets in correct.
    stSortedSet_insert(sortedSet2, stIntTuple_construct(1, 0));
    stSortedSet_insert(sortedSet2, stIntTuple_construct(1, 1));
    stSortedSet_insert(sortedSet2, stIntTuple_construct(1, 5));

    sortedSet3 = stSortedSet_getUnion(sortedSet, sortedSet2);
    CuAssertTrue(testCase, stSortedSet_size(sortedSet3) == stSortedSet_size(sortedSet) + 1);
    CuAssertTrue(testCase, !stSortedSet_equals(sortedSet, sortedSet3));
    stSortedSet_insert(sortedSet, stIntTuple_construct(1, 0));
    CuAssertTrue(testCase, stSortedSet_size(sortedSet3) == stSortedSet_size(sortedSet));
    CuAssertTrue(testCase, stSortedSet_equals(sortedSet, sortedSet3));
    stSortedSet_destruct(sortedSet3);

    //Check we get an exception with sorted sets with different comparators.
    stSortedSet *sortedSet4 = stSortedSet_construct();
    stTry {
        stSortedSet_getUnion(sortedSet, sortedSet4);
        CuAssertTrue(testCase, 0);
    } stCatch(except) {
        CuAssertTrue(testCase, stExcept_getId(except) == SORTED_SET_EXCEPTION_ID);
    }
    stTryEnd
    stSortedSet_destruct(sortedSet4);

    sonLibSortedSetTestTeardown();
}
开发者ID:sorrywm,项目名称:sonLib,代码行数:43,代码来源:sonLibSortedSetTest.c

示例14: TestSetTxMax

int TestSetTxMax(CuTest *ct) {
	DB_ENV *dbenv;
	u_int32_t v;

	dbenv = NULL;
	/* tx_max: NOT reset at run-time. */
	ENV
	CuAssertTrue(ct, dbenv->set_tx_max(dbenv, 37) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv,
	    TEST_ENV, DB_CREATE | DB_INIT_TXN, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_tx_max(dbenv, &v) == 0);
	CuAssertTrue(ct, v == 37);
	ENV
	CuAssertTrue(ct, dbenv->set_tx_max(dbenv, 63) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv, TEST_ENV, DB_JOINENV, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_tx_max(dbenv, &v) == 0);
	CuAssertTrue(ct, v == 37);
	return (0);
}
开发者ID:CompassHXM,项目名称:h-store,代码行数:19,代码来源:TestEnvConfig.c

示例15: test_stList_filter

void test_stList_filter(CuTest *testCase) {
    setup();
    stSortedSet *set = stSortedSet_construct();
    stSortedSet_insert(set, strings[0]);
    stSortedSet_insert(set, strings[4]);
    stList *list2 = stList_filterToExclude(list, set);
    stList *list3 = stList_filterToInclude(list, set);
    CuAssertTrue(testCase,stList_length(list2) == 3);
    CuAssertTrue(testCase,stList_length(list3) == 2);
    CuAssertTrue(testCase,stList_get(list2, 0) == strings[1]);
    CuAssertTrue(testCase,stList_get(list2, 1) == strings[2]);
    CuAssertTrue(testCase,stList_get(list2, 2) == strings[3]);
    CuAssertTrue(testCase,stList_get(list3, 0) == strings[0]);
    CuAssertTrue(testCase,stList_get(list3, 1) == strings[4]);
    teardown();
}
开发者ID:adderan,项目名称:sonLib,代码行数:16,代码来源:sonLibListTest.c


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