|
@ -31,32 +31,32 @@ void test_checkCollision(void){ |
|
|
|
|
|
|
|
|
// Test Ball trifft rechte und linke Wand |
|
|
// Test Ball trifft rechte und linke Wand |
|
|
ball.x = 0; |
|
|
ball.x = 0; |
|
|
int result1 = test_checkCollision(ball, paddle.y, paddle.y); |
|
|
|
|
|
|
|
|
int result1 = checkCollision(ball, paddle.y, paddle.y); |
|
|
TEST_ASSERT_EQUAL_INT(1, result1); |
|
|
TEST_ASSERT_EQUAL_INT(1, result1); |
|
|
|
|
|
|
|
|
ball.x = WIDTH - 1; |
|
|
ball.x = WIDTH - 1; |
|
|
int result2 = test_checkCollision(ball, paddle.y, paddle.y); |
|
|
|
|
|
|
|
|
int result2 = checkCollision(ball, paddle.y, paddle.y); |
|
|
TEST_ASSERT_EQUAL_INT(1, result2); |
|
|
TEST_ASSERT_EQUAL_INT(1, result2); |
|
|
|
|
|
|
|
|
// Test Ball trifft obere und untere Wand |
|
|
// Test Ball trifft obere und untere Wand |
|
|
ball.x = 5; |
|
|
ball.x = 5; |
|
|
ball.y = 0; |
|
|
ball.y = 0; |
|
|
int result3 = test_checkCollision(ball, paddle.y, paddle.y); |
|
|
|
|
|
|
|
|
int result3 = checkCollision(ball, paddle.y, paddle.y); |
|
|
TEST_ASSERT_EQUAL_INT(0, result3); |
|
|
TEST_ASSERT_EQUAL_INT(0, result3); |
|
|
|
|
|
|
|
|
ball.y = HEIGHT - 1; |
|
|
ball.y = HEIGHT - 1; |
|
|
int result4 = test_checkCollision(ball, paddle.y, paddle.y); |
|
|
|
|
|
|
|
|
int result4 = checkCollision(ball, paddle.y, paddle.y); |
|
|
TEST_ASSERT_EQUAL_INT(0, result4); |
|
|
TEST_ASSERT_EQUAL_INT(0, result4); |
|
|
|
|
|
|
|
|
// Test wenn Ball Paddle trifft |
|
|
// Test wenn Ball Paddle trifft |
|
|
ball.x = paddle.x - 1; |
|
|
ball.x = paddle.x - 1; |
|
|
ball.y = paddle.y + 1; |
|
|
ball.y = paddle.y + 1; |
|
|
int result5 = test_checkCollision(ball, paddle.y, paddle.y); |
|
|
|
|
|
|
|
|
int result5 = checkCollision(ball, paddle.y, paddle.y); |
|
|
TEST_ASSERT_EQUAL_INT(0, result5); |
|
|
TEST_ASSERT_EQUAL_INT(0, result5); |
|
|
|
|
|
|
|
|
ball.x = paddle.x + 1; |
|
|
ball.x = paddle.x + 1; |
|
|
ball.y = paddle.y + 1; |
|
|
ball.y = paddle.y + 1; |
|
|
int result6 = test_checkCollision(ball, paddle.y, paddle.y); |
|
|
|
|
|
|
|
|
int result6 = checkCollision(ball, paddle.y, paddle.y); |
|
|
TEST_ASSERT_EQUAL_INT(0, result6); |
|
|
TEST_ASSERT_EQUAL_INT(0, result6); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|