Browse Source

Merge branch 'David' into 'main'

David

See merge request pmuw_projekt/pmuw_projekt_notebinder!5
remotes/origin/fdai7775-main-patch-54732
fdai8032 11 months ago
parent
commit
e419d73069
  1. 3
      .gitmodules
  2. 1
      Unity
  3. 1
      build-project.sh
  4. BIN
      build/artifacts/release/project.out
  5. 1
      build/release/dependencies/game100.d
  6. 5
      build/release/dependencies/main.d
  7. 5
      build/release/dependencies/testRunnerGenerator.d
  8. 3
      build/release/dependencies/testRunnerGeneratorSmall.d
  9. 5
      build/release/dependencies/testRunnerGeneratorWithMocks.d
  10. 5
      build/release/dependencies/testsample_cmd.d
  11. BIN
      build/release/out/c/game100.o
  12. BIN
      build/release/out/c/main.o
  13. BIN
      build/release/out/c/testRunnerGenerator.o
  14. BIN
      build/release/out/c/testRunnerGeneratorSmall.o
  15. BIN
      build/release/out/c/testRunnerGeneratorWithMocks.o
  16. BIN
      build/release/out/c/testsample_cmd.o
  17. BIN
      build/release/project.out
  18. 3
      build/test/cache/defines_dependency.yml
  19. 66
      build/test/cache/test_template.c
  20. 6
      build/test/dependencies/cmock.d
  21. 1
      build/test/dependencies/game100.d
  22. 2
      build/test/dependencies/test_template.d
  23. 4
      build/test/dependencies/test_template_runner.d
  24. 2
      build/test/dependencies/unity.d
  25. BIN
      build/test/out/c/cmock.o
  26. BIN
      build/test/out/c/game100.o
  27. BIN
      build/test/out/c/test_template.o
  28. BIN
      build/test/out/c/test_template_runner.o
  29. BIN
      build/test/out/c/unity.o
  30. 66
      build/test/preprocess/files/test_template.c
  31. 2
      build/test/preprocess/includes/test_template.c
  32. 83
      build/test/runners/test_template_runner.c
  33. 11
      src/main/c/Template/game100.c
  34. 7
      src/main/c/Template/game100.h
  35. 7
      src/main/c/add_student.c
  36. 6
      src/main/c/add_student.h
  37. 7
      src/main/c/add_subject.c
  38. 6
      src/main/c/add_subject.h
  39. 30
      src/main/c/main.c
  40. 7
      src/main/c/modify_student.c
  41. 6
      src/main/c/modify_student.h
  42. 7
      src/main/c/modify_subject.c
  43. 6
      src/main/c/modify_subject.h
  44. 7
      src/main/c/show_statistics.c
  45. 6
      src/main/c/show_statistics.h
  46. 36
      test/test_template.c

3
.gitmodules

@ -0,0 +1,3 @@
[submodule "Unity"]
path = Unity
url = https://github.com/ThrowTheSwitch/Unity.git

1
Unity

@ -0,0 +1 @@
Subproject commit b4f65573f75564d4b5d33e1812a31946191620d1

1
build-project.sh

@ -1,3 +1,2 @@
#!/bin/bash
ceedling release
ceedling test:all

BIN
build/artifacts/release/project.out

1
build/release/dependencies/game100.d

@ -0,0 +1 @@
build/release/out/c/game100.o: src/main/c/Template/game100.c

5
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

5
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

3
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

5
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

5
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

BIN
build/release/out/c/game100.o

BIN
build/release/out/c/main.o

BIN
build/release/out/c/testRunnerGenerator.o

BIN
build/release/out/c/testRunnerGeneratorSmall.o

BIN
build/release/out/c/testRunnerGeneratorWithMocks.o

BIN
build/release/out/c/testsample_cmd.o

BIN
build/release/project.out

3
build/test/cache/defines_dependency.yml

@ -0,0 +1,3 @@
---
src/main/c/Template/game100.c:
- TEST

66
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);
}

6
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

1
build/test/dependencies/game100.d

@ -0,0 +1 @@
build/test/out/c/game100.o: src/main/c/Template/game100.c

2
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

4
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

2
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

BIN
build/test/out/c/cmock.o

BIN
build/test/out/c/game100.o

BIN
build/test/out/c/test_template.o

BIN
build/test/out/c/test_template_runner.o

BIN
build/test/out/c/unity.o

66
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);
}

2
build/test/preprocess/includes/test_template.c

@ -0,0 +1,2 @@
---
- test/../src/main/c/Template/game100.h

83
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();
}

11
src/main/c/Template/game100.c

@ -0,0 +1,11 @@
#include <stdio.h>
void start_game100(){
printf("Playing...\nStop?\n");
getchar();
return;
}
int some_function(int a, int b){
return a / b + a;
}

7
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

7
src/main/c/add_student.c

@ -1,7 +0,0 @@
#include <stdio.h>
void add_student(){
printf("Füge Student hinzu...\n");
getchar();
return;
}

6
src/main/c/add_student.h

@ -1,6 +0,0 @@
#ifndef ADD_STUDENT_H
#define ADD_STUDENT_H
void add_student();
#endif // ADD_STUDENT_H

7
src/main/c/add_subject.c

@ -1,7 +0,0 @@
#include <stdio.h>
void add_subject(){
printf("Füge Fach hinzu...\n");
getchar();
return;
}

6
src/main/c/add_subject.h

@ -1,6 +0,0 @@
#ifndef ADD_SUBJECT_H
#define ADD_SUBJECT_H
void add_subject();
#endif // ADD_SUBJECT_H

30
src/main/c/main.c

@ -2,11 +2,7 @@
#include <stdlib.h>
#include <stdbool.h>
#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");

7
src/main/c/modify_student.c

@ -1,7 +0,0 @@
#include <stdio.h>
void modify_student(){
printf("Bearbeite Student...\n");
getchar();
return;
}

6
src/main/c/modify_student.h

@ -1,6 +0,0 @@
#ifndef MODIFY_STUDENT_H
#define MODIFY_STUDENT_H
void modify_student();
#endif // MODIFY_STUDENT_H

7
src/main/c/modify_subject.c

@ -1,7 +0,0 @@
#include <stdio.h>
void modify_subject(){
printf("Bearbeite Fach...\n");
getchar();
return;
}

6
src/main/c/modify_subject.h

@ -1,6 +0,0 @@
#ifndef MODIFY_SUBJECT_H
#define MODIFY_SUBJECT_H
void modify_subject();
#endif // MODIFY_SUBJECT_H

7
src/main/c/show_statistics.c

@ -1,7 +0,0 @@
#include <stdio.h>
void show_statistics(){
printf("Zeige Statistiken...\n");
getchar();
return;
}

6
src/main/c/show_statistics.h

@ -1,6 +0,0 @@
#ifndef SHOW_STATISTICS_H
#define SHOW_STATISTICS_H
void show_statistics();
#endif // SHOW_STATISTICS_H

36
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
Loading…
Cancel
Save