You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
1.9 KiB

  1. #include "unity.h"
  2. #include "Spiellogik.h"
  3. #include <stdlib.h>
  4. void setUp(void){
  5. }
  6. void tearDown(void){
  7. }
  8. void test_test1(void){
  9. int result = probe(2);
  10. TEST_ASSERT_EQUAL_INT(2, result);
  11. }
  12. void test_feldFrei_Verhalten_bei_belegtem_Feld(void){
  13. int realU[N][N];
  14. realU[11][12] = 1;
  15. int result = feldFrei( realU, 11,12);
  16. TEST_ASSERT_EQUAL_INT(0 , result);
  17. }
  18. void test_feldFrei_Verhalten_bei_freiem_Feld(void){
  19. int realU[N][N];
  20. realU[11][12] = 0;
  21. int result = feldFrei(realU, 11, 12);
  22. TEST_ASSERT_EQUAL_INT(1, result);
  23. }
  24. //Tests zur Bewegung nach oben
  25. void test_lose_up_freiesFeld(void){
  26. int realU[20][20] = { 0 };
  27. realU[10][12] = 4;
  28. int result = lose(realU, 'u');
  29. TEST_ASSERT_EQUAL_INT(0, result);
  30. }
  31. void test_lose_up_belegtesFeld(void){
  32. int realU[20][20] = { 0 };
  33. realU[10][12] = 4;
  34. realU[9][12] = 3;
  35. int result = lose(realU, 'u');
  36. TEST_ASSERT_EQUAL_INT(1, result);
  37. }
  38. void test_lose_up_Obererrand(void){
  39. int realU[20][20] = { 0 };
  40. realU[0][12] = 4;
  41. int result = lose(realU, 'u');
  42. TEST_ASSERT_EQUAL_INT(1, result);
  43. }
  44. //Tests zur Bewegung nach Unten
  45. void test_lose_down_freiesFeld(void){
  46. int realU[20][20] = { 0 };
  47. realU[10][12] = 4;
  48. int result = lose(realU, 'd');
  49. TEST_ASSERT_EQUAL_INT(0, result);
  50. }
  51. void test_lose_down_belegtesFeld(void){
  52. int realU[20][20] = { 0 };
  53. realU[10][12] = 4;
  54. realU[11][12] = 3;
  55. int result = lose(realU, 'd');
  56. TEST_ASSERT_EQUAL_INT(1, result);
  57. }
  58. //Test zur Bewegung nach links
  59. void test_lose_left_freiesFeld(void){
  60. int realU[20][20] = { 0 };
  61. realU[5][12] = 4;
  62. int result = lose(realU, 'l');
  63. TEST_ASSERT_EQUAL_INT(0, result);
  64. }
  65. void test_lose_left_belegtesFeld(void){
  66. int realU[20][20] = { 0 };
  67. realU[5][12] = 4;
  68. realU[5][11] = 3;
  69. int result = lose(realU, 'l');
  70. TEST_ASSERT_EQUAL_INT(1, result);
  71. }