Example #1
0
StreamChunk_c::StreamChunk_c( const StreamChunk_c& acrc_src )
  : Stream_c( acrc_src ),
    mlist_chunks( acrc_src.mlist_chunks ),
    mui32_writeCnt ( acrc_src.mui32_writeCnt ),
    mui32_parsedCnt( acrc_src.mui32_parsedCnt )
{
  copyIterator (acrc_src.mlist_chunks, acrc_src.mpc_iterWriteChunk,  mlist_chunks, mpc_iterWriteChunk);
  copyIterator (acrc_src.mlist_chunks, acrc_src.mpc_iterParsedChunk, mlist_chunks, mpc_iterParsedChunk);
}
Example #2
0
const StreamChunk_c& StreamChunk_c::operator=( const StreamChunk_c& acrc_src )
{
  Stream_c::operator=( acrc_src );

  mlist_chunks = acrc_src.mlist_chunks;
  copyIterator (acrc_src.mlist_chunks, acrc_src.mpc_iterWriteChunk,  mlist_chunks, mpc_iterWriteChunk);
  copyIterator (acrc_src.mlist_chunks, acrc_src.mpc_iterParsedChunk, mlist_chunks, mpc_iterParsedChunk);
  mui32_writeCnt  = acrc_src.mui32_writeCnt;
  mui32_parsedCnt = acrc_src.mui32_parsedCnt;
  return acrc_src;
}
Example #3
0
/*
 * This tests all the retrieval functions for each type of object.
 */
static void testObjectRetrieval(CuTest* testCase,
        int64_t(*getObjectNumberFn)(Flower *flower), void *(*getFirstObjectFn)(
                Flower *flower), Name(*objectGetNameFn)(void *),
        void *(*getObjectFn)(Flower *flower, Name name),
        void *(*constructIterator)(Flower *flower), void(*destructIterator)(
                void *iterator), void *(*getNext)(void *iterator),
        void *(*getPrevious)(void *iterator), void *(*copyIterator)(
                void *iterator), void *object, void *object2) {
    /*
     * Test number function
     */
    CuAssertTrue(testCase, getObjectNumberFn(flower) == 2);

    /*
     * Test get first function.
     */
    CuAssertTrue(testCase, getFirstObjectFn(flower) == object);

    /*
     * Test get function
     */
    if (objectGetNameFn != NULL) {
        CuAssertTrue(testCase, getObjectFn(flower, objectGetNameFn(object)) == object);
        CuAssertTrue(testCase, getObjectFn(flower, objectGetNameFn(object2)) == object2);
    } else {
        assert(getObjectFn == NULL);
    }

    /*
     * Test iterator.
     */
    void *iterator = constructIterator(flower);
    CuAssertTrue(testCase, getNext(iterator) == object);
    CuAssertTrue(testCase, getNext(iterator) == object2);
    CuAssertTrue(testCase, getNext(iterator) == NULL);
    void *iterator2 = copyIterator(iterator);
    CuAssertTrue(testCase, getPrevious(iterator) == object2);
    CuAssertTrue(testCase, getPrevious(iterator) == object);
    CuAssertTrue(testCase, getPrevious(iterator) == NULL);
    destructIterator(iterator);
    CuAssertTrue(testCase, getPrevious(iterator2) == object2);
    CuAssertTrue(testCase, getPrevious(iterator2) == object);
    CuAssertTrue(testCase, getPrevious(iterator2) == NULL);
    destructIterator(iterator2);
}