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.
129 lines
2.6 KiB
129 lines
2.6 KiB
#include "unity.h"
|
|
#include "Spiellogik.h"
|
|
#include <stdlib.h>
|
|
|
|
void setUp(void){
|
|
}
|
|
|
|
void tearDown(void){
|
|
|
|
}
|
|
|
|
void test_test1(void){
|
|
|
|
int result = probe(2);
|
|
|
|
TEST_ASSERT_EQUAL_INT(2, result);
|
|
}
|
|
|
|
void test_feldFrei_Verhalten_bei_belegtem_Feld(void){
|
|
int realU[N][N];
|
|
realU[11][12] = 1;
|
|
int result = feldFrei( realU, 11,12);
|
|
|
|
TEST_ASSERT_EQUAL_INT(0 , result);
|
|
}
|
|
|
|
void test_feldFrei_Verhalten_bei_freiem_Feld(void){
|
|
int realU[N][N];
|
|
realU[11][12] = 0;
|
|
int result = feldFrei(realU, 11, 12);
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);
|
|
}
|
|
|
|
//Tests zur Bewegung nach oben
|
|
void test_lose_up_freiesFeld(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[10][12] = 4;
|
|
int result = lose(realU, 'u');
|
|
|
|
TEST_ASSERT_EQUAL_INT(0, result);
|
|
}
|
|
|
|
void test_lose_up_belegtesFeld(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[10][12] = 4;
|
|
realU[9][12] = 3;
|
|
int result = lose(realU, 'u');
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);
|
|
}
|
|
|
|
void test_lose_up_Obererrand(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[0][12] = 4;
|
|
int result = lose(realU, 'u');
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);
|
|
}
|
|
|
|
//Tests zur Bewegung nach Unten
|
|
void test_lose_down_freiesFeld(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[10][12] = 4;
|
|
int result = lose(realU, 'd');
|
|
|
|
TEST_ASSERT_EQUAL_INT(0, result);
|
|
}
|
|
|
|
void test_lose_down_belegtesFeld(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[10][12] = 4;
|
|
realU[11][12] = 3;
|
|
int result = lose(realU, 'd');
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);
|
|
}
|
|
|
|
//Test zur Bewegung nach links
|
|
|
|
void test_lose_left_freiesFeld(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[5][12] = 4;
|
|
int result = lose(realU, 'l');
|
|
|
|
TEST_ASSERT_EQUAL_INT(0, result);
|
|
}
|
|
|
|
void test_lose_left_belegtesFeld(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[5][12] = 4;
|
|
realU[5][11] = 3;
|
|
int result = lose(realU, 'l');
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);
|
|
}
|
|
|
|
void test_lose_left_linkerRand(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[5][0] = 4;
|
|
int result = lose(realU, 'l');
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);
|
|
}
|
|
|
|
//Test zur Bewegung nach Rechts
|
|
void test_lose_right_freiesFeld(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[5][12] = 4;
|
|
int result = lose(realU, 'r');
|
|
|
|
TEST_ASSERT_EQUAL_INT(0, result);
|
|
}
|
|
|
|
void test_lose_right_belegtesFeld(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[5][12] = 4;
|
|
realU[5][13] = 3;
|
|
int result = lose(realU, 'r');
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);
|
|
}
|
|
void test_lose_right_rechterRand(void){
|
|
int realU[20][20] = { 0 };
|
|
realU[5][N] = 4;
|
|
int result = lose(realU, 'l');
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);
|
|
}
|