Browse Source

Unittest06

remotes/origin/Daniel
Daniel M 11 months ago
parent
commit
9e5a0004bd
  1. 64
      build/test/cache/test_duellist_spielesammlung_projekt.c
  2. BIN
      build/test/out/c/test_duellist_spielesammlung_projekt.o
  3. BIN
      build/test/out/c/test_duellist_spielesammlung_projekt_runner.o
  4. BIN
      build/test/out/test_duellist_spielesammlung_projekt.out
  5. 64
      build/test/preprocess/files/test_duellist_spielesammlung_projekt.c
  6. 12
      build/test/results/test_duellist_spielesammlung_projekt.pass
  7. 4
      build/test/runners/test_duellist_spielesammlung_projekt_runner.c
  8. 25
      src/test/test_duellist_spielesammlung_projekt.c

64
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);
}

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

64
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);
}

12
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

4
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();
}

25
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 */

Loading…
Cancel
Save