コード例 #1
0
ファイル: thirdTest.c プロジェクト: mavocado3/utest
void thirdTestCase02(void)
{
    int i;
    employee* pEmployee;
    i = 4;

    pEmployee = findEmployeeById(arrayEmployees, LENGTH, id[i]);

    utest_assertNotNullMsg(pEmployee,"Error the pointer is NULL");
    utest_assertEqualsIntMsg(pEmployee->id,id[i],"Error value in <.id>");
    utest_assertEqualsStringMsg(pEmployee->name,unsortedList[i],2,"Error value in <.name>");
    utest_assertEqualsStringMsg(pEmployee->lastName,unsortedList[i],2,"Error value in <.lastName>");
    utest_assertEqualsFloatMsg(pEmployee->salary,salary[i],"Error value in <.salary>");
    utest_assertEqualsIntMsg(pEmployee->sector,sector[i],"Error value in <.sector>");
    utest_assertEqualsIntMsg(pEmployee->isEmpty,0,"Error value in <.isEmpty> the correct value is: (0)");

}
コード例 #2
0
ファイル: thirdTest.c プロジェクト: davilamr/utest
void thirdTestCase02(void)
{
    int i;
    employee* pEmployee;
    i = 4;

    pEmployee = findEmployeeById(arrayEmployees, LENGTH, id[i]);

    utest_assertNotNullMsg(pEmployee,"Error en valor de retorno, si se encontro un empleado el valor es distinto de NULL");
    utest_assertEqualsIntMsg(pEmployee->id,id[i],"Error de valor en <.id>");
    utest_assertEqualsStringMsg(pEmployee->name,unsortedList[i],2,"Error de valor en <.name>");
    utest_assertEqualsStringMsg(pEmployee->lastName,unsortedList[i],2,"Error de valor en <.lastName>");
    utest_assertEqualsFloatMsg(pEmployee->salary,salary[i],"Error de valor en <.salary>");
    utest_assertEqualsIntMsg(pEmployee->sector,sector[i],"Error de valor en <.sector>");
    utest_assertEqualsIntMsg(pEmployee->isEmpty,0,"Error de valor en <.isEmpty> el valor correcto para\nindicar que la posicion esta ocupada es (0)");

}
コード例 #3
0
ファイル: fourthTest.c プロジェクト: davilamr/utest
void fourthTestCase02(void)
{
    int i,r;
    for(i=0; i < LENGTH; i++)
    {
        r = removeEmployee(arrayEmployees, LENGTH, id[i]);
        utest_assertEqualsIntMsg(r,0,"Error en valor de retorno, si se pudo remover un empleado el valor a retornar es (0)");
    }
    for (i=0;i < LENGTH;i++)
    {
        utest_assertEqualsIntMsg(arrayEmployees[i].isEmpty,1,"Error de valor en <.isEmpty> el valor correcto para\nindicar que la posicion esta libre es (1)");
        utest_assertEqualsIntMsg(arrayEmployees[i].id,id[i],"Error de valor en <.id>");
        utest_assertEqualsStringMsg(arrayEmployees[i].name,unsortedList[i],2,"Error de valor en <.name>");
        utest_assertEqualsStringMsg(arrayEmployees[i].lastName,unsortedList[i],2,"Error de valor en <.lastName>");
        utest_assertEqualsFloatMsg(arrayEmployees[i].salary,salary[i],"Error de valor en <.salary>");
        utest_assertEqualsIntMsg(arrayEmployees[i].sector,sector[i],"Error de valor en <.sector>");
    }
}
コード例 #4
0
ファイル: fifthTest.c プロジェクト: davilamr/utest
void fifthTestCase03(void)
{
    int i;
    sortEmployeeByName(arrayEmployees, LENGTH, 0);
    for (i=0;i < LENGTH;i++)
    {
        utest_assertEqualsStringMsg(arrayEmployees[i].name,sortedListDown[i],2,"Error value in <.name>");
        utest_assertEqualsIntMsg(arrayEmployees[i].id,sortedIdDown[i],"Error value in <.id>");
    }
}
コード例 #5
0
ファイル: seventhTest.c プロジェクト: Blacknux/ArrayList
void seventhTestCase02(void)
{
    int i, r;
    ArrayList* list;
    Employee* pAux[LENGTH];
    Employee* pAuxToSet;
    Employee* pAuxGet;

    list = al_newArrayList();

    for(i=0; i < LENGTH; i++)
    {
        pAux[i] = newEmployee(id[i],unsortedList[i],unsortedList[i],salary[i],sector[i]);
        list->add(list,pAux[i]);
    }
    pAuxToSet = newEmployee(id[5],unsortedList[5],unsortedList[5],salary[5],sector[5]);

    for(i=0; i < LENGTH; i++)
    {
        r = list->set(list,i,pAuxToSet);
        utest_assertEqualsIntMsg(r,0,"Error in return value <set> if ok the correct value to return is 0");
    }

    for (i=0;i < LENGTH;i++)
    {
        pAuxGet = list->get(list,i);
        utest_assertEqualsIntMsg(((Employee*)pAuxGet)->id,id[5],"Error value in <.id>");
        utest_assertEqualsStringMsg(((Employee*)pAuxGet)->name,unsortedList[5],2,"Error value in <.name>");
        utest_assertEqualsStringMsg(((Employee*)pAuxGet)->lastName,unsortedList[5],2,"Error value in <.lastName>");
        utest_assertEqualsFloatMsg(((Employee*)pAuxGet)->salary,salary[5],"Error value in <.salary>");
        utest_assertEqualsIntMsg(((Employee*)pAuxGet)->sector,sector[5],"Error value in <.sector>");
        utest_assertEqualsIntMsg(((Employee*)pAuxGet)->isEmpty,0,"Error value in <.isEmpty> the correct value is: (0)");

    }


    free(list);
    free(pAuxToSet);
    for(i=0; i < LENGTH; i++)
        free(pAux[i]);
}
コード例 #6
0
ファイル: eleventhTest.c プロジェクト: Blacknux/ArrayList
void eleventhTestCase02(void)
{
    int i;
    ArrayList* list;
    Employee* pAux[LENGTH];
    Employee* pAuxGet[LENGTH];

    list = al_newArrayList();

    for(i=0; i < LENGTH; i++)
    {
        pAux[i] = newEmployee(id[i],unsortedList[i],unsortedList[i],salary[i],sector[i]);
        list->push(list,i,pAux[i]);
        pAuxGet[i] = list->get(list,i);
        utest_assertNotNullMsg(pAuxGet[i],"Error in return value <get> if ok the correct value to return is not NULL");
    }



    for (i=0;i < LENGTH;i++)
    {
        utest_assertEqualsIntMsg(((Employee*)pAuxGet[i])->id,id[i],"Error value in <.id>");
        utest_assertEqualsStringMsg(((Employee*)pAuxGet[i])->name,unsortedList[i],2,"Error value in <.name>");
        utest_assertEqualsStringMsg(((Employee*)pAuxGet[i])->lastName,unsortedList[i],2,"Error value in <.lastName>");
        utest_assertEqualsFloatMsg(((Employee*)pAuxGet[i])->salary,salary[i],"Error value in <.salary>");
        utest_assertEqualsIntMsg(((Employee*)pAuxGet[i])->sector,sector[i],"Error value in <.sector>");
        utest_assertEqualsIntMsg(((Employee*)pAuxGet[i])->isEmpty,0,"Error value in <.isEmpty> the correct value is: (0)");

    }

    free(list);
    for(i=0; i < LENGTH; i++)
        free(pAux[i]);



}