Browse Source

abwechselnd Spieler schwarz/weiß, Hendrik Voß

remotes/origin/Läufer-fertig,-Hendrik-Voß
Hendrik Voß 11 months ago
parent
commit
b546273f30
  1. 42
      build/test/cache/test_schach.c
  2. BIN
      build/test/out/c/schach.o
  3. BIN
      build/test/out/c/test_schach.o
  4. BIN
      build/test/out/c/test_schach_runner.o
  5. BIN
      build/test/out/test_schach.out
  6. 42
      build/test/preprocess/files/test_schach.c
  7. 14
      build/test/results/test_schach.pass
  8. 8
      build/test/runners/test_schach_runner.c
  9. 10
      src/main.c
  10. 19
      test/test_schach.c

42
build/test/cache/test_schach.c

@ -62,7 +62,7 @@ void test_print_Schachfeld(void){
void test_print_Schachfeld_Turm(void){
void test_print_Schachfeld_Turm_weiss(void){
@ -98,6 +98,44 @@ void test_print_Schachfeld_Turm(void){
void test_print_Schachfeld_dame_schwarz(void){
char expected = 'd';
int x = 8;
int y = 8;
char** Spielfeld = create_Schachfeld(x, y);
UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[7][3])), (
((void *)0)
), (UNITY_UINT)(54), UNITY_DISPLAY_STYLE_CHAR);
}
void test_read_input(void) {
@ -152,7 +190,7 @@ void test_read_input(void) {
((void *)0)
), (UNITY_UINT)(63), UNITY_DISPLAY_STYLE_INT);
), (UNITY_UINT)(80), UNITY_DISPLAY_STYLE_INT);

BIN
build/test/out/c/schach.o

BIN
build/test/out/c/test_schach.o

BIN
build/test/out/c/test_schach_runner.o

BIN
build/test/out/test_schach.out

42
build/test/preprocess/files/test_schach.c

@ -62,7 +62,7 @@ void test_print_Schachfeld(void){
void test_print_Schachfeld_Turm(void){
void test_print_Schachfeld_Turm_weiss(void){
@ -98,6 +98,44 @@ void test_print_Schachfeld_Turm(void){
void test_print_Schachfeld_dame_schwarz(void){
char expected = 'd';
int x = 8;
int y = 8;
char** Spielfeld = create_Schachfeld(x, y);
UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[7][3])), (
((void *)0)
), (UNITY_UINT)(54), UNITY_DISPLAY_STYLE_CHAR);
}
void test_read_input(void) {
@ -152,7 +190,7 @@ void test_read_input(void) {
((void *)0)
), (UNITY_UINT)(63), UNITY_DISPLAY_STYLE_INT);
), (UNITY_UINT)(80), UNITY_DISPLAY_STYLE_INT);

14
build/test/results/test_schach.pass

@ -7,20 +7,24 @@
:line: 16
:message: ''
:unity_test_time: 0
- :test: test_print_Schachfeld_Turm
- :test: test_print_Schachfeld_Turm_weiss
:line: 30
:message: ''
:unity_test_time: 0
- :test: test_read_input
- :test: test_print_Schachfeld_dame_schwarz
:line: 44
:message: ''
:unity_test_time: 0
- :test: test_read_input
:line: 61
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 3
:passed: 3
:total: 4
:passed: 4
:failed: 0
:ignored: 0
:stdout: []
:time: 0.14233430003514513
:time: 1.981050599948503

8
build/test/runners/test_schach_runner.c

@ -11,7 +11,8 @@ char* GlobalOrderError;
extern void setUp(void);
extern void tearDown(void);
extern void test_print_Schachfeld(void);
extern void test_print_Schachfeld_Turm(void);
extern void test_print_Schachfeld_Turm_weiss(void);
extern void test_print_Schachfeld_dame_schwarz(void);
extern void test_read_input(void);
@ -78,8 +79,9 @@ int main(void)
{
UnityBegin("test_schach.c");
run_test(test_print_Schachfeld, "test_print_Schachfeld", 16);
run_test(test_print_Schachfeld_Turm, "test_print_Schachfeld_Turm", 30);
run_test(test_read_input, "test_read_input", 44);
run_test(test_print_Schachfeld_Turm_weiss, "test_print_Schachfeld_Turm_weiss", 30);
run_test(test_print_Schachfeld_dame_schwarz, "test_print_Schachfeld_dame_schwarz", 44);
run_test(test_read_input, "test_read_input", 61);
return UnityEnd();
}

10
src/main.c

@ -6,11 +6,19 @@
int main() {
int x = 8;
int y = 8;
int spieler = 0;
char** Spielfeld = create_Schachfeld(x, y);
while (checkmate() == 0){
print_Schachfeld(Spielfeld, x, y);
if(spieler % 2 == 0){
//weiß
}
else{ //schwarz
}
spieler++;
}
free_Schachfeld(Spielfeld, x);
return 0;

19
test/test_schach.c

@ -27,7 +27,7 @@ void test_print_Schachfeld(void){
TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[4][3]);
}
void test_print_Schachfeld_Turm(void){
void test_print_Schachfeld_Turm_weiss(void){
/* arrange */
char expected = 'T';
int x = 8;
@ -41,6 +41,23 @@ void test_print_Schachfeld_Turm(void){
TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[0][7]);
}
void test_print_Schachfeld_dame_schwarz(void){
/* arrange */
char expected = 'd';
int x = 8;
int y = 8;
/* act */
char** Spielfeld = create_Schachfeld(x, y);
/* assert */
TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[7][3]);
//TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[0][7]);
}
void test_read_input(void) {
/* arrange */
const char *input = "8\n";

Loading…
Cancel
Save