diff --git a/src/c/rockPaperScissors.c b/src/c/rockPaperScissors.c new file mode 100644 index 0000000..2a1b239 --- /dev/null +++ b/src/c/rockPaperScissors.c @@ -0,0 +1,12 @@ +#include +#include +#include + +#include "rockPaperScissors.h" + + +char findWinner(int inputPlayer, int inputComputer){ + if (inputPlayer == inputComputer){ + return 'n'; + } +} \ No newline at end of file diff --git a/src/c/rockPaperScissors.h b/src/c/rockPaperScissors.h new file mode 100644 index 0000000..4531af5 --- /dev/null +++ b/src/c/rockPaperScissors.h @@ -0,0 +1,6 @@ +#ifndef ROCKPAPERSCISSORS_H +#define ROCKPAPERSCISSORS_H + +char findWinner(int inputPlayer, int inputComputer); + +#endif \ No newline at end of file diff --git a/test/c/test_rockPaperScissors.c b/test/c/test_rockPaperScissors.c new file mode 100644 index 0000000..fd2745e --- /dev/null +++ b/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 +*/ \ No newline at end of file