Browse Source

test resertScore

remotes/origin/branchJulia
fdai8040 11 months ago
parent
commit
03ed4fc654
  1. 2
      src/main/c/Pong/pong.c
  2. 8
      src/main/c/Pong/pong.h
  3. 7
      src/main/c/main.c
  4. 2
      src/main/c/main.h
  5. 27
      test/test_pong.c
  6. 2
      test/test_template.c

2
src/main/c/Pong/pong.c

@ -122,7 +122,7 @@ void resetScore(int *score1, int *score2) {
*score2 = 0; *score2 = 0;
} }
int main(){
int pong(){
int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2;
int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2;
Ball ball = {WIDTH / 2, HEIGHT / 2, 1, 1}; //Startposition&Geschwindigkeit Ball Ball ball = {WIDTH / 2, HEIGHT / 2, 1, 1}; //Startposition&Geschwindigkeit Ball

8
src/main/c/Pong/pong.h

@ -1 +1,9 @@
#ifndef PONG_H
#define PONG_H
int pong();
void resetScore(int *score1, int *score2);
#endif

7
src/main/c/main.c

@ -4,6 +4,7 @@
#include "Template/game100.h" #include "Template/game100.h"
#include "Snake/snake_start.h" #include "Snake/snake_start.h"
#include "Pong/pong.h"
int main(){ int main(){
bool running = true; bool running = true;
@ -15,7 +16,7 @@ int main(){
system("clear"); system("clear");
printf("Waehlen Sie eine Option:\n"); printf("Waehlen Sie eine Option:\n");
printf("\t1.Spiel1 starten\n"); printf("\t1.Spiel1 starten\n");
printf("\t2.Spiel2 starten\n");
printf("\t2.Pong starten\n");
printf("\t3.Snake starten\n"); printf("\t3.Snake starten\n");
printf("\t4.Spiel4 starten\n"); printf("\t4.Spiel4 starten\n");
printf("\t100.Template starten\n"); printf("\t100.Template starten\n");
@ -29,7 +30,7 @@ int main(){
//start_game1(); //start_game1();
break; break;
case 2: case 2:
//start_game2();
pong();
break; break;
case 3: case 3:
snake_start(); snake_start();
@ -50,4 +51,4 @@ int main(){
} }
} }
return 0; return 0;
}
}

2
src/main/c/main.h

@ -3,4 +3,4 @@
int main(); int main();
#endif // MAIN_H
#endif // MAIN_H

27
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

2
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 TEST_ASSERT_EQUAL_INT(5, result);//5 / 6 + 5 = 5
} }
#endif // TEST
#endif // TEST
Loading…
Cancel
Save