Browse Source

Unittest10

remotes/origin/Daniel
Daniel M 11 months ago
parent
commit
8f166a8918
  1. 128
      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. 128
      build/test/preprocess/files/test_duellist_spielesammlung_projekt.c
  6. 22
      build/test/results/test_duellist_spielesammlung_projekt.pass
  7. 8
      build/test/runners/test_duellist_spielesammlung_projekt_runner.c
  8. 36
      src/test/test_duellist_spielesammlung_projekt.c

128
build/test/cache/test_duellist_spielesammlung_projekt.c

@ -739,3 +739,131 @@ void test_calculate_mines_HeightOne(void)
), (UNITY_UINT)(325), UNITY_DISPLAY_STYLE_INT); ), (UNITY_UINT)(325), UNITY_DISPLAY_STYLE_INT);
} }
void test_create_minefield_NegativeDimensions(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 NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(339))));}} while(0);
}
void test_calculate_mines_HeightZero(void)
{
int height = 0;
int width = 0;
int expected = 0;
int result = calculate_mines(height, width);
UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(353), UNITY_DISPLAY_STYLE_INT);
}
void test_calculate_mines_HeightWidthNumber(void)
{
int height = 4;
int width = 6;
int expected = 6;
int result = calculate_mines(height, width);
UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(367), UNITY_DISPLAY_STYLE_INT);
}
void test_calculate_mines_HeightWidthAgan(void)
{
int height = 6;
int width = 6;
int expected = 9;
int result = calculate_mines(height, width);
UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(381), 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

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

@ -739,3 +739,131 @@ void test_calculate_mines_HeightOne(void)
), (UNITY_UINT)(325), UNITY_DISPLAY_STYLE_INT); ), (UNITY_UINT)(325), UNITY_DISPLAY_STYLE_INT);
} }
void test_create_minefield_NegativeDimensions(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 NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(339))));}} while(0);
}
void test_calculate_mines_HeightZero(void)
{
int height = 0;
int width = 0;
int expected = 0;
int result = calculate_mines(height, width);
UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(353), UNITY_DISPLAY_STYLE_INT);
}
void test_calculate_mines_HeightWidthNumber(void)
{
int height = 4;
int width = 6;
int expected = 6;
int result = calculate_mines(height, width);
UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(367), UNITY_DISPLAY_STYLE_INT);
}
void test_calculate_mines_HeightWidthAgan(void)
{
int height = 6;
int width = 6;
int expected = 9;
int result = calculate_mines(height, width);
UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(381), UNITY_DISPLAY_STYLE_INT);
}

22
build/test/results/test_duellist_spielesammlung_projekt.pass

@ -91,12 +91,28 @@
:line: 314 :line: 314
:message: '' :message: ''
:unity_test_time: 0 :unity_test_time: 0
- :test: test_create_minefield_NegativeDimensions
:line: 328
:message: ''
:unity_test_time: 0
- :test: test_calculate_mines_HeightZero
:line: 342
:message: ''
:unity_test_time: 0
- :test: test_calculate_mines_HeightWidthNumber
:line: 356
:message: ''
:unity_test_time: 0
- :test: test_calculate_mines_HeightWidthAgan
:line: 370
:message: ''
:unity_test_time: 0
:failures: [] :failures: []
:ignores: [] :ignores: []
:counts: :counts:
:total: 22
:passed: 22
:total: 26
:passed: 26
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.047360099999878
:time: 0.0499390999998468

8
build/test/runners/test_duellist_spielesammlung_projekt_runner.c

@ -32,6 +32,10 @@ extern void test_calculate_mines_NormalCase(void);
extern void test_end_check_AllUncovered_NoMines(void); extern void test_end_check_AllUncovered_NoMines(void);
extern void test_create_minefield_ValidDimensions(void); extern void test_create_minefield_ValidDimensions(void);
extern void test_calculate_mines_HeightOne(void); extern void test_calculate_mines_HeightOne(void);
extern void test_create_minefield_NegativeDimensions(void);
extern void test_calculate_mines_HeightZero(void);
extern void test_calculate_mines_HeightWidthNumber(void);
extern void test_calculate_mines_HeightWidthAgan(void);
/*=======Mock Management=====*/ /*=======Mock Management=====*/
@ -118,6 +122,10 @@ int main(void)
run_test(test_end_check_AllUncovered_NoMines, "test_end_check_AllUncovered_NoMines", 270); run_test(test_end_check_AllUncovered_NoMines, "test_end_check_AllUncovered_NoMines", 270);
run_test(test_create_minefield_ValidDimensions, "test_create_minefield_ValidDimensions", 289); run_test(test_create_minefield_ValidDimensions, "test_create_minefield_ValidDimensions", 289);
run_test(test_calculate_mines_HeightOne, "test_calculate_mines_HeightOne", 314); run_test(test_calculate_mines_HeightOne, "test_calculate_mines_HeightOne", 314);
run_test(test_create_minefield_NegativeDimensions, "test_create_minefield_NegativeDimensions", 328);
run_test(test_calculate_mines_HeightZero, "test_calculate_mines_HeightZero", 342);
run_test(test_calculate_mines_HeightWidthNumber, "test_calculate_mines_HeightWidthNumber", 356);
run_test(test_calculate_mines_HeightWidthAgan, "test_calculate_mines_HeightWidthAgan", 370);
return UnityEnd(); return UnityEnd();
} }

36
src/test/test_duellist_spielesammlung_projekt.c

@ -367,30 +367,18 @@ void test_calculate_mines_HeightWidthNumber(void)
TEST_ASSERT_EQUAL_INT(expected, result); TEST_ASSERT_EQUAL_INT(expected, result);
} }
#endif // TEST
void test_calculate_mines_HeightWidthAgan(void)
{
/* arrange */
int height = 6;
int width = 6;
int expected = 9;
/* act */
int result = calculate_mines(height, width);
/* assert */
TEST_ASSERT_EQUAL_INT(expected, result);
}
#endif // TEST
Loading…
Cancel
Save