diff --git a/build/artifacts/test/report.xml b/build/artifacts/test/report.xml index 71d31d9..42e206e 100644 --- a/build/artifacts/test/report.xml +++ b/build/artifacts/test/report.xml @@ -3,21 +3,24 @@ - test/test_Input.c::test_getUserInput + test/test_Bauer.c::test_Bauer_X_Bewegung - test/test_Moving.c::test_Bauern_bewegen + test/test_Input.c::test_getUserInput - test/test_Moving.c::test_istzugerlaubt + test/test_Moving.c::test_Bauern_bewegen + test/test_Moving.c::test_istzugerlaubt + + test/test_Schachbrett.c::test_Schachbrett_erstellen - 4 + 5 0 0 0 diff --git a/build/test/cache/defines_dependency.yml b/build/test/cache/defines_dependency.yml index d665b37..2ec9b3f 100644 --- a/build/test/cache/defines_dependency.yml +++ b/build/test/cache/defines_dependency.yml @@ -5,3 +5,5 @@ src/Schachbrett.c: - TEST src/Moving.c: - TEST +src/Bauer.c: +- TEST diff --git a/build/test/cache/test_Bauer.c b/build/test/cache/test_Bauer.c new file mode 100644 index 0000000..0f738c2 --- /dev/null +++ b/build/test/cache/test_Bauer.c @@ -0,0 +1,67 @@ +#include "src/Bauer.h" +#include "src/Spieler.h" +#include "src/Schachbrett.h" +#include "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + +void setUp(void) { + +} + + + +void tearDown(void) { + +} + + + +void test_Bauer_X_Bewegung(void) { + + + + char** brett = Schachbrett_erstellen(); + + int startX = 1; + + int startY = 1; + + int endX = 2; + + int endY = 1; + + Player player = PLAYER_WHITE; + + + + + + do {if ((((brett)) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(24))));}} while(0); + + + + + + do {if (!(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(27)));}} while(0); + + + + + + for (int i = 0; i < 8; i++) { + + free(brett[i]); + + } + + free(brett); + +} diff --git a/build/test/cache/test_Moving.c b/build/test/cache/test_Moving.c index ceaf7bf..3515e9c 100644 --- a/build/test/cache/test_Moving.c +++ b/build/test/cache/test_Moving.c @@ -6,6 +6,8 @@ + + void setUp(void) { } @@ -40,7 +42,7 @@ void test_Bauern_bewegen(void) { ((void *)0) - )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(22))));}} while(0); + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(23))));}} while(0); @@ -56,13 +58,13 @@ void test_Bauern_bewegen(void) { ((void *)0) - ), (UNITY_UINT)(28), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(29), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((' ')), (UNITY_INT)((brett[1][0])), ( ((void *)0) - ), (UNITY_UINT)(29), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(30), UNITY_DISPLAY_STYLE_INT); @@ -100,7 +102,7 @@ void test_istzugerlaubt(void){ - do {if (!(istzugerlaubt(brett,startX,startY,endX,endY,player))) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(48)));}} while(0); + do {if (!(istzugerlaubt(brett,startX,startY,endX,endY,player))) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(49)));}} while(0); for (int i = 0; i < 8; i++) { diff --git a/build/test/dependencies/Bauer.d b/build/test/dependencies/Bauer.d new file mode 100644 index 0000000..1e3b64d --- /dev/null +++ b/build/test/dependencies/Bauer.d @@ -0,0 +1,2 @@ +build/test/out/c/Bauer.o: src/Bauer.c src/spieler.h src/Moving.h \ + src/Bauer.h diff --git a/build/test/dependencies/Moving.d b/build/test/dependencies/Moving.d index 55e658d..6c76fcb 100644 --- a/build/test/dependencies/Moving.d +++ b/build/test/dependencies/Moving.d @@ -1 +1 @@ -build/test/out/c/Moving.o: src/Moving.c src/spieler.h +build/test/out/c/Moving.o: src/Moving.c src/spieler.h src/Bauer.h diff --git a/build/test/dependencies/test_Bauer.d b/build/test/dependencies/test_Bauer.d new file mode 100644 index 0000000..07e2b8b --- /dev/null +++ b/build/test/dependencies/test_Bauer.d @@ -0,0 +1,4 @@ +build/test/out/c/test_Bauer.o: test/test_Bauer.c \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/Schachbrett.h src/Spieler.h src/Bauer.h src/spieler.h diff --git a/build/test/dependencies/test_Bauer_runner.d b/build/test/dependencies/test_Bauer_runner.d new file mode 100644 index 0000000..3f3b683 --- /dev/null +++ b/build/test/dependencies/test_Bauer_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_Bauer_runner.o: \ + build/test/runners/test_Bauer_runner.c \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/out/c/Bauer.o b/build/test/out/c/Bauer.o new file mode 100644 index 0000000..dc57f63 Binary files /dev/null and b/build/test/out/c/Bauer.o differ diff --git a/build/test/out/c/Moving.o b/build/test/out/c/Moving.o index 9389f4c..f1bf744 100644 Binary files a/build/test/out/c/Moving.o and b/build/test/out/c/Moving.o differ diff --git a/build/test/out/c/test_Bauer.o b/build/test/out/c/test_Bauer.o new file mode 100644 index 0000000..5eab416 Binary files /dev/null and b/build/test/out/c/test_Bauer.o differ diff --git a/build/test/out/c/test_Bauer_runner.o b/build/test/out/c/test_Bauer_runner.o new file mode 100644 index 0000000..a905d5b Binary files /dev/null and b/build/test/out/c/test_Bauer_runner.o differ diff --git a/build/test/out/c/test_Moving_runner.o b/build/test/out/c/test_Moving_runner.o index 22412ac..d7adc2d 100644 Binary files a/build/test/out/c/test_Moving_runner.o and b/build/test/out/c/test_Moving_runner.o differ diff --git a/build/test/out/test_Bauer.out b/build/test/out/test_Bauer.out new file mode 100644 index 0000000..600373f Binary files /dev/null and b/build/test/out/test_Bauer.out differ diff --git a/build/test/out/test_Moving.out b/build/test/out/test_Moving.out index 791709c..600d82c 100644 Binary files a/build/test/out/test_Moving.out and b/build/test/out/test_Moving.out differ diff --git a/build/test/preprocess/files/test_Bauer.c b/build/test/preprocess/files/test_Bauer.c new file mode 100644 index 0000000..0f738c2 --- /dev/null +++ b/build/test/preprocess/files/test_Bauer.c @@ -0,0 +1,67 @@ +#include "src/Bauer.h" +#include "src/Spieler.h" +#include "src/Schachbrett.h" +#include "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + +void setUp(void) { + +} + + + +void tearDown(void) { + +} + + + +void test_Bauer_X_Bewegung(void) { + + + + char** brett = Schachbrett_erstellen(); + + int startX = 1; + + int startY = 1; + + int endX = 2; + + int endY = 1; + + Player player = PLAYER_WHITE; + + + + + + do {if ((((brett)) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(24))));}} while(0); + + + + + + do {if (!(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(27)));}} while(0); + + + + + + for (int i = 0; i < 8; i++) { + + free(brett[i]); + + } + + free(brett); + +} diff --git a/build/test/preprocess/files/test_Moving.c b/build/test/preprocess/files/test_Moving.c index ceaf7bf..3515e9c 100644 --- a/build/test/preprocess/files/test_Moving.c +++ b/build/test/preprocess/files/test_Moving.c @@ -6,6 +6,8 @@ + + void setUp(void) { } @@ -40,7 +42,7 @@ void test_Bauern_bewegen(void) { ((void *)0) - )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(22))));}} while(0); + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(23))));}} while(0); @@ -56,13 +58,13 @@ void test_Bauern_bewegen(void) { ((void *)0) - ), (UNITY_UINT)(28), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(29), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((' ')), (UNITY_INT)((brett[1][0])), ( ((void *)0) - ), (UNITY_UINT)(29), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(30), UNITY_DISPLAY_STYLE_INT); @@ -100,7 +102,7 @@ void test_istzugerlaubt(void){ - do {if (!(istzugerlaubt(brett,startX,startY,endX,endY,player))) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(48)));}} while(0); + do {if (!(istzugerlaubt(brett,startX,startY,endX,endY,player))) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(49)));}} while(0); for (int i = 0; i < 8; i++) { diff --git a/build/test/preprocess/includes/test_Bauer.c b/build/test/preprocess/includes/test_Bauer.c new file mode 100644 index 0000000..2799911 --- /dev/null +++ b/build/test/preprocess/includes/test_Bauer.c @@ -0,0 +1,5 @@ +--- +- C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h +- src/Schachbrett.h +- src/Spieler.h +- src/Bauer.h diff --git a/build/test/results/test_Bauer.pass b/build/test/results/test_Bauer.pass new file mode 100644 index 0000000..16e5d1b --- /dev/null +++ b/build/test/results/test_Bauer.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test + :file: test_Bauer.c +:successes: +- :test: test_Bauer_X_Bewegung + :line: 14 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.13611029996536672 diff --git a/build/test/results/test_Input.pass b/build/test/results/test_Input.pass index c6bc487..e0a7781 100644 --- a/build/test/results/test_Input.pass +++ b/build/test/results/test_Input.pass @@ -16,4 +16,4 @@ :ignored: 0 :stdout: - "-> " -:time: 0.027696100063621998 +:time: 0.04568029998335987 diff --git a/build/test/results/test_Moving.pass b/build/test/results/test_Moving.pass index a1d44a0..33dbf86 100644 --- a/build/test/results/test_Moving.pass +++ b/build/test/results/test_Moving.pass @@ -4,11 +4,11 @@ :file: test_Moving.c :successes: - :test: test_Bauern_bewegen - :line: 13 + :line: 14 :message: '' :unity_test_time: 0 - :test: test_istzugerlaubt - :line: 38 + :line: 39 :message: '' :unity_test_time: 0 :failures: [] @@ -27,4 +27,4 @@ - " " - " p p p p p p p p " - " r n b q k b n r " -:time: 0.029342600028030574 +:time: 0.11075459996936843 diff --git a/build/test/results/test_Schachbrett.pass b/build/test/results/test_Schachbrett.pass index 04fbb76..b20c394 100644 --- a/build/test/results/test_Schachbrett.pass +++ b/build/test/results/test_Schachbrett.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.024795700097456574 +:time: 0.038021700049284846 diff --git a/build/test/runners/test_Bauer_runner.c b/build/test/runners/test_Bauer_runner.c new file mode 100644 index 0000000..bf29a21 --- /dev/null +++ b/build/test/runners/test_Bauer_runner.c @@ -0,0 +1,81 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +/*=======Automagically Detected Files To Include=====*/ +#include "unity.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +/*=======External Functions This Runner Calls=====*/ +extern void setUp(void); +extern void tearDown(void); +extern void test_Bauer_X_Bewegung(void); + + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} + +/*=======Test Reset Options=====*/ +void resetTest(void); +void resetTest(void) +{ + tearDown(); + CMock_Verify(); + CMock_Destroy(); + CMock_Init(); + setUp(); +} +void verifyTest(void); +void verifyTest(void) +{ + CMock_Verify(); +} + +/*=======Test Runner Used To Run Each Test=====*/ +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + UnityConcludeTest(); +} + +/*=======MAIN=====*/ +int main(void) +{ + UnityBegin("test_Bauer.c"); + run_test(test_Bauer_X_Bewegung, "test_Bauer_X_Bewegung", 14); + + return UnityEnd(); +} diff --git a/build/test/runners/test_Moving_runner.c b/build/test/runners/test_Moving_runner.c index 674f490..8bc47fe 100644 --- a/build/test/runners/test_Moving_runner.c +++ b/build/test/runners/test_Moving_runner.c @@ -76,8 +76,8 @@ static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE l int main(void) { UnityBegin("test_Moving.c"); - run_test(test_Bauern_bewegen, "test_Bauern_bewegen", 13); - run_test(test_istzugerlaubt, "test_istzugerlaubt", 38); + run_test(test_Bauern_bewegen, "test_Bauern_bewegen", 14); + run_test(test_istzugerlaubt, "test_istzugerlaubt", 39); return UnityEnd(); } diff --git a/src/Bauer.c b/src/Bauer.c index d6c5728..1c3cade 100644 --- a/src/Bauer.c +++ b/src/Bauer.c @@ -3,10 +3,17 @@ #include #include "spieler.h" #include "Moving.h" +#include "Bauer.h" bool istzugerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int endY, Player player) { //Bauern ZUG und Funktionen //Wichtig extra Funktion EN Passaut //Wichtig Bauernumwandlung + +if(startX != endX){ + return false; + } + +return true; } diff --git a/src/Bauer.h b/src/Bauer.h index db84c2b..1e393ec 100644 --- a/src/Bauer.h +++ b/src/Bauer.h @@ -1,6 +1,9 @@ #ifndef BAUER_H #define BAUER_H +#include +#include "spieler.h" + bool istzugerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int endY, Player player); #endif // BAUER_H diff --git a/src/Moving.c b/src/Moving.c index bf5ab47..d05d239 100644 --- a/src/Moving.c +++ b/src/Moving.c @@ -39,11 +39,11 @@ bool istzugerlaubt(char** Brett, int startX, int startY, int endX, int endY, Pla //Datei von König aufrufen break; case 'P': - if(istzugerlaubt_Bauer(Brett,startX,startY,endX,endY,player) == true){ + /* if(istzugerlaubt_Bauer(Brett,startX,startY,endX,endY,player) == true){ return true; }else{ return false; - } + }*/ break; default: break; diff --git a/test/test_Bauer.c b/test/test_Bauer.c new file mode 100644 index 0000000..b417850 --- /dev/null +++ b/test/test_Bauer.c @@ -0,0 +1,37 @@ +#ifdef TEST +#include "unity.h" +#include "Schachbrett.h" +#include "Spieler.h" +#include "Bauer.h" +#include + +void setUp(void) { +} + +void tearDown(void) { +} + +void test_Bauer_X_Bewegung(void) { + + char** brett = Schachbrett_erstellen(); + int startX = 1; + int startY = 1; + int endX = 2; + int endY = 1; + Player player = PLAYER_WHITE; + + + TEST_ASSERT_NOT_NULL(brett); + + + TEST_ASSERT_FALSE(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player)); + + + for (int i = 0; i < 8; i++) { + free(brett[i]); + } + free(brett); +} + + +#endif // TEST