Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minesweeper: add rows argument to free function #1022

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/practice/minesweeper/minesweeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
#include <stddef.h>

char **annotate(const char **minefield, const size_t rows);
void free_annotation(char **annotation);
void free_annotation(char **annotation, const size_t rows);

#endif
22 changes: 11 additions & 11 deletions exercises/practice/minesweeper/test_minesweeper.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static void test_annotate_no_columns(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_no_mines(void)
Expand All @@ -51,7 +51,7 @@ static void test_annotate_no_mines(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_minefield_with_only_mines(void)
Expand All @@ -74,7 +74,7 @@ static void test_annotate_minefield_with_only_mines(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_mine_surrounded_by_spaces(void)
Expand All @@ -97,7 +97,7 @@ static void test_annotate_mine_surrounded_by_spaces(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_space_surrounded_by_mines(void)
Expand All @@ -120,7 +120,7 @@ static void test_annotate_space_surrounded_by_mines(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_horizontal_line(void)
Expand All @@ -139,7 +139,7 @@ static void test_annotate_horizontal_line(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_horizontal_line_mines_at_edges(void)
Expand All @@ -158,7 +158,7 @@ static void test_annotate_horizontal_line_mines_at_edges(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_vertical_line(void)
Expand All @@ -185,7 +185,7 @@ static void test_annotate_vertical_line(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_vertical_line_mines_at_edges(void)
Expand All @@ -212,7 +212,7 @@ static void test_annotate_vertical_line_mines_at_edges(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_cross(void)
Expand All @@ -239,7 +239,7 @@ static void test_annotate_cross(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

static void test_annotate_large_minefield(void)
Expand Down Expand Up @@ -268,7 +268,7 @@ static void test_annotate_large_minefield(void)
const size_t rows = ARRAY_SIZE(expected);
char **actual = annotate(minefield, rows);
TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, rows);
free_annotation(actual);
free_annotation(actual, rows);
}

int main(void)
Expand Down
Loading