Browse Source

SchereSteinPapier zu Menue hinzugefügt

remotes/origin/bmidev
Lennart Goetze 11 months ago
parent
commit
f03e73204c
  1. 56
      build/test/cache/test_SchereSteinPapier.c
  2. BIN
      build/test/out/c/test_SchereSteinPapier.o
  3. BIN
      build/test/out/c/test_SchereSteinPapier_runner.o
  4. BIN
      build/test/out/test_SchereSteinPapier.out
  5. 56
      build/test/preprocess/files/test_SchereSteinPapier.c
  6. 10
      build/test/results/test_SchereSteinPapier.pass
  7. 2
      build/test/results/test_ageinseconds.pass
  8. 2
      build/test/results/test_minirechner.pass
  9. 2
      build/test/results/test_zahlenraten.pass
  10. 2
      build/test/runners/test_SchereSteinPapier_runner.c
  11. 7
      src/menue.c

56
build/test/cache/test_SchereSteinPapier.c

@ -41,3 +41,59 @@ void test_Scheresteinpapier_generateRandom(void) {
}
}
void test_Scheresteinpapier_determineWinner(void) {
for (int spieler = 0; spieler <= 2; ++spieler) {
for (int computer = 0; computer <= 2; ++computer) {
int result = determineWinner(spieler, computer);
if ((spieler == 0 && computer == 2) ||
(spieler == 1 && computer == 0) ||
(spieler == 2 && computer == 1)) {
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT);
}
else if (spieler == computer) {
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(38), UNITY_DISPLAY_STYLE_INT);
}
else {
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(41), UNITY_DISPLAY_STYLE_INT);
}
}
}
}

BIN
build/test/out/c/test_SchereSteinPapier.o

BIN
build/test/out/c/test_SchereSteinPapier_runner.o

BIN
build/test/out/test_SchereSteinPapier.out

56
build/test/preprocess/files/test_SchereSteinPapier.c

@ -41,3 +41,59 @@ void test_Scheresteinpapier_generateRandom(void) {
}
}
void test_Scheresteinpapier_determineWinner(void) {
for (int spieler = 0; spieler <= 2; ++spieler) {
for (int computer = 0; computer <= 2; ++computer) {
int result = determineWinner(spieler, computer);
if ((spieler == 0 && computer == 2) ||
(spieler == 1 && computer == 0) ||
(spieler == 2 && computer == 1)) {
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT);
}
else if (spieler == computer) {
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(38), UNITY_DISPLAY_STYLE_INT);
}
else {
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(41), UNITY_DISPLAY_STYLE_INT);
}
}
}
}

10
build/test/results/test_SchereSteinPapier.pass

@ -7,12 +7,16 @@
:line: 15
:message: ''
:unity_test_time: 0
- :test: test_Scheresteinpapier_determineWinner
:line: 25
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 1
:passed: 1
:total: 2
:passed: 2
:failed: 0
:ignored: 0
:stdout: []
:time: 0.03652950000105193
:time: 0.04412409999895317

2
build/test/results/test_ageinseconds.pass

@ -23,4 +23,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.03658220000033907
:time: 0.040927000000010594

2
build/test/results/test_minirechner.pass

@ -83,4 +83,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.03659530000004452
:time: 0.04142449999926612

2
build/test/results/test_zahlenraten.pass

@ -15,4 +15,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.03663650000089547
:time: 0.04121030000169412

2
build/test/runners/test_SchereSteinPapier_runner.c

@ -11,6 +11,7 @@ char* GlobalOrderError;
extern void setUp(void);
extern void tearDown(void);
extern void test_Scheresteinpapier_generateRandom(void);
extern void test_Scheresteinpapier_determineWinner(void);
/*=======Mock Management=====*/
@ -76,6 +77,7 @@ int main(void)
{
UnityBegin("test_SchereSteinPapier.c");
run_test(test_Scheresteinpapier_generateRandom, "test_Scheresteinpapier_generateRandom", 15);
run_test(test_Scheresteinpapier_determineWinner, "test_Scheresteinpapier_determineWinner", 25);
return UnityEnd();
}

7
src/menue.c

@ -4,6 +4,7 @@ int run_minirechner();
int run_ageinseconds();
int run_magiceightball();
void run_zahlenraten();
int run_scheresteinpapier();
void trenner () {
// Die laenge der Abtrenner kann hier fuer alle 3 angepasst werden
@ -16,7 +17,7 @@ int main() {
while (eingabe != 0) {
trenner();
printf("\nWelches Programm wollen Sie starten?\n<1> Minirechner \n<2> AlterinSekunden\n<3> MagicEightBall\n<4> Zahlenraten\nZum Abbrechen 0 eingeben.\n");
printf("\nWelches Programm wollen Sie starten?\n<1> Minirechner \n<2> AlterinSekunden\n<3> MagicEightBall\n<4> Zahlenraten\n<5> SchereSteinPapier\nZum Abbrechen 0 eingeben.\n");
trenner();
printf("\nEingabe: ");
scanf("%d", &eingabe);
@ -43,6 +44,10 @@ int main() {
case 4:
run_zahlenraten();
break;
case 5:
run_scheresteinpapier();
break;
default:
printf("Bitte verwenden sie eine der gegebenen Ziffern");

Loading…
Cancel
Save