void eighthTestCase02(void) { int i, r; ArrayList* list; Employee* pAux[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]); } for(i=LENGTH-1; i >=0 ; i--) { r = list->remove(list,0); utest_assertEqualsIntMsg(r,0,"Error in return value <remove(list,0)> if ok the correct value to return is 0"); } utest_assertEqualsIntMsg(list->size,0,"Error in the size of the array, after remove all the elements the correct value is 0"); free(list); for(i=0; i < LENGTH; i++) free(pAux[i]); }
void secondTestCase03(void) { int i,r; i = 0; for(i=0; i < LENGTH; i++) { r = addEmployee(arrayEmployees, LENGTH,id[i],unsortedList[i],unsortedList[i],salary[i],sector[i]); utest_assertEqualsIntMsg(r,0,"Error en valor de retorno, si se pudo agregar un empleado el valor a retornar es (0)"); } r = addEmployee(arrayEmployees, LENGTH,id[i],unsortedList[i],unsortedList[i],salary[i],sector[i]); utest_assertEqualsIntMsg(r,-1,"Error en valor de retorno, si el array esta lleno y no se pudo agregar\nun empleado el valor a retornar es (-1)"); }
void seventhTestCase04(void) { int i, r; ArrayList* list; Employee* pAux[LENGTH]; Employee* pAuxToSet; 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]); r = list->set(NULL,0,pAuxToSet); utest_assertEqualsIntMsg(r,-1,"Error in return value <set> if the pointer to the new Element is NULL the correct value to return is -1"); free(list); }
void fifthTestCase01(void) { int r; r = sortEmployeeByName(arrayEmployees, LENGTH, 1); utest_assertEqualsIntMsg(r,0,"Error in return value <sortEmployeeByName> if ok the correct value to return is: (0)"); }
void secondTestCase05(void) { int i,r; i = 0; r = addEmployee(arrayEmployees, 0,id[i],unsortedList[i],unsortedList[i],salary[i],sector[i]); utest_assertEqualsIntMsg(r,-1,"Error en valor de retorno, si se recibe una logitud erronea [length < 1]\nel valor a retornar es (-1)"); }
void secondTestCase04(void) { int i,r; i = 0; r = addEmployee(NULL, LENGTH,id[i],unsortedList[i],unsortedList[i],salary[i],sector[i]); utest_assertEqualsIntMsg(r,-1,"Error en valor de retorno, si se recibe un puntero NULL el valor a retornar es (-1)"); }
void fourthTestCase01(void) { int i,r; i = 2; 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)"); }
void twelfthTestCase02(void) { int i, r; ArrayList* list; Employee* pAux[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]); } for(i=0; i < LENGTH; i++) { r = list->indexOf(list,pAux[i]); utest_assertEqualsIntMsg(r,i,"Error in return value <indexOf> the correct value to return is the index"); } free(list); for(i=0; i < LENGTH; i++) free(pAux[i]); }
void fourthTestCase03(void) { int i,r; i = 0; r = removeEmployee(NULL, LENGTH, id[i]); utest_assertEqualsIntMsg(r,-1,"Error en valor de retorno, si se recibe un puntero NULL el valor a retornar es (-1)"); }
void fourthTestCase04(void) { int i,r; i = 0; r = removeEmployee(arrayEmployees, 0, id[i]); utest_assertEqualsIntMsg(r,-1,"Error en valor de retorno, si se recibe una logitud erronea [length < 1]\nel valor a retornar es (-1)"); }
void eleventhTestCase01(void) { int i, r; ArrayList* list; Employee* pAux[LENGTH]; Employee* pAuxToPush; 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]); } pAuxToPush = newEmployee(id[5],unsortedList[5],unsortedList[5],salary[5],sector[5]); r = list->push(list,i-1,pAuxToPush); utest_assertEqualsIntMsg(r,0,"Error in return value <push> if ok the correct value to return is 0"); free(list); free(pAuxToPush); for(i=0; i < LENGTH; i++) free(pAux[i]); }
void fifthTestCase05(void) { int r; r = sortEmployeeByName(arrayEmployees, 0, 0); utest_assertEqualsIntMsg(r,-1,"Error in return value <sortEmployeeByName> if LENGTH of array is invalid, the correct value to return is: (-1)"); }
void fifthTestCase04(void) { int r; r = sortEmployeeByName(NULL, LENGTH, 0); utest_assertEqualsIntMsg(r,-1,"Error in return value <sortEmployeeByName> if array pointer is NULL, the correct value to return is: (-1)"); }
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)"); }
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)"); }
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>"); } }
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>"); } }
void thirdTestCase01(void) { int r; ArrayList* list=NULL; r = al_deleteArrayList(list); utest_assertEqualsIntMsg(r,-1,"Error in return value <deleteArrayList> if array pointer is NULL, the correct value to return is: (-1)"); }
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]); }
void thirdTestCase02(void) { int r; ArrayList* list; list = al_newArrayList(); r = al_deleteArrayList(list); utest_assertEqualsIntMsg(r,0,"Error in return value <deleteArrayList> if array pointer is valid, the correct value to return is: (0)"); if(r != 0) free(list); }
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]); }
void eighthTestCase03(void) { int i, r; ArrayList* list; Employee* pAux[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]); } r = list->set(list,9); utest_assertEqualsIntMsg(r,-1,"Error in return value <remove> if the index is invalid the correct value to return is -1"); free(list); }
void twelfthTestCase04(void) { int i, r; ArrayList* list; Employee* pAux[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]); } r = list->indexOf(list,NULL); utest_assertEqualsIntMsg(r,-1,"Error in return value <indexOf> if the pointer to Element is NULL the correct value to return is -1"); free(list); for(i=0; i < LENGTH; i++) free(pAux[i]); }
void seventeenthTestCase01(void) { int i,r; ArrayList* list; Employee* pAux[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]); } r = list->sort(list, compareEmployee,1); utest_assertEqualsIntMsg(r, 0 ,"Error in return value of <sort> if the list is contained the correct value is 1"); free(list); for(i=0; i < LENGTH; i++) free(pAux[i]); }
void seventeenthTestCase04(void) { int i,r; ArrayList* list; Employee* pAux[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]); } r = list->sort(list, NULL,1); utest_assertEqualsIntMsg(r, -1 ,"Error in return value of <sort> if the pointer to Function is Null the correct value is -1"); free(list); for(i=0; i < LENGTH; i++) free(pAux[i]); }