Browse Source

same Results no winner

remotes/origin/SchereSteinPapier
Aimee Reincke 2 years ago
parent
commit
d329ec78cb
  1. 12
      src/c/rockPaperScissors.c
  2. 6
      src/c/rockPaperScissors.h
  3. 42
      test/c/test_rockPaperScissors.c

12
src/c/rockPaperScissors.c

@ -0,0 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rockPaperScissors.h"
char findWinner(int inputPlayer, int inputComputer){
if (inputPlayer == inputComputer){
return 'n';
}
}

6
src/c/rockPaperScissors.h

@ -0,0 +1,6 @@
#ifndef ROCKPAPERSCISSORS_H
#define ROCKPAPERSCISSORS_H
char findWinner(int inputPlayer, int inputComputer);
#endif

42
test/c/test_rockPaperScissors.c

@ -0,0 +1,42 @@
#ifdef TEST
#include "unity.h"
//in example.h wird die Funktion deklariert
#include "rockPaperScissors.h"
//Vor- bzw. Nachbereitung
void setUp(void)
{
}
void tearDown(void)
{
}
//Hier läuft der Test
void test_rockPaperScissors_sameResult(void)
{
/* arrange */
//Hier die Werte eingeben
char result; //p=player, c=computer, n=none
int inputPlayer = 1;
int inputComputer = inputPlayer;
/* act */
//Die Funktion wird ausgeführt
result = findWinner(inputPlayer, inputComputer);
/* assert */
//Vergleichen
TEST_ASSERT_EQUAL_INT('n', result);
}
#endif // TEST
/*Testcases:
rockPaperScissors_sameResult
rockPaperScissors_differentResultsPlayerWins
rockPaperScissors_differentResultsPlayerLoses
rockPaperScissors_playerGetsBestOutOf3
rockPaperScissors_computerGetsBestOutOf3
rockPaperScissors_outputResult
*/
Loading…
Cancel
Save