當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。