diff --git a/build/test/cache/test_duellist_spielesammlung_projekt.c b/build/test/cache/test_duellist_spielesammlung_projekt.c index 6ae7a3f..5502d62 100644 --- a/build/test/cache/test_duellist_spielesammlung_projekt.c +++ b/build/test/cache/test_duellist_spielesammlung_projekt.c @@ -648,6 +648,68 @@ void test_end_check_AllUncovered_NoMines(void) +void test_create_minefield_ValidDimensions(void) + +{ + + + + int height = 3; + + int width = 4; + + char within = '0'; + + + + + + char** result = create_minefield(height, width, within); + + + + + + do {if ((((result)) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(300))));}} while(0); + + for (int i = 0; i < height; i++) { + + do {if ((((result[i])) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(302))));}} while(0); + + for (int j = 0; j < width; j++) { + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((within)), (UNITY_INT)(UNITY_INT8 )((result[i][j])), ( + + ((void *)0) + + ), (UNITY_UINT)(304), UNITY_DISPLAY_STYLE_CHAR); + + } + + } + + + + for (int i = 0; i < height; i++) { + + free(result[i]); + + } + + free(result); + +} + + + void test_calculate_mines_HeightOne(void) { @@ -674,6 +736,6 @@ void test_calculate_mines_HeightOne(void) ((void *)0) - ), (UNITY_UINT)(300), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(325), UNITY_DISPLAY_STYLE_INT); } diff --git a/build/test/out/c/test_duellist_spielesammlung_projekt.o b/build/test/out/c/test_duellist_spielesammlung_projekt.o index 2e2058c..ea923d5 100644 Binary files a/build/test/out/c/test_duellist_spielesammlung_projekt.o and b/build/test/out/c/test_duellist_spielesammlung_projekt.o differ diff --git a/build/test/out/c/test_duellist_spielesammlung_projekt_runner.o b/build/test/out/c/test_duellist_spielesammlung_projekt_runner.o index 20ddc52..08ed359 100644 Binary files a/build/test/out/c/test_duellist_spielesammlung_projekt_runner.o and b/build/test/out/c/test_duellist_spielesammlung_projekt_runner.o differ diff --git a/build/test/out/test_duellist_spielesammlung_projekt.out b/build/test/out/test_duellist_spielesammlung_projekt.out index a826115..5436455 100644 Binary files a/build/test/out/test_duellist_spielesammlung_projekt.out and b/build/test/out/test_duellist_spielesammlung_projekt.out differ diff --git a/build/test/preprocess/files/test_duellist_spielesammlung_projekt.c b/build/test/preprocess/files/test_duellist_spielesammlung_projekt.c index 6ae7a3f..5502d62 100644 --- a/build/test/preprocess/files/test_duellist_spielesammlung_projekt.c +++ b/build/test/preprocess/files/test_duellist_spielesammlung_projekt.c @@ -648,6 +648,68 @@ void test_end_check_AllUncovered_NoMines(void) +void test_create_minefield_ValidDimensions(void) + +{ + + + + int height = 3; + + int width = 4; + + char within = '0'; + + + + + + char** result = create_minefield(height, width, within); + + + + + + do {if ((((result)) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(300))));}} while(0); + + for (int i = 0; i < height; i++) { + + do {if ((((result[i])) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(302))));}} while(0); + + for (int j = 0; j < width; j++) { + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((within)), (UNITY_INT)(UNITY_INT8 )((result[i][j])), ( + + ((void *)0) + + ), (UNITY_UINT)(304), UNITY_DISPLAY_STYLE_CHAR); + + } + + } + + + + for (int i = 0; i < height; i++) { + + free(result[i]); + + } + + free(result); + +} + + + void test_calculate_mines_HeightOne(void) { @@ -674,6 +736,6 @@ void test_calculate_mines_HeightOne(void) ((void *)0) - ), (UNITY_UINT)(300), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(325), UNITY_DISPLAY_STYLE_INT); } diff --git a/build/test/results/test_duellist_spielesammlung_projekt.pass b/build/test/results/test_duellist_spielesammlung_projekt.pass index 135d3c1..2c37905 100644 --- a/build/test/results/test_duellist_spielesammlung_projekt.pass +++ b/build/test/results/test_duellist_spielesammlung_projekt.pass @@ -83,16 +83,20 @@ :line: 270 :message: '' :unity_test_time: 0 -- :test: test_calculate_mines_HeightOne +- :test: test_create_minefield_ValidDimensions :line: 289 :message: '' :unity_test_time: 0 +- :test: test_calculate_mines_HeightOne + :line: 314 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 21 - :passed: 21 + :total: 22 + :passed: 22 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.04708719999962341 +:time: 0.047360099999878 diff --git a/build/test/runners/test_duellist_spielesammlung_projekt_runner.c b/build/test/runners/test_duellist_spielesammlung_projekt_runner.c index 5f049ee..de1610d 100644 --- a/build/test/runners/test_duellist_spielesammlung_projekt_runner.c +++ b/build/test/runners/test_duellist_spielesammlung_projekt_runner.c @@ -30,6 +30,7 @@ extern void test_calculate_mines_HeightWidthOne(void); extern void test_calculate_mines_WidthOne(void); extern void test_calculate_mines_NormalCase(void); extern void test_end_check_AllUncovered_NoMines(void); +extern void test_create_minefield_ValidDimensions(void); extern void test_calculate_mines_HeightOne(void); @@ -115,7 +116,8 @@ int main(void) run_test(test_calculate_mines_WidthOne, "test_calculate_mines_WidthOne", 242); run_test(test_calculate_mines_NormalCase, "test_calculate_mines_NormalCase", 256); run_test(test_end_check_AllUncovered_NoMines, "test_end_check_AllUncovered_NoMines", 270); - run_test(test_calculate_mines_HeightOne, "test_calculate_mines_HeightOne", 289); + run_test(test_create_minefield_ValidDimensions, "test_create_minefield_ValidDimensions", 289); + run_test(test_calculate_mines_HeightOne, "test_calculate_mines_HeightOne", 314); return UnityEnd(); } diff --git a/src/test/test_duellist_spielesammlung_projekt.c b/src/test/test_duellist_spielesammlung_projekt.c index bae99d3..83c4345 100644 --- a/src/test/test_duellist_spielesammlung_projekt.c +++ b/src/test/test_duellist_spielesammlung_projekt.c @@ -286,6 +286,31 @@ void test_end_check_AllUncovered_NoMines(void) TEST_ASSERT_EQUAL_INT(1, result); } +void test_create_minefield_ValidDimensions(void) +{ + /* arrange */ + int height = 3; + int width = 4; + char within = '0'; + + /* act */ + char** result = create_minefield(height, width, within); + + /* assert */ + TEST_ASSERT_NOT_NULL(result); + for (int i = 0; i < height; i++) { + TEST_ASSERT_NOT_NULL(result[i]); + for (int j = 0; j < width; j++) { + TEST_ASSERT_EQUAL_CHAR(within, result[i][j]); + } + } + // Free allocated memory + for (int i = 0; i < height; i++) { + free(result[i]); + } + free(result); +} + void test_calculate_mines_HeightOne(void) { /* arrange */