diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cbe9089 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Unity"] + path = Unity + url = https://github.com/ThrowTheSwitch/Unity.git diff --git a/Unity b/Unity new file mode 160000 index 0000000..b4f6557 --- /dev/null +++ b/Unity @@ -0,0 +1 @@ +Subproject commit b4f65573f75564d4b5d33e1812a31946191620d1 diff --git a/build/artifacts/release/project.out b/build/artifacts/release/project.out index a92a15d..b89a690 100755 Binary files a/build/artifacts/release/project.out and b/build/artifacts/release/project.out differ diff --git a/build/release/dependencies/game100.d b/build/release/dependencies/game100.d new file mode 100644 index 0000000..24915ff --- /dev/null +++ b/build/release/dependencies/game100.d @@ -0,0 +1 @@ +build/release/out/c/game100.o: src/main/c/Template/game100.c diff --git a/build/release/dependencies/main.d b/build/release/dependencies/main.d index 74fb41b..4dccf23 100644 --- a/build/release/dependencies/main.d +++ b/build/release/dependencies/main.d @@ -1,3 +1,2 @@ -build/release/out/c/main.o: src/main/c/main.c src/main/c/add_subject.h \ - src/main/c/modify_subject.h src/main/c/add_student.h \ - src/main/c/modify_student.h src/main/c/show_statistics.h +build/release/out/c/main.o: src/main/c/main.c \ + src/main/c/Template/game100.h diff --git a/build/release/dependencies/testRunnerGenerator.d b/build/release/dependencies/testRunnerGenerator.d new file mode 100644 index 0000000..081b804 --- /dev/null +++ b/build/release/dependencies/testRunnerGenerator.d @@ -0,0 +1,5 @@ +build/release/out/c/testRunnerGenerator.o: \ + src/Unity/test/testdata/testRunnerGenerator.c \ + src/Unity/test/testdata/../../src/unity.h \ + src/Unity/test/testdata/../../src/unity_internals.h \ + src/Unity/test/testdata/Defs.h diff --git a/build/release/dependencies/testRunnerGeneratorSmall.d b/build/release/dependencies/testRunnerGeneratorSmall.d new file mode 100644 index 0000000..44e26e5 --- /dev/null +++ b/build/release/dependencies/testRunnerGeneratorSmall.d @@ -0,0 +1,3 @@ +build/release/out/c/testRunnerGeneratorSmall.o: \ + src/Unity/test/testdata/testRunnerGeneratorSmall.c src/Unity/src/unity.h \ + src/Unity/src/unity_internals.h src/Unity/test/testdata/Defs.h diff --git a/build/release/dependencies/testRunnerGeneratorWithMocks.d b/build/release/dependencies/testRunnerGeneratorWithMocks.d new file mode 100644 index 0000000..2fad802 --- /dev/null +++ b/build/release/dependencies/testRunnerGeneratorWithMocks.d @@ -0,0 +1,5 @@ +build/release/out/c/testRunnerGeneratorWithMocks.o: \ + src/Unity/test/testdata/testRunnerGeneratorWithMocks.c \ + src/Unity/test/testdata/../../src/unity.h \ + src/Unity/test/testdata/../../src/unity_internals.h \ + src/Unity/test/testdata/Defs.h src/Unity/test/testdata/mockMock.h diff --git a/build/release/dependencies/testsample_cmd.d b/build/release/dependencies/testsample_cmd.d new file mode 100644 index 0000000..a7578ff --- /dev/null +++ b/build/release/dependencies/testsample_cmd.d @@ -0,0 +1,5 @@ +build/release/out/c/testsample_cmd.o: \ + src/Unity/test/expectdata/testsample_cmd.c \ + src/Unity/test/expectdata/../../src/unity.h \ + src/Unity/test/expectdata/../../src/unity_internals.h \ + src/Unity/test/testdata/CException.h diff --git a/build/release/out/c/game100.o b/build/release/out/c/game100.o new file mode 100644 index 0000000..96df510 Binary files /dev/null and b/build/release/out/c/game100.o differ diff --git a/build/release/out/c/main.o b/build/release/out/c/main.o index 4dda997..1619821 100644 Binary files a/build/release/out/c/main.o and b/build/release/out/c/main.o differ diff --git a/build/release/out/c/testRunnerGenerator.o b/build/release/out/c/testRunnerGenerator.o new file mode 100644 index 0000000..97013f1 Binary files /dev/null and b/build/release/out/c/testRunnerGenerator.o differ diff --git a/build/release/out/c/testRunnerGeneratorSmall.o b/build/release/out/c/testRunnerGeneratorSmall.o new file mode 100644 index 0000000..af61e66 Binary files /dev/null and b/build/release/out/c/testRunnerGeneratorSmall.o differ diff --git a/build/release/out/c/testRunnerGeneratorWithMocks.o b/build/release/out/c/testRunnerGeneratorWithMocks.o new file mode 100644 index 0000000..f3bc56b Binary files /dev/null and b/build/release/out/c/testRunnerGeneratorWithMocks.o differ diff --git a/build/release/out/c/testsample_cmd.o b/build/release/out/c/testsample_cmd.o new file mode 100644 index 0000000..29949ea Binary files /dev/null and b/build/release/out/c/testsample_cmd.o differ diff --git a/build/release/project.out b/build/release/project.out index a92a15d..b89a690 100755 Binary files a/build/release/project.out and b/build/release/project.out differ diff --git a/build/test/cache/defines_dependency.yml b/build/test/cache/defines_dependency.yml new file mode 100644 index 0000000..b227090 --- /dev/null +++ b/build/test/cache/defines_dependency.yml @@ -0,0 +1,3 @@ +--- +src/main/c/Template/game100.c: +- TEST diff --git a/build/test/cache/test_template.c b/build/test/cache/test_template.c new file mode 100644 index 0000000..ae399bd --- /dev/null +++ b/build/test/cache/test_template.c @@ -0,0 +1,66 @@ +#include "test/../src/main/c/Template/game100.h" + + + + + + + + +void setUp(void){ + + + +} + +void tearDown(void){ + +} + + + + + +void test_input_all_5(void){ + + + + int result; + + + + + + result = some_function(5, 5); + + + + + + TEST_ASSERT_EQUAL_INT(6, result); + +} + + + + + +void test_ignore_rest_from_division(void){ + + + + int result; + + + + + + result = some_function(5, 6); + + + + + + TEST_ASSERT_EQUAL_INT(5, result); + +} diff --git a/build/test/dependencies/cmock.d b/build/test/dependencies/cmock.d new file mode 100644 index 0000000..82b64c9 --- /dev/null +++ b/build/test/dependencies/cmock.d @@ -0,0 +1,6 @@ +build/test/out/c/cmock.o: \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock_internals.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/dependencies/game100.d b/build/test/dependencies/game100.d new file mode 100644 index 0000000..e3fe8d5 --- /dev/null +++ b/build/test/dependencies/game100.d @@ -0,0 +1 @@ +build/test/out/c/game100.o: src/main/c/Template/game100.c diff --git a/build/test/dependencies/test_template.d b/build/test/dependencies/test_template.d new file mode 100644 index 0000000..7b1658f --- /dev/null +++ b/build/test/dependencies/test_template.d @@ -0,0 +1,2 @@ +build/test/out/c/test_template.o: test/test_template.c \ + test/../src/main/c/Template/game100.h diff --git a/build/test/dependencies/test_template_runner.d b/build/test/dependencies/test_template_runner.d new file mode 100644 index 0000000..c4140c0 --- /dev/null +++ b/build/test/dependencies/test_template_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_template_runner.o: \ + build/test/runners/test_template_runner.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/dependencies/unity.d b/build/test/dependencies/unity.d new file mode 100644 index 0000000..770a033 --- /dev/null +++ b/build/test/dependencies/unity.d @@ -0,0 +1,2 @@ +build/test/out/c/unity.o: src/Unity/src/unity.c src/Unity/src/unity.h \ + src/Unity/src/unity_internals.h diff --git a/build/test/out/c/cmock.o b/build/test/out/c/cmock.o new file mode 100644 index 0000000..93e6055 Binary files /dev/null and b/build/test/out/c/cmock.o differ diff --git a/build/test/out/c/game100.o b/build/test/out/c/game100.o new file mode 100644 index 0000000..5a781d8 Binary files /dev/null and b/build/test/out/c/game100.o differ diff --git a/build/test/out/c/test_template.o b/build/test/out/c/test_template.o new file mode 100644 index 0000000..c6b0a96 Binary files /dev/null and b/build/test/out/c/test_template.o differ diff --git a/build/test/out/c/test_template_runner.o b/build/test/out/c/test_template_runner.o new file mode 100644 index 0000000..2442d60 Binary files /dev/null and b/build/test/out/c/test_template_runner.o differ diff --git a/build/test/out/c/unity.o b/build/test/out/c/unity.o new file mode 100644 index 0000000..e8bdd69 Binary files /dev/null and b/build/test/out/c/unity.o differ diff --git a/build/test/preprocess/files/test_template.c b/build/test/preprocess/files/test_template.c new file mode 100644 index 0000000..ae399bd --- /dev/null +++ b/build/test/preprocess/files/test_template.c @@ -0,0 +1,66 @@ +#include "test/../src/main/c/Template/game100.h" + + + + + + + + +void setUp(void){ + + + +} + +void tearDown(void){ + +} + + + + + +void test_input_all_5(void){ + + + + int result; + + + + + + result = some_function(5, 5); + + + + + + TEST_ASSERT_EQUAL_INT(6, result); + +} + + + + + +void test_ignore_rest_from_division(void){ + + + + int result; + + + + + + result = some_function(5, 6); + + + + + + TEST_ASSERT_EQUAL_INT(5, result); + +} diff --git a/build/test/preprocess/includes/test_template.c b/build/test/preprocess/includes/test_template.c new file mode 100644 index 0000000..38f53f5 --- /dev/null +++ b/build/test/preprocess/includes/test_template.c @@ -0,0 +1,2 @@ +--- +- test/../src/main/c/Template/game100.h diff --git a/build/test/runners/test_template_runner.c b/build/test/runners/test_template_runner.c new file mode 100644 index 0000000..c43b631 --- /dev/null +++ b/build/test/runners/test_template_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_input_all_5(void); +extern void test_ignore_rest_from_division(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_template.c"); + run_test(test_input_all_5, "test_input_all_5", 13); + run_test(test_ignore_rest_from_division, "test_ignore_rest_from_division", 25); + + return UnityEnd(); +} diff --git a/src/main/c/Template/game100.c b/src/main/c/Template/game100.c new file mode 100644 index 0000000..c581f06 --- /dev/null +++ b/src/main/c/Template/game100.c @@ -0,0 +1,11 @@ +#include + +void start_game100(){ + printf("Playing...\nStop?\n"); + getchar(); + return; +} + +int some_function(int a, int b){ + return a / b + a; +} \ No newline at end of file diff --git a/src/main/c/Template/game100.h b/src/main/c/Template/game100.h new file mode 100644 index 0000000..6dd78c9 --- /dev/null +++ b/src/main/c/Template/game100.h @@ -0,0 +1,7 @@ +#ifndef GAME100_H +#define GAME100_H + +void start_game100(); +int some_function(int a, int b); + +#endif // GAME100_H \ No newline at end of file diff --git a/src/main/c/add_student.c b/src/main/c/add_student.c deleted file mode 100644 index 27fd329..0000000 --- a/src/main/c/add_student.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void add_student(){ - printf("Füge Student hinzu...\n"); - getchar(); - return; -} \ No newline at end of file diff --git a/src/main/c/add_student.h b/src/main/c/add_student.h deleted file mode 100644 index 4424fc9..0000000 --- a/src/main/c/add_student.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ADD_STUDENT_H -#define ADD_STUDENT_H - -void add_student(); - -#endif // ADD_STUDENT_H \ No newline at end of file diff --git a/src/main/c/add_subject.c b/src/main/c/add_subject.c deleted file mode 100644 index e89971a..0000000 --- a/src/main/c/add_subject.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void add_subject(){ - printf("Füge Fach hinzu...\n"); - getchar(); - return; -} \ No newline at end of file diff --git a/src/main/c/add_subject.h b/src/main/c/add_subject.h deleted file mode 100644 index 38e3a65..0000000 --- a/src/main/c/add_subject.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ADD_SUBJECT_H -#define ADD_SUBJECT_H - -void add_subject(); - -#endif // ADD_SUBJECT_H \ No newline at end of file diff --git a/src/main/c/main.c b/src/main/c/main.c index 9c2a206..eaf0b17 100644 --- a/src/main/c/main.c +++ b/src/main/c/main.c @@ -2,11 +2,7 @@ #include #include -#include "add_subject.h" -#include "modify_subject.h" -#include "add_student.h" -#include "modify_student.h" -#include "show_statistics.h" +#include "Template/game100.h" int main(){ bool running = true; @@ -16,12 +12,12 @@ int main(){ int option = 0; system("clear"); - printf("Wählen Sie eine Option:\n"); - printf("\t1.Fach hinzufügen\n"); - printf("\t2.Fach bearbeiten\n"); - printf("\t3.Student hinzufügen\n"); - printf("\t4.Student bearbeiten\n"); - printf("\t5.Statistiken anzeigen\n"); + printf("Waehlen Sie eine Option:\n"); + printf("\t1.Spiel1 starten\n"); + printf("\t2.Spiel2 starten\n"); + printf("\t3.Spiel3 starten\n"); + printf("\t4.Spiel4 starten\n"); + printf("\t100.Template starten\n"); printf("\t6.Exit\n"); scanf("%d", &option); @@ -29,19 +25,19 @@ int main(){ switch (option){ case 1: - add_subject(); + //start_game1(); break; case 2: - modify_subject(); + //start_game2(); break; case 3: - add_student(); + //start_game3(); break; case 4: - modify_student(); + //start_game4(); break; - case 5: - show_statistics(); + case 100: + start_game100(); break; case 6: system("clear"); diff --git a/src/main/c/modify_student.c b/src/main/c/modify_student.c deleted file mode 100644 index 18a7b85..0000000 --- a/src/main/c/modify_student.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void modify_student(){ - printf("Bearbeite Student...\n"); - getchar(); - return; -} \ No newline at end of file diff --git a/src/main/c/modify_student.h b/src/main/c/modify_student.h deleted file mode 100644 index 7c930ef..0000000 --- a/src/main/c/modify_student.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MODIFY_STUDENT_H -#define MODIFY_STUDENT_H - -void modify_student(); - -#endif // MODIFY_STUDENT_H \ No newline at end of file diff --git a/src/main/c/modify_subject.c b/src/main/c/modify_subject.c deleted file mode 100644 index 1610a5c..0000000 --- a/src/main/c/modify_subject.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void modify_subject(){ - printf("Bearbeite Fach...\n"); - getchar(); - return; -} \ No newline at end of file diff --git a/src/main/c/modify_subject.h b/src/main/c/modify_subject.h deleted file mode 100644 index 69892eb..0000000 --- a/src/main/c/modify_subject.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MODIFY_SUBJECT_H -#define MODIFY_SUBJECT_H - -void modify_subject(); - -#endif // MODIFY_SUBJECT_H \ No newline at end of file diff --git a/src/main/c/show_statistics.c b/src/main/c/show_statistics.c deleted file mode 100644 index 1cd16b7..0000000 --- a/src/main/c/show_statistics.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void show_statistics(){ - printf("Zeige Statistiken...\n"); - getchar(); - return; -} \ No newline at end of file diff --git a/src/main/c/show_statistics.h b/src/main/c/show_statistics.h deleted file mode 100644 index b97005a..0000000 --- a/src/main/c/show_statistics.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SHOW_STATISTICS_H -#define SHOW_STATISTICS_H - -void show_statistics(); - -#endif // SHOW_STATISTICS_H \ No newline at end of file diff --git a/test/test_template.c b/test/test_template.c new file mode 100644 index 0000000..109de45 --- /dev/null +++ b/test/test_template.c @@ -0,0 +1,36 @@ +#ifdef TEST +#include "../Unity/src/unity.h" +#include "../src/main/c/Template/game100.h" + + +void setUp(void){ + //Wenn Funktion Vorraussetzungen braucht +} +void tearDown(void){ +} + + +void test_input_all_5(void){ + /* arrange */ + int result; + + /* act */ + result = some_function(5, 5); + + /* assert */ + TEST_ASSERT_EQUAL_INT(6, result);//5 / 5 + 5 = 6 +} + + +void test_ignore_rest_from_division(void){ + /* arrange */ + int result; + + /* act */ + result = some_function(5, 6); + + /* assert */ + TEST_ASSERT_EQUAL_INT(5, result);//5 / 6 + 5 = 5 +} + +#endif // TEST \ No newline at end of file