Browse Source

Merge branch 'Daniel' into 'main'

Daniel

See merge request fdai7745/duellist-spielesammlung-projekt!6
remotes/origin/Areeb
fdai7745 11 months ago
parent
commit
7870e0a6b4
  1. 18
      build/test/cache/test_duellist_spielesammlung_projekt.c
  2. 3
      build/test/dependencies/duellist-spielesammlung-projekt.d
  3. BIN
      build/test/out/c/duellist-spielesammlung-projekt.o
  4. BIN
      build/test/out/c/test_duellist_spielesammlung_projekt.o
  5. BIN
      build/test/out/c/test_duellist_spielesammlung_projekt_runner.o
  6. BIN
      build/test/out/test_duellist_spielesammlung_projekt.out
  7. 18
      build/test/preprocess/files/test_duellist_spielesammlung_projekt.c
  8. 78
      build/test/results/test_duellist_spielesammlung_projekt.pass
  9. 28
      build/test/runners/test_duellist_spielesammlung_projekt_runner.c
  10. 18
      src/main/duellist-spielesammlung-projekt.c
  11. 16
      src/main/duellist-spielesammlung-projekt.h

18
build/test/cache/test_duellist_spielesammlung_projekt.c

@ -16,7 +16,7 @@ void tearDown(void) {}
void test_coinflip_player_x_starts(void) {
void test_coinflip_x_starts(void) {
@ -44,7 +44,7 @@ void test_coinflip_player_x_starts(void) {
void test_coinflip_player_o_starts(void) {
void test_coinflip_o_starts(void) {
@ -166,7 +166,7 @@ void test_diagonal_win(void) {
void test_valid_move_and_switch_player(void) {
void test_valid_move_and_switch(void) {
@ -272,7 +272,7 @@ void test_valid_input(void) {
void test_invalid_input_type1(void) {
void test_invalid_input_negative_row(void) {
@ -304,7 +304,7 @@ void test_invalid_input_type1(void) {
void test_invalid_input_type2(void) {
void test_invalid_input_overflow_column(void) {
@ -336,7 +336,7 @@ void test_invalid_input_type2(void) {
void test_getNumberOfMoves_returns_correct_number_of_moves(void) {
void test_NumberOfMoves_returns_correct_number_of_moves(void) {
@ -352,7 +352,7 @@ void test_getNumberOfMoves_returns_correct_number_of_moves(void) {
int moves = getNumberOfMoves(&game);
int moves = NumberOfMoves(&game);
@ -420,7 +420,7 @@ void test_BoardFull_returns_true_when_board_is_full(void) {
}
void test_getCurrentPlayer_returns_correct_player(void) {
void test_CurrentPlayer_returns_correct_player(void) {
@ -436,7 +436,7 @@ void test_getCurrentPlayer_returns_correct_player(void) {
Player currentPlayer = getCurrentPlayer(&game);
Player currentPlayer = CurrentPlayer(&game);

3
build/test/dependencies/duellist-spielesammlung-projekt.d

@ -0,0 +1,3 @@
build/test/out/c/duellist-spielesammlung-projekt.o: \
src/main/duellist-spielesammlung-projekt.c \
src/main/duellist-spielesammlung-projekt.h

BIN
build/test/out/c/duellist-spielesammlung-projekt.o

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

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

BIN
build/test/out/test_duellist_spielesammlung_projekt.out

18
build/test/preprocess/files/test_duellist_spielesammlung_projekt.c

@ -16,7 +16,7 @@ void tearDown(void) {}
void test_coinflip_player_x_starts(void) {
void test_coinflip_x_starts(void) {
@ -44,7 +44,7 @@ void test_coinflip_player_x_starts(void) {
void test_coinflip_player_o_starts(void) {
void test_coinflip_o_starts(void) {
@ -166,7 +166,7 @@ void test_diagonal_win(void) {
void test_valid_move_and_switch_player(void) {
void test_valid_move_and_switch(void) {
@ -272,7 +272,7 @@ void test_valid_input(void) {
void test_invalid_input_type1(void) {
void test_invalid_input_negative_row(void) {
@ -304,7 +304,7 @@ void test_invalid_input_type1(void) {
void test_invalid_input_type2(void) {
void test_invalid_input_overflow_column(void) {
@ -336,7 +336,7 @@ void test_invalid_input_type2(void) {
void test_getNumberOfMoves_returns_correct_number_of_moves(void) {
void test_NumberOfMoves_returns_correct_number_of_moves(void) {
@ -352,7 +352,7 @@ void test_getNumberOfMoves_returns_correct_number_of_moves(void) {
int moves = getNumberOfMoves(&game);
int moves = NumberOfMoves(&game);
@ -420,7 +420,7 @@ void test_BoardFull_returns_true_when_board_is_full(void) {
}
void test_getCurrentPlayer_returns_correct_player(void) {
void test_CurrentPlayer_returns_correct_player(void) {
@ -436,7 +436,7 @@ void test_getCurrentPlayer_returns_correct_player(void) {
Player currentPlayer = getCurrentPlayer(&game);
Player currentPlayer = CurrentPlayer(&game);

78
build/test/results/test_duellist_spielesammlung_projekt.pass

@ -0,0 +1,78 @@
---
:source:
:path: src/test
:file: test_duellist_spielesammlung_projekt.c
:successes:
- :test: test_coinflip_x_starts
:line: 11
:message: ''
:unity_test_time: 0
- :test: test_coinflip_o_starts
:line: 23
:message: ''
:unity_test_time: 0
- :test: test_vertical_win
:line: 35
:message: ''
:unity_test_time: 0
- :test: test_horizontal_win
:line: 49
:message: ''
:unity_test_time: 0
- :test: test_diagonal_win
:line: 62
:message: ''
:unity_test_time: 0
- :test: test_valid_move_and_switch
:line: 76
:message: ''
:unity_test_time: 0
- :test: test_invalid_input
:line: 92
:message: ''
:unity_test_time: 0
- :test: test_valid_input
:line: 106
:message: ''
:unity_test_time: 0
- :test: test_invalid_input_negative_row
:line: 121
:message: ''
:unity_test_time: 0
- :test: test_invalid_input_overflow_column
:line: 135
:message: ''
:unity_test_time: 0
- :test: test_NumberOfMoves_returns_correct_number_of_moves
:line: 149
:message: ''
:unity_test_time: 0
- :test: test_BoardFull_returns_false_when_board_is_not_full
:line: 163
:message: ''
:unity_test_time: 0
- :test: test_BoardFull_returns_true_when_board_is_full
:line: 176
:message: ''
:unity_test_time: 0
- :test: test_CurrentPlayer_returns_correct_player
:line: 189
:message: ''
:unity_test_time: 0
- :test: test_FieldEmpty_returns_true_for_empty_field
:line: 202
:message: ''
:unity_test_time: 0
- :test: test_FieldEmpty_returns_false_for_nonempty_field
:line: 215
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 16
:passed: 16
:failed: 0
:ignored: 0
:stdout: []
:time: 0.04396939999423921

28
build/test/runners/test_duellist_spielesammlung_projekt_runner.c

@ -10,20 +10,20 @@ char* GlobalOrderError;
/*=======External Functions This Runner Calls=====*/
extern void setUp(void);
extern void tearDown(void);
extern void test_coinflip_player_x_starts(void);
extern void test_coinflip_player_o_starts(void);
extern void test_coinflip_x_starts(void);
extern void test_coinflip_o_starts(void);
extern void test_vertical_win(void);
extern void test_horizontal_win(void);
extern void test_diagonal_win(void);
extern void test_valid_move_and_switch_player(void);
extern void test_valid_move_and_switch(void);
extern void test_invalid_input(void);
extern void test_valid_input(void);
extern void test_invalid_input_type1(void);
extern void test_invalid_input_type2(void);
extern void test_getNumberOfMoves_returns_correct_number_of_moves(void);
extern void test_invalid_input_negative_row(void);
extern void test_invalid_input_overflow_column(void);
extern void test_NumberOfMoves_returns_correct_number_of_moves(void);
extern void test_BoardFull_returns_false_when_board_is_not_full(void);
extern void test_BoardFull_returns_true_when_board_is_full(void);
extern void test_getCurrentPlayer_returns_correct_player(void);
extern void test_CurrentPlayer_returns_correct_player(void);
extern void test_FieldEmpty_returns_true_for_empty_field(void);
extern void test_FieldEmpty_returns_false_for_nonempty_field(void);
@ -90,20 +90,20 @@ static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE l
int main(void)
{
UnityBegin("test_duellist_spielesammlung_projekt.c");
run_test(test_coinflip_player_x_starts, "test_coinflip_player_x_starts", 11);
run_test(test_coinflip_player_o_starts, "test_coinflip_player_o_starts", 23);
run_test(test_coinflip_x_starts, "test_coinflip_x_starts", 11);
run_test(test_coinflip_o_starts, "test_coinflip_o_starts", 23);
run_test(test_vertical_win, "test_vertical_win", 35);
run_test(test_horizontal_win, "test_horizontal_win", 49);
run_test(test_diagonal_win, "test_diagonal_win", 62);
run_test(test_valid_move_and_switch_player, "test_valid_move_and_switch_player", 76);
run_test(test_valid_move_and_switch, "test_valid_move_and_switch", 76);
run_test(test_invalid_input, "test_invalid_input", 92);
run_test(test_valid_input, "test_valid_input", 106);
run_test(test_invalid_input_type1, "test_invalid_input_type1", 121);
run_test(test_invalid_input_type2, "test_invalid_input_type2", 135);
run_test(test_getNumberOfMoves_returns_correct_number_of_moves, "test_getNumberOfMoves_returns_correct_number_of_moves", 149);
run_test(test_invalid_input_negative_row, "test_invalid_input_negative_row", 121);
run_test(test_invalid_input_overflow_column, "test_invalid_input_overflow_column", 135);
run_test(test_NumberOfMoves_returns_correct_number_of_moves, "test_NumberOfMoves_returns_correct_number_of_moves", 149);
run_test(test_BoardFull_returns_false_when_board_is_not_full, "test_BoardFull_returns_false_when_board_is_not_full", 163);
run_test(test_BoardFull_returns_true_when_board_is_full, "test_BoardFull_returns_true_when_board_is_full", 176);
run_test(test_getCurrentPlayer_returns_correct_player, "test_getCurrentPlayer_returns_correct_player", 189);
run_test(test_CurrentPlayer_returns_correct_player, "test_CurrentPlayer_returns_correct_player", 189);
run_test(test_FieldEmpty_returns_true_for_empty_field, "test_FieldEmpty_returns_true_for_empty_field", 202);
run_test(test_FieldEmpty_returns_false_for_nonempty_field, "test_FieldEmpty_returns_false_for_nonempty_field", 215);

18
src/main/duellist-spielesammlung-projekt.c

@ -138,10 +138,9 @@ GameResult checkGameResult(const TicTacToeGame* game) {
return draw ? GAME_DRAW : SUCCESS;
}
int berechneMinen(int hoehe, int breite) {
int anzahl_minen;
if (hoehe <= 1 || breite <= 1) {
int calculate_mines(int height, int width) {
int num_mines;
if (height <= 1 || width <= 1) {
return 0;
}
else {
@ -180,17 +179,6 @@ void distribute_mines(char** mines, int height, int width, int num_mines) {
}
}
// Diagonalen Sieg prüfen
if ((game->board[0][0] == game->board[1][1] && game->board[1][1] == game->board[2][2] && game->board[0][0] != EMPTY) ||
(game->board[0][2] == game->board[1][1] && game->board[1][1] == game->board[2][0] && game->board[0][2] != EMPTY)) {
return GAME_WIN;
}
int minesweeper() {
int height, width, row, column;
printf("Enter the height of the game field:\n");

16
src/main/duellist-spielesammlung-projekt.h

@ -38,18 +38,4 @@ int FieldEmpty(const TicTacToeGame* game, int row, int col);
int decideGameType();
Player playRockPaperScissors();
#endif // DUEELIST_SPIELESAMMLUNG_PROJEKT_
#endif // DUEELIST_SPIELESAMMLUNG_PROJEKT_H
Loading…
Cancel
Save