Exemplo n.º 1
0
void block_setRootInstance(Block *block, Segment *segment) {
	block = block_getPositiveOrientation(block);
	segment = segment_getPositiveOrientation(segment);
	assert(block_getInstance(block, segment_getName(segment)) == segment);
	end_setRootInstance(block_get5End(block), segment_get5Cap(segment));
	end_setRootInstance(block_get3End(block), segment_get3Cap(segment));
}
Exemplo n.º 2
0
void testBlock_serialisation(CuTest* testCase) {
    cactusBlockTestSetup();
    Name rootInstanceName = segment_getName(rootSegment);
    Name leaf1InstanceName = segment_getName(leaf1Segment);
    Name leaf2InstanceName = segment_getName(leaf2Segment);
    int64_t i;
    void
            *vA =
                    binaryRepresentation_makeBinaryRepresentation(block,
                            (void(*)(void *, void(*)(const void *, size_t,
                                    size_t))) block_writeBinaryRepresentation,
                            &i);
    CuAssertTrue(testCase, i > 0);
    block_destruct(block);
    void *vA2 = vA;
    block = block_loadFromBinaryRepresentation(&vA2, flower);
    rootSegment
            = segment_getReverse(block_getInstance(block, rootInstanceName));
    leaf1Segment = block_getInstance(block, leaf1InstanceName);
    leaf2Segment = segment_getReverse(block_getInstance(block,
            leaf2InstanceName));
    free(vA);
    nestedTest = 1;
    testBlock_getName(testCase);
    testBlock_getOrientation(testCase);
    testBlock_getReverse(testCase);
    testBlock_getLength(testCase);
    testBlock_getFlower(testCase);
    testBlock_getLeftEnd(testCase);
    testBlock_getRightEnd(testCase);
    testBlock_getSetRootInstance(testCase);
    testBlock_getInstanceNumber(testCase);
    testBlock_getInstance(testCase);
    testBlock_getFirst(testCase);
    testBlock_instanceIterator(testCase);
    testBlock_makeNewickString(testCase);
    testBlock_getChain(testCase);
    testBlock_getSegmentForEvent(testCase);
    nestedTest = 0;
    cactusBlockTestTeardown();
}
Exemplo n.º 3
0
void testBlock_getInstance(CuTest* testCase) {
    cactusBlockTestSetup();
    CuAssertTrue(testCase, block_getInstance(block, segment_getName(rootSegment)) == segment_getReverse(rootSegment));
    CuAssertTrue(testCase, block_getInstance(block, segment_getName(leaf1Segment)) == leaf1Segment);
    CuAssertTrue(testCase, block_getInstance(block, segment_getName(leaf2Segment)) == segment_getReverse(leaf2Segment));

    CuAssertTrue(testCase, block_getInstance(block_getReverse(block), segment_getName(rootSegment)) == rootSegment);
    CuAssertTrue(testCase, block_getInstance(block_getReverse(block), segment_getName(leaf1Segment)) == segment_getReverse(leaf1Segment));
    CuAssertTrue(testCase, block_getInstance(block_getReverse(block), segment_getName(leaf2Segment)) == leaf2Segment);

    cactusBlockTestTeardown();
}