Ejemplo n.º 1
0
void fifthTestCase01(void)
{
    int i;
    ArrayList* list;
    Employee* pAux[LENGTH];
    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]);
    }

    for(i=0; i < LENGTH; i++)
    {
        pAuxGet = list->get(list,i);
        utest_assertNotNullMsg(pAuxGet,"Error in return value <get> if ok the correct value to return is not NULL");
    }


    free(list);
    for(i=0; i < LENGTH; i++)
        free(pAux[i]);
}
Ejemplo n.º 2
0
void seventeenthTestCase02(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->add(list,pAux[i]);
    }

    list->sort(list, compareEmployee,0);

    for(i=0; i < LENGTH; 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_assertEqualsFloatMsg(((Employee*)pAuxGet[i])->salary,salarySortedUp[i],"Error value in <.salary> after sort");
    }

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



}
Ejemplo n.º 3
0
void thirdTestCase01(void)
{
    int i;
    employee* pEmployee;
    i = 4;

    pEmployee = findEmployeeById(arrayEmployees, LENGTH, id[i]);
    utest_assertNotNullMsg(pEmployee,"Error the pointer is NULL");


}
Ejemplo n.º 4
0
void thirdTestCase01(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");


}
Ejemplo n.º 5
0
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)");

}
Ejemplo n.º 6
0
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)");

}
Ejemplo n.º 7
0
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]);



}