diff --git a/src/main/c/Pong/pong.c b/src/main/c/Pong/pong.c index f399fc2..44cfbc5 100644 --- a/src/main/c/Pong/pong.c +++ b/src/main/c/Pong/pong.c @@ -122,7 +122,7 @@ void resetScore(int *score1, int *score2) { *score2 = 0; } -int main(){ +int pong(){ int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; Ball ball = {WIDTH / 2, HEIGHT / 2, 1, 1}; //Startposition&Geschwindigkeit Ball diff --git a/src/main/c/Pong/pong.h b/src/main/c/Pong/pong.h index 8b13789..4e6cfdd 100644 --- a/src/main/c/Pong/pong.h +++ b/src/main/c/Pong/pong.h @@ -1 +1,9 @@ +#ifndef PONG_H +#define PONG_H + +int pong(); + +void resetScore(int *score1, int *score2); + +#endif diff --git a/src/main/c/main.c b/src/main/c/main.c index 922c8d4..0321f5a 100644 --- a/src/main/c/main.c +++ b/src/main/c/main.c @@ -4,6 +4,7 @@ #include "Template/game100.h" #include "Snake/snake_start.h" +#include "Pong/pong.h" int main(){ bool running = true; @@ -15,7 +16,7 @@ int main(){ system("clear"); printf("Waehlen Sie eine Option:\n"); printf("\t1.Spiel1 starten\n"); - printf("\t2.Spiel2 starten\n"); + printf("\t2.Pong starten\n"); printf("\t3.Snake starten\n"); printf("\t4.Spiel4 starten\n"); printf("\t100.Template starten\n"); @@ -29,7 +30,7 @@ int main(){ //start_game1(); break; case 2: - //start_game2(); + pong(); break; case 3: snake_start(); @@ -50,4 +51,4 @@ int main(){ } } return 0; -} \ No newline at end of file +} diff --git a/src/main/c/main.h b/src/main/c/main.h index 71870e0..013f02f 100644 --- a/src/main/c/main.h +++ b/src/main/c/main.h @@ -3,4 +3,4 @@ int main(); -#endif // MAIN_H \ No newline at end of file +#endif // MAIN_H diff --git a/test/test_pong.c b/test/test_pong.c new file mode 100644 index 0000000..0b12481 --- /dev/null +++ b/test/test_pong.c @@ -0,0 +1,27 @@ +#ifdef TEST +#include "unity.h" +#include "pong.h" + + +void setUp(void){ + //Wenn Funktion Vorraussetzungen braucht +} +void tearDown(void){ +} + + +void test_input_all_5(void){ + /* arrange */ + int a = 4, b = 5; + + /* act */ + resetScore( &a, &b ); + + /* assert */ + TEST_ASSERT_EQUAL_INT(0, a); + TEST_ASSERT_EQUAL_INT(0, b); +} + + + +#endif // TEST diff --git a/test/test_template.c b/test/test_template.c index a1b9ed4..4aba361 100644 --- a/test/test_template.c +++ b/test/test_template.c @@ -33,4 +33,4 @@ void test_ignore_rest_from_division(void){ TEST_ASSERT_EQUAL_INT(5, result);//5 / 6 + 5 = 5 } -#endif // TEST \ No newline at end of file +#endif // TEST