예제 #1
0
/**
 * @brief Test whether the treemap can handle left only and right only insertions
 *        using pooled memory.
 */
void testTreemapWorstCaseWithPools()
{
    lpx_treemap_t treemap;
    lpx_mempool_variable_t pool;
    printf("=======================================\n");
    assert(0 == lpx_mempool_create_variable_pool(&pool, 1024 * 1024, MEMPOOL_UNPROTECTED));
    
    assert(0 == lpx_treemap_init_from_pool(&treemap, TREEMAP_UNPROTECTED, &pool));
    treeTest1(&treemap);
    assert(0 == lpx_treemap_destroy(&treemap));

    assert(0 == lpx_treemap_init_from_pool(&treemap, TREEMAP_UNPROTECTED, &pool));
    treeTest2(&treemap);
    assert(0 == lpx_treemap_destroy(&treemap));
    
    assert(0 == lpx_treemap_init_from_pool(&treemap, TREEMAP_UNPROTECTED, &pool));
    treeTest3(&treemap);
    assert(0 == lpx_treemap_destroy(&treemap));

    assert(0 == lpx_treemap_init_from_pool(&treemap, TREEMAP_UNPROTECTED, &pool));
    treeTest4(&treemap);
    assert(0 == lpx_treemap_destroy(&treemap));

    assert(0 == lpx_mempool_destroy_variable_pool(&pool));
    printf("Test testTreemapWorstCaseWithPools passed.\n");
}
예제 #2
0
int main (void) {
    //basicTest();
    //entryTest();
    treeTest1();
    streamParse();

    return EXIT_SUCCESS;
}
예제 #3
0
/**
 * @brief Test whether the treemap can handle left only and right only insertions
 *        without using pooled memory.
 */
void testTreemapWorstCaseNoPools()
{
    lpx_treemap_t treemap;
    
    printf("=======================================\n");
    assert(0 == lpx_treemap_init(&treemap, TREEMAP_PROTECTED));
    treeTest1(&treemap);
    assert(0 == lpx_treemap_destroy(&treemap));
    
    assert(0 == lpx_treemap_init(&treemap, TREEMAP_PROTECTED));
    treeTest2(&treemap);
    assert(0 == lpx_treemap_destroy(&treemap));
    
    assert(0 == lpx_treemap_init(&treemap, TREEMAP_PROTECTED));
    treeTest3(&treemap);
    assert(0 == lpx_treemap_destroy(&treemap));
    
    assert(0 == lpx_treemap_init(&treemap, TREEMAP_PROTECTED));
    treeTest4(&treemap);
    assert(0 == lpx_treemap_destroy(&treemap));
    
    printf("Test testTreemapWorstCaseNoPools passed.\n");
}