Exemplo n.º 1
0
CUNIT_TEST(DBSuite, EagleDbInformationSchema_tables)
{
    int cores = 1;
    EagleDbInstance *db = EagleDbInstance_New(10, cores);

    /* parse sql */
    EagleDbParser *p = EagleDbParser_ParseWithString("select table_schema, table_name from information_schema_tables;");
    if (EagleTrue == EagleDbParser_hasError(p)) {
        CUNIT_FAIL("%s", EagleDbParser_lastError(p));
    }
    CUNIT_ASSERT_FALSE(EagleDbParser_hasError(p));

    EaglePlan *plan = EagleDbSqlSelect_parse((EagleDbSqlSelect*) p->yyparse_ast, db);
    if (EagleTrue == EaglePlan_isError(plan)) {
        CUNIT_FAIL("%s", plan->errorMessage);
    }
    CUNIT_ASSERT_FALSE(EaglePlan_isError(plan));

    /* execute */
    EagleInstance *eagle = EagleInstance_New(cores);
    EagleInstance_addPlan(eagle, plan);
    EagleInstance_run(eagle);

    /* check results */
    EaglePage *page1 = EaglePageProvider_nextPage(plan->result[0]);
    EaglePage *page2 = EaglePageProvider_nextPage(plan->result[1]);
    CUNIT_ASSERT_NOT_NULL(page1);
    CUNIT_ASSERT_NOT_NULL(page2);

    EaglePage_Delete(page1);
    EaglePage_Delete(page2);

    EagleDbSqlExpression_DeleteRecursive((EagleDbSqlExpression*) p->yyparse_ast);
    EaglePlan_Delete(plan);
    EagleInstance_Delete(eagle);
    EagleDbParser_Delete(p);
    EagleDbInstance_Delete(db);
}
Exemplo n.º 2
0
CUNIT_TEST(BenchSuite, calibrate)
{
    // calculate how long it takes to do a bunch of calculations
    uint64_t start = EagleUtils_GetAbsoluteTime();
    int a;
    for(int i = 0; i < BenchSuite_TotalPages * BenchSuite_RecordsPerPage; ++i) {
        a = i;
    }
    CUNIT_ASSERT_NOT_NULL(&a);
    uint64_t end = EagleUtils_GetAbsoluteTime();
    BenchSuite_CalibrateAddition = end - start;
    
    printf(" %lld nano seconds; ", BenchSuite_CalibrateAddition);
}