Skip to content

Commit

Permalink
add rows argument to free function
Browse files Browse the repository at this point in the history
  • Loading branch information
rivnakm committed Dec 1, 2024
1 parent 603cea3 commit f7fd358
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
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

0 comments on commit f7fd358

Please sign in to comment.