Browse Source

Bauern hinzugefügt, Luis Hahn

remotes/origin/Läufer-fertig,-Hendrik-Voß
Luis Hahn 11 months ago
parent
commit
35c9114cca
  1. 40
      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. 40
      build/test/preprocess/files/test_schach.c
  7. 14
      build/test/results/test_schach.pass
  8. 6
      build/test/runners/test_schach_runner.c
  9. 8
      src/schach.c
  10. 16
      test/test_schach.c

40
build/test/cache/test_schach.c

@ -98,6 +98,42 @@ void test_print_Schachfeld_Turm_weiss(void){
void test_print_Schachfeld_Bauern_weiss(void){
char expected = 'B';
int x = 8;
int y = 8;
char** Spielfeld = create_Schachfeld(x, y);
for(int l = 0;l<y;l++){
UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[1][l])), (
((void *)0)
), (UNITY_UINT)(55), UNITY_DISPLAY_STYLE_CHAR);
}
}
void test_print_Schachfeld_dame_schwarz(void){
@ -122,7 +158,7 @@ void test_print_Schachfeld_dame_schwarz(void){
((void *)0)
), (UNITY_UINT)(54), UNITY_DISPLAY_STYLE_CHAR);
), (UNITY_UINT)(70), UNITY_DISPLAY_STYLE_CHAR);
@ -190,7 +226,7 @@ void test_read_input(void) {
((void *)0)
), (UNITY_UINT)(80), UNITY_DISPLAY_STYLE_INT);
), (UNITY_UINT)(96), 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

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

@ -98,6 +98,42 @@ void test_print_Schachfeld_Turm_weiss(void){
void test_print_Schachfeld_Bauern_weiss(void){
char expected = 'B';
int x = 8;
int y = 8;
char** Spielfeld = create_Schachfeld(x, y);
for(int l = 0;l<y;l++){
UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[1][l])), (
((void *)0)
), (UNITY_UINT)(55), UNITY_DISPLAY_STYLE_CHAR);
}
}
void test_print_Schachfeld_dame_schwarz(void){
@ -122,7 +158,7 @@ void test_print_Schachfeld_dame_schwarz(void){
((void *)0)
), (UNITY_UINT)(54), UNITY_DISPLAY_STYLE_CHAR);
), (UNITY_UINT)(70), UNITY_DISPLAY_STYLE_CHAR);
@ -190,7 +226,7 @@ void test_read_input(void) {
((void *)0)
), (UNITY_UINT)(80), UNITY_DISPLAY_STYLE_INT);
), (UNITY_UINT)(96), UNITY_DISPLAY_STYLE_INT);

14
build/test/results/test_schach.pass

@ -11,20 +11,24 @@
:line: 30
:message: ''
:unity_test_time: 0
- :test: test_print_Schachfeld_dame_schwarz
- :test: test_print_Schachfeld_Bauern_weiss
:line: 44
:message: ''
:unity_test_time: 0
- :test: test_print_Schachfeld_dame_schwarz
:line: 60
:message: ''
:unity_test_time: 0
- :test: test_read_input
:line: 61
:line: 77
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 4
:passed: 4
:total: 5
:passed: 5
:failed: 0
:ignored: 0
:stdout: []
:time: 1.981050599948503
:time: 0.13926199998240918

6
build/test/runners/test_schach_runner.c

@ -12,6 +12,7 @@ extern void setUp(void);
extern void tearDown(void);
extern void test_print_Schachfeld(void);
extern void test_print_Schachfeld_Turm_weiss(void);
extern void test_print_Schachfeld_Bauern_weiss(void);
extern void test_print_Schachfeld_dame_schwarz(void);
extern void test_read_input(void);
@ -80,8 +81,9 @@ int main(void)
UnityBegin("test_schach.c");
run_test(test_print_Schachfeld, "test_print_Schachfeld", 16);
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);
run_test(test_print_Schachfeld_Bauern_weiss, "test_print_Schachfeld_Bauern_weiss", 44);
run_test(test_print_Schachfeld_dame_schwarz, "test_print_Schachfeld_dame_schwarz", 60);
run_test(test_read_input, "test_read_input", 77);
return UnityEnd();
}

8
src/schach.c

@ -110,6 +110,10 @@ char** create_Schachfeld(int x, int y) {
Spielfeld[0][6] = 'P';
Spielfeld[0][7] = 'T';
for(int l = 0;l<8;l++){ // Bauern Weiß
Spielfeld[1][l] = 'B';
}
Spielfeld[7][0] = 't'; //Turm Schwarz
Spielfeld[7][1] = 'p';
Spielfeld[7][2] = 'l';
@ -118,6 +122,10 @@ char** create_Schachfeld(int x, int y) {
Spielfeld[7][5] = 'l';
Spielfeld[7][6] = 'p';
Spielfeld[7][7] = 't';
for(int l = 0;l<8;l++){ //Bauern Schwarz
Spielfeld[6][l] = 'b';
}
return Spielfeld;
}

16
test/test_schach.c

@ -41,6 +41,22 @@ void test_print_Schachfeld_Turm_weiss(void){
TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[0][7]);
}
void test_print_Schachfeld_Bauern_weiss(void){
/* arrange */
char expected = 'B';
int x = 8;
int y = 8;
/* act */
char** Spielfeld = create_Schachfeld(x, y);
/* assert */
for(int l = 0;l<y;l++){
TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[1][l]);
}
}
void test_print_Schachfeld_dame_schwarz(void){
/* arrange */
char expected = 'd';

Loading…
Cancel
Save