You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
915 B
64 lines
915 B
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
#include "unistd.h"
|
|
#include "Modules.c"
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
void test_checkBallPosition_output_if_goal(void)
|
|
{
|
|
/* arrange */
|
|
binX = 1;
|
|
binY = 1;
|
|
|
|
ballX = 1;
|
|
ballY = 3;
|
|
|
|
/* act */
|
|
int output = checkBallPosition();
|
|
|
|
/* assert */
|
|
TEST_ASSERT_EQUAL(1, output);
|
|
}
|
|
|
|
void test_checkBallPosition_output_if_no_goal(void)
|
|
{
|
|
/* arrange */
|
|
binX = 1;
|
|
binY = 1;
|
|
|
|
ballX = 1;
|
|
ballY = 1;
|
|
|
|
/* act */
|
|
int output = checkBallPosition();
|
|
|
|
/* assert */
|
|
TEST_ASSERT_EQUAL(2, output);
|
|
}
|
|
|
|
void test_sortScoreboard_check_if_file_is_created(void) {
|
|
|
|
/* arrange */
|
|
|
|
/* act */
|
|
if (access("ScoreBoard.txt", 0) == 0) {
|
|
remove("ScoreBoard.txt");
|
|
}
|
|
|
|
sortScoreboard();
|
|
|
|
int output = access("ScoreBoard.txt", 0);
|
|
|
|
/* assert */
|
|
TEST_ASSERT_EQUAL(0, output);
|
|
}
|
|
|
|
#endif // TEST
|