Browse Source

Merge branch 'feature/show-general-info-employee' into 'feature/employees-infos-access'

merging showGeneralInfoEmployee() into theMainMenu()

See merge request fdai7057/bankmanagement-system!15
remotes/origin/feature/employees-infos-access
fdai7514 2 years ago
parent
commit
020388d740
  1. 7
      project.yml
  2. 107
      src/showGeneralInfoEmployee.c
  3. 11
      src/showGeneralInfoEmployee.h
  4. 0
      tests/support/.gitkeep
  5. 63
      tests/test_showGeneralInfoEmployee.c

7
project.yml

@ -31,13 +31,12 @@
:paths:
:test:
- +:test/**
- -:test/support
- +:tests/**
- -:tests/support
:source:
- src/**
- src/
:support:
- test/support
- tests/support
:libraries: []
:defines:

107
src/showGeneralInfoEmployee.c

@ -0,0 +1,107 @@
#include "showGeneralInfoEmployee.h"
//int checkUser() is helpful for unittesting showGeneralInfoEmployee()
int checkUser(char username[length], char password[length])
{
if(strcmp(username,"Atharva")==0 && strcmp(password,"Atharvafdai7514")==0)
{
return 1;
}
if(strcmp(username,"Can")==0 && strcmp(password,"BlooMaskfdlt3817")==0)
{
return 2;
}
if(strcmp(username,"Haytham")==0 && strcmp(password,"TimoDLfdai7207")==0)
{
return 3;
}
if(strcmp(username,"Julius")==0 && strcmp(password,"Insertcatfdai7057")==0)
{
return 4;
}
if(strcmp(username,"Mohamed")==0 && strcmp(password,"MDfdai6618")==0)
{
return 5;
}
if(strcmp(username,"Shivam")==0 && strcmp(password,"Schivam007fdlt3781")==0)
{
return 6;
}
else
{
return 0;
}
}
void showGeneralInfoEmployee(char id[length], char password[length])
{
// "If Statements" check, whether the username and password match.
if(checkUser(id, password) == 1)
{
printf(" Welcome Atharva\n");
printf(" Clearance: 3\n");
printf("\n");
printf("\n");
printf(" ->Review new customer applications.\n");
}
if(checkUser(id, password) == 2)
{
printf(" Welcome Can\n");
printf(" Clearance: 3\n");
printf("\n");
printf("\n");
printf(" ->Review new customer applications.\n");
}
if(checkUser(id, password) == 3)
{
printf(" Welcome Haytham\n");
printf(" Clearance: 2\n");
printf("\n");
printf("\n");
printf(" ->Review new customer applications.\n");
printf(" ->Review loan applications.\n");
}
if(checkUser(id, password) == 4)
{
printf(" Welcome Julius\n");
printf(" Clearance: 2\n");
printf("\n");
printf("\n");
printf(" ->Review new customer applications.\n");
printf(" ->Review loan applications.\n");
}
if(checkUser(id, password) == 5)
{
printf(" Welcome Mohamed\n");
printf(" Clearance: 3\n");
printf("\n");
printf("\n");
printf(" ->Review new customer applications.\n");
printf(" ->Review loan applications.\n");
printf(" ->Terminate account.\n");
}
if(checkUser(id, password) == 6)
{
printf(" Welcome Shivam\n");
printf(" Clearance: 3\n");
printf("\n");
printf("\n");
printf(" ->Review new customer applications.\n");
printf(" ->Review loan applications.\n");
printf(" ->Terminate account.\n");
}
}

11
src/showGeneralInfoEmployee.h

@ -0,0 +1,11 @@
#ifndef SHOWGENERALINFOEMPLOYEE_H
#define SHOWGENERALINFOEMPLOYEE_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const int length = 100;
int checkUser(char username[length], char password[length]);
void showGeneralInfoEmployee(char id[length], char password[length]);
#endif // SHOWGENERALINFOEMPLOYEE_H

0
tests/support/.gitkeep

63
tests/test_showGeneralInfoEmployee.c

@ -0,0 +1,63 @@
#ifdef TEST
#include "unity.h"
#include "showGeneralInfoEmployee.c"
void setUp(void)
{
}
void tearDown(void)
{
}
void test1_showGeneralInfoEmployee(void)
{
char employeeName[] = "Atharva"; //Arrange
char password[] = "Atharvafdai7514";
int ergebnis = checkUser(employeeName, password); //Act
TEST_ASSERT_EQUAL_INT(1, ergebnis); //Assert
}
void test2_showGeneralInfoEmployee(void)
{
char employeeName[] = "Can"; //Arrange
char password[] = "BlooMaskfdlt3817";
int ergebnis = checkUser(employeeName, password); //Act
TEST_ASSERT_EQUAL_INT(2, ergebnis); //Assert
}
void test3_showGeneralInfoEmployee(void)
{
char employeeName[] = "Haytham"; //Arrange
char password[] = "TimoDLfdai7207";
int ergebnis = checkUser(employeeName, password); //Act
TEST_ASSERT_EQUAL_INT(3, ergebnis); //Assert
}
void test4_showGeneralInfoEmployee(void)
{
char employeeName[] = "Julius"; //Arrange
char password[] = "Insertcatfdai7057";
int ergebnis = checkUser(employeeName, password); //Act
TEST_ASSERT_EQUAL_INT(4, ergebnis); //Assert
}
void test5_showGeneralInfoEmployee(void)
{
char employeeName[] = "Mohamed"; //Arrange
char password[] = "MDfdai6618";
int ergebnis = checkUser(employeeName, password); //Act
TEST_ASSERT_EQUAL_INT(5, ergebnis); //Assert
}
void test6_showGeneralInfoEmployee(void)
{
char employeeName[] = "Shivam"; //Arrange
char password[] = "Schivam007fdlt3781";
int ergebnis = checkUser(employeeName, password); //Act
TEST_ASSERT_EQUAL_INT(6, ergebnis); //Assert
}
#endif // TEST
Loading…
Cancel
Save