diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..70e34ec --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "C_Cpp.errorSquiggles": "disabled" +} \ No newline at end of file diff --git a/build-project.sh b/build-project.sh index 0eb086c..ed7808b 100755 --- a/build-project.sh +++ b/build-project.sh @@ -1 +1 @@ -ceedling test:all +ceedling test:all \ No newline at end of file diff --git a/build/test/cache/defines_dependency.yml b/build/test/cache/defines_dependency.yml index 592befa..9ac810c 100644 --- a/build/test/cache/defines_dependency.yml +++ b/build/test/cache/defines_dependency.yml @@ -5,3 +5,5 @@ src/probe.c: - TEST src/Spiellogik.c: - TEST +src/Umgebung.c: +- TEST diff --git a/build/test/cache/test_Umgebung.c b/build/test/cache/test_Umgebung.c new file mode 100644 index 0000000..90c9c5a --- /dev/null +++ b/build/test/cache/test_Umgebung.c @@ -0,0 +1,61 @@ +#include "src/Umgebung.h" +#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + +void setUp(void) + + { + + } + + + + void tearDown(void) + + { + + } + + void test_Umgebung_RealU(void){ + + + + int realU[20][20]; + + realU[14][15] = 0; + + int result = RealU(realU); + + + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(17), UNITY_DISPLAY_STYLE_INT); + + + + + +} + +void test_Umgebung_delay(void){ + + + + + + + + int result = delay(2); + + + + UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(27), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/dependencies/Umgebung.d b/build/test/dependencies/Umgebung.d new file mode 100644 index 0000000..0c3f6ff --- /dev/null +++ b/build/test/dependencies/Umgebung.d @@ -0,0 +1 @@ +build/test/out/c/Umgebung.o: src/Umgebung.c diff --git a/build/test/dependencies/test_Umgebung.d b/build/test/dependencies/test_Umgebung.d new file mode 100644 index 0000000..a31a259 --- /dev/null +++ b/build/test/dependencies/test_Umgebung.d @@ -0,0 +1,4 @@ +build/test/out/c/test_Umgebung.o: test/test_Umgebung.c \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/Umgebung.h diff --git a/build/test/dependencies/test_Umgebung_runner.d b/build/test/dependencies/test_Umgebung_runner.d new file mode 100644 index 0000000..d0ee129 --- /dev/null +++ b/build/test/dependencies/test_Umgebung_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_Umgebung_runner.o: \ + build/test/runners/test_Umgebung_runner.c \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/out/c/Umgebung.o b/build/test/out/c/Umgebung.o new file mode 100644 index 0000000..5ebeb88 Binary files /dev/null and b/build/test/out/c/Umgebung.o differ diff --git a/build/test/out/c/test_Umgebung.o b/build/test/out/c/test_Umgebung.o new file mode 100644 index 0000000..00758b9 Binary files /dev/null and b/build/test/out/c/test_Umgebung.o differ diff --git a/build/test/out/c/test_Umgebung_runner.o b/build/test/out/c/test_Umgebung_runner.o new file mode 100644 index 0000000..6d164d4 Binary files /dev/null and b/build/test/out/c/test_Umgebung_runner.o differ diff --git a/build/test/out/test_Umgebung.out b/build/test/out/test_Umgebung.out new file mode 100755 index 0000000..a46e041 Binary files /dev/null and b/build/test/out/test_Umgebung.out differ diff --git a/build/test/preprocess/files/test_Umgebung.c b/build/test/preprocess/files/test_Umgebung.c new file mode 100644 index 0000000..90c9c5a --- /dev/null +++ b/build/test/preprocess/files/test_Umgebung.c @@ -0,0 +1,61 @@ +#include "src/Umgebung.h" +#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + +void setUp(void) + + { + + } + + + + void tearDown(void) + + { + + } + + void test_Umgebung_RealU(void){ + + + + int realU[20][20]; + + realU[14][15] = 0; + + int result = RealU(realU); + + + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(17), UNITY_DISPLAY_STYLE_INT); + + + + + +} + +void test_Umgebung_delay(void){ + + + + + + + + int result = delay(2); + + + + UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(27), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/includes/test_Umgebung.c b/build/test/preprocess/includes/test_Umgebung.c new file mode 100644 index 0000000..dbc3a98 --- /dev/null +++ b/build/test/preprocess/includes/test_Umgebung.c @@ -0,0 +1,3 @@ +--- +- "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +- src/Umgebung.h diff --git a/build/test/results/test_Spiellogik.pass b/build/test/results/test_Spiellogik.pass index 0b597c3..f55d8b7 100644 --- a/build/test/results/test_Spiellogik.pass +++ b/build/test/results/test_Spiellogik.pass @@ -23,4 +23,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0022634060005657375 +:time: 0.0010967800003527373 diff --git a/build/test/results/test_Umgebung.pass b/build/test/results/test_Umgebung.pass new file mode 100644 index 0000000..0065be7 --- /dev/null +++ b/build/test/results/test_Umgebung.pass @@ -0,0 +1,22 @@ +--- +:source: + :path: test + :file: test_Umgebung.c +:successes: +- :test: test_Umgebung_RealU + :line: 11 + :message: '' + :unity_test_time: 0 +- :test: test_Umgebung_delay + :line: 21 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 2 + :passed: 2 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.0011177370001860254 diff --git a/build/test/results/test_test.pass b/build/test/results/test_test.pass index 256ebb6..4954641 100644 --- a/build/test/results/test_test.pass +++ b/build/test/results/test_test.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0015701629999966826 +:time: 0.0012317610003265145 diff --git a/build/test/runners/test_Umgebung_runner.c b/build/test/runners/test_Umgebung_runner.c new file mode 100644 index 0000000..a9d5731 --- /dev/null +++ b/build/test/runners/test_Umgebung_runner.c @@ -0,0 +1,83 @@ +/* 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_Umgebung_RealU(void); +extern void test_Umgebung_delay(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_Umgebung.c"); + run_test(test_Umgebung_RealU, "test_Umgebung_RealU", 11); + run_test(test_Umgebung_delay, "test_Umgebung_delay", 21); + + return UnityEnd(); +} diff --git a/src/Umgebung.c b/src/Umgebung.c index 9e0553f..47ed93d 100644 --- a/src/Umgebung.c +++ b/src/Umgebung.c @@ -17,6 +17,9 @@ void Score(int score); void Apfel(int realU[N][N]); void Umgebung(int str[N][N]); int delay(int ms); //in the first step it remains constant +/* + +Unittest funktioniert nicht wenn Dateien mit einer main Methode aufgerufen werden int main(){ srand(time(0));// damit wir ein Zufallszahl haben. @@ -42,8 +45,8 @@ int main(){ printf("Score: %d\n", score); }*/ - re 0; -} + // re 0; +//} void Anweisung(char s[N]){ diff --git a/test/test_Umgebung.c b/test/test_Umgebung.c index bc2d4e0..afff1a3 100644 --- a/test/test_Umgebung.c +++ b/test/test_Umgebung.c @@ -1,5 +1,4 @@ #include "unity.h" -#include "cmock.h" #include #include void setUp(void)