Beispiel #1
0
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)");
}
Beispiel #2
0
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)");
}
Beispiel #3
0
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)");
}
Beispiel #4
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>");
    }
}
Beispiel #5
0
int main()
{
    Employee employees[LEN_EMPLOYEES];
    initEmployees(employees,LEN_EMPLOYEES);
    char seguir = 'S';
    int id;
    char name[51];
    char lastName[51];
    float salary;
    int sector;

    do
    {
        system("cls");//system("clear");

        switch(menu())
        {
            case 1:

                system("cls");//system("clear");
                printf("---------ALTA--------\n\n");
                id = getId();
                strncpy(name,getStringSoloLetras("Ingrese NOMBRE: "),51);
                strncpy(lastName,getStringSoloLetras("Ingrese APELLIDO: "),51);
                salary = getFloat("Ingrese SALARIO: ");
                sector = getInt("Ingrese SECTOR: ");
                system("cls");//system("clear");
                if(addEmployee(employees,LEN_EMPLOYEES,id,name,lastName,salary,sector) == -1)
                {
                    printf("Error al ingresar datos!");
                }

                system("pause");

            break;

            case 2:
                system("cls");//system("clear");
                if(verifyAllEmpty(employees,LEN_EMPLOYEES) == 0)
                {
                    printf("NO HAY EMPLEADOS INGRESADOS!\n");
                }
                else
                {
                    printf("------------MODIFICAR-----------\n\n");
                    printEmployees(employees,LEN_EMPLOYEES);
                    id = getInt("\n\nIngrese ID del empleado que desea modificar: ");
                    if(findEmployeeById(employees,LEN_EMPLOYEES,id) == -1)
                    {
                        printf("NO EXISTE ESTE EMPLEADO\n");
                        system("pause");
                        break;
                    }

                    if(modifyEmployee(employees,LEN_EMPLOYEES,id) == -1)
                    {
                        printf("\nError!");
                    }

                }

                system("pause");
                system("cls");//system("clear");
                break;

            case 3:
                system("cls");//system("clear");
                if(verifyAllEmpty(employees,LEN_EMPLOYEES) == 0)
                {
                    printf("NO HAY EMPLEADOS INGRESADOS!\n");
                }
                else
                {
                    printf("------------ELIMINAR-----------\n\n");
                    printEmployees(employees,LEN_EMPLOYEES);
                    id = getInt("\n\nIngrese ID del empleado que desea eliminar: ");
                    if(findEmployeeById(employees,LEN_EMPLOYEES,id) == -1)
                    {
                        printf("NO EXISTE ESTE EMPLEADO\n");
                        system("pause");
                        break;
                    }

                    if(removeEmployee(employees,LEN_EMPLOYEES,id) == -1)
                    {
                        printf("\nError!");
                    }
                }

                system("pause");
                system("cls");//system("clear");
                break;

            case 4:
                system("cls");//system("clear");

                if(verifyAllEmpty(employees,LEN_EMPLOYEES) == 0)
                {
                    printf("NO HAY EMPLEADOS INGRESADOS!\n");
                }
                else
                {
                    printf("------------INFORMAR-----------\n\n");
                    sortEmployees(employees,LEN_EMPLOYEES);
                    printEmployees(employees,LEN_EMPLOYEES);
                }
                system("pause");
                system("cls");
                break;
        }

    }while(seguir == 'S');

    return 0;
}