Christian Reum
11 months ago
52 changed files with 421 additions and 786 deletions
-
3build/test/cache/defines_dependency.yml
-
242build/test/cache/input.yml
-
0build/test/cache/test_casualQuiz.c
-
0build/test/cache/test_quizduell.c
-
0build/test/cache/test_timequiz.c
-
89build/test/cache/test_wwm.c
-
6build/test/dependencies/cmock.d
-
0build/test/dependencies/force_build
-
1build/test/dependencies/test_casualQuiz.d
-
4build/test/dependencies/test_casualQuiz_runner.d
-
1build/test/dependencies/test_quizduell.d
-
4build/test/dependencies/test_quizduell_runner.d
-
1build/test/dependencies/test_timequiz.d
-
4build/test/dependencies/test_timequiz_runner.d
-
4build/test/dependencies/test_wwm.d
-
3build/test/dependencies/test_wwm_runner.d
-
4build/test/dependencies/unity.d
-
1build/test/dependencies/wwm.d
-
BINbuild/test/out/c/cmock.o
-
BINbuild/test/out/c/test_casualQuiz.o
-
BINbuild/test/out/c/test_casualQuiz_runner.o
-
BINbuild/test/out/c/test_quizduell.o
-
BINbuild/test/out/c/test_quizduell_runner.o
-
BINbuild/test/out/c/test_timequiz.o
-
BINbuild/test/out/c/test_timequiz_runner.o
-
BINbuild/test/out/c/test_wwm.o
-
BINbuild/test/out/c/test_wwm_runner.o
-
BINbuild/test/out/c/unity.o
-
BINbuild/test/out/c/wwm.o
-
BINbuild/test/out/test_casualQuiz.out
-
BINbuild/test/out/test_quizduell.out
-
BINbuild/test/out/test_timequiz.out
-
BINbuild/test/out/test_wwm.out
-
0build/test/preprocess/files/test_casualQuiz.c
-
0build/test/preprocess/files/test_quizduell.c
-
0build/test/preprocess/files/test_timequiz.c
-
89build/test/preprocess/files/test_wwm.c
-
1build/test/preprocess/includes/test_casualQuiz.c
-
1build/test/preprocess/includes/test_quizduell.c
-
1build/test/preprocess/includes/test_timequiz.c
-
3build/test/preprocess/includes/test_wwm.c
-
14build/test/results/test_casualQuiz.pass
-
14build/test/results/test_quizduell.pass
-
14build/test/results/test_timequiz.pass
-
26build/test/results/test_wwm.pass
-
57build/test/runners/test_casualQuiz_runner.c
-
57build/test/runners/test_quizduell_runner.c
-
57build/test/runners/test_timequiz_runner.c
-
85build/test/runners/test_wwm_runner.c
-
206src/quizduell.c
-
25src/quizduell.h
-
190test/test_quizduell.c
@ -1,3 +0,0 @@ |
|||||
--- |
|
||||
src/wwm.c: |
|
||||
- TEST |
|
@ -1,242 +0,0 @@ |
|||||
--- |
|
||||
:project: |
|
||||
:use_exceptions: false |
|
||||
:use_mocks: true |
|
||||
:compile_threads: 1 |
|
||||
:test_threads: 1 |
|
||||
:use_test_preprocessor: true |
|
||||
:use_preprocessor_directives: false |
|
||||
:use_deep_dependencies: false |
|
||||
:generate_deep_dependencies: true |
|
||||
:auto_link_deep_dependencies: false |
|
||||
:test_file_prefix: test_ |
|
||||
:options_paths: [] |
|
||||
:release_build: false |
|
||||
:use_auxiliary_dependencies: true |
|
||||
:build_root: build |
|
||||
:which_ceedling: gem |
|
||||
:ceedling_version: 0.31.1 |
|
||||
:default_tasks: |
|
||||
- test:all |
|
||||
:release_build: |
|
||||
:use_assembly: false |
|
||||
:artifacts: [] |
|
||||
:paths: |
|
||||
:test: |
|
||||
- "+:test/**" |
|
||||
- "-:test/support" |
|
||||
:source: |
|
||||
- src/** |
|
||||
:support: |
|
||||
- test/support |
|
||||
:include: [] |
|
||||
:libraries: [] |
|
||||
:test_toolchain_include: [] |
|
||||
:release_toolchain_include: [] |
|
||||
:files: |
|
||||
:test: [] |
|
||||
:source: [] |
|
||||
:assembly: [] |
|
||||
:support: [] |
|
||||
:include: [] |
|
||||
:environment: |
|
||||
- :rake_columns: '120' |
|
||||
:defines: |
|
||||
:test: |
|
||||
- &1 [] |
|
||||
- TEST |
|
||||
:test_preprocess: |
|
||||
- *1 |
|
||||
- TEST |
|
||||
:release: [] |
|
||||
:release_preprocess: [] |
|
||||
:use_test_definition: false |
|
||||
:common: [] |
|
||||
:libraries: |
|
||||
:flag: "-l${1}" |
|
||||
:path_flag: "-L ${1}" |
|
||||
:test: [] |
|
||||
:test_preprocess: [] |
|
||||
:release: [] |
|
||||
:release_preprocess: [] |
|
||||
:placement: :end |
|
||||
:system: [] |
|
||||
:flags: {} |
|
||||
:extension: |
|
||||
:header: ".h" |
|
||||
:source: ".c" |
|
||||
:assembly: ".s" |
|
||||
:object: ".o" |
|
||||
:libraries: |
|
||||
- ".a" |
|
||||
- ".so" |
|
||||
:executable: ".out" |
|
||||
:map: ".map" |
|
||||
:list: ".lst" |
|
||||
:testpass: ".pass" |
|
||||
:testfail: ".fail" |
|
||||
:dependencies: ".d" |
|
||||
:unity: |
|
||||
:vendor_path: C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor |
|
||||
:defines: [] |
|
||||
:cmock: |
|
||||
:vendor_path: C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor |
|
||||
:defines: [] |
|
||||
:includes: [] |
|
||||
:mock_prefix: mock_ |
|
||||
:when_no_prototypes: :warn |
|
||||
:enforce_strict_ordering: true |
|
||||
:plugins: |
|
||||
- :ignore |
|
||||
- :callback |
|
||||
:treat_as: |
|
||||
uint8: HEX8 |
|
||||
uint16: HEX16 |
|
||||
uint32: UINT32 |
|
||||
int8: INT8 |
|
||||
bool: UINT8 |
|
||||
:mock_path: build/test/mocks |
|
||||
:verbosity: 3 |
|
||||
:unity_helper: false |
|
||||
:cexception: |
|
||||
:vendor_path: C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor |
|
||||
:defines: [] |
|
||||
:test_runner: |
|
||||
:includes: [] |
|
||||
:file_suffix: _runner |
|
||||
:tools: |
|
||||
:test_compiler: |
|
||||
:executable: gcc.exe |
|
||||
:name: default_test_compiler |
|
||||
:stderr_redirect: :none |
|
||||
:background_exec: :none |
|
||||
:optional: false |
|
||||
:arguments: |
|
||||
- '' |
|
||||
- '' |
|
||||
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR |
|
||||
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE |
|
||||
- "-D$": COLLECTION_DEFINES_TEST_AND_VENDOR |
|
||||
- "-DGNU_COMPILER" |
|
||||
- "-g" |
|
||||
- '' |
|
||||
- -c "${1}" |
|
||||
- -o "${2}" |
|
||||
- "-MMD" |
|
||||
- -MF "${4}" |
|
||||
:test_fixture: |
|
||||
:executable: "${1}" |
|
||||
:name: default_test_fixture |
|
||||
:stderr_redirect: :auto |
|
||||
:background_exec: :none |
|
||||
:optional: false |
|
||||
:arguments: [] |
|
||||
:test_linker: |
|
||||
:executable: gcc.exe |
|
||||
:name: default_test_linker |
|
||||
:stderr_redirect: :none |
|
||||
:background_exec: :none |
|
||||
:optional: false |
|
||||
:arguments: |
|
||||
- '' |
|
||||
- '' |
|
||||
- '' |
|
||||
- '"${1}"' |
|
||||
- "${5}" |
|
||||
- -o "${2}" |
|
||||
- '' |
|
||||
- "${4}" |
|
||||
- '' |
|
||||
:test_file_preprocessor: |
|
||||
:executable: gcc.exe |
|
||||
:name: default_test_file_preprocessor |
|
||||
:stderr_redirect: :none |
|
||||
:background_exec: :none |
|
||||
:optional: false |
|
||||
:arguments: |
|
||||
- '' |
|
||||
- '' |
|
||||
- "-E" |
|
||||
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR |
|
||||
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE |
|
||||
- "-D$": COLLECTION_DEFINES_TEST_AND_VENDOR |
|
||||
- "-D$": DEFINES_TEST_PREPROCESS |
|
||||
- "-DGNU_COMPILER" |
|
||||
- '"${1}"' |
|
||||
- -o "${2}" |
|
||||
:test_file_preprocessor_directives: |
|
||||
:executable: gcc.exe |
|
||||
:name: default_test_file_preprocessor_directives |
|
||||
:stderr_redirect: :none |
|
||||
:background_exec: :none |
|
||||
:optional: false |
|
||||
:arguments: |
|
||||
- "-E" |
|
||||
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR |
|
||||
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE |
|
||||
- "-D$": COLLECTION_DEFINES_TEST_AND_VENDOR |
|
||||
- "-D$": DEFINES_TEST_PREPROCESS |
|
||||
- "-DGNU_COMPILER" |
|
||||
- "-fdirectives-only" |
|
||||
- '"${1}"' |
|
||||
- -o "${2}" |
|
||||
:test_includes_preprocessor: |
|
||||
:executable: gcc.exe |
|
||||
:name: default_test_includes_preprocessor |
|
||||
:stderr_redirect: :none |
|
||||
:background_exec: :none |
|
||||
:optional: false |
|
||||
:arguments: |
|
||||
- '' |
|
||||
- '' |
|
||||
- "-E" |
|
||||
- "-MM" |
|
||||
- "-MG" |
|
||||
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR |
|
||||
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE |
|
||||
- "-D$": COLLECTION_DEFINES_TEST_AND_VENDOR |
|
||||
- "-D$": DEFINES_TEST_PREPROCESS |
|
||||
- "-DGNU_COMPILER" |
|
||||
- '"${1}"' |
|
||||
:test_compiler: |
|
||||
:arguments: [] |
|
||||
:test_linker: |
|
||||
:arguments: [] |
|
||||
:test_fixture: |
|
||||
:arguments: [] |
|
||||
:link_objects: [] |
|
||||
:test_includes_preprocessor: |
|
||||
:arguments: [] |
|
||||
:test_file_preprocessor: |
|
||||
:arguments: [] |
|
||||
:test_file_preprocessor_directives: |
|
||||
:arguments: [] |
|
||||
:test_dependencies_generator: |
|
||||
:arguments: [] |
|
||||
:release_compiler: |
|
||||
:arguments: [] |
|
||||
:release_linker: |
|
||||
:arguments: [] |
|
||||
:release_assembler: |
|
||||
:arguments: [] |
|
||||
:release_dependencies_generator: |
|
||||
:arguments: [] |
|
||||
:plugins: |
|
||||
:load_paths: |
|
||||
- C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/lib/../plugins |
|
||||
:enabled: |
|
||||
- stdout_pretty_tests_report |
|
||||
- module_generator |
|
||||
:display_raw_test_results: false |
|
||||
:stdout_pretty_tests_report_path: C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/lib/../plugins/stdout_pretty_tests_report |
|
||||
:module_generator_path: C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/lib/../plugins/module_generator |
|
||||
:gcov: |
|
||||
:reports: |
|
||||
- HtmlDetailed |
|
||||
:gcovr: |
|
||||
:html_medium_threshold: 75 |
|
||||
:html_high_threshold: 90 |
|
||||
:module_generator: |
|
||||
:project_root: "./" |
|
||||
:source_root: src/ |
|
||||
:test_root: test/ |
|
@ -1,89 +0,0 @@ |
|||||
#include "src/wwm.h" |
|
||||
#include "C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
void setUp(void) { |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
void tearDown(void) { |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
void test_setGeld_1(void) { |
|
||||
|
|
||||
|
|
||||
|
|
||||
runde = 0; |
|
||||
|
|
||||
geld = 0; |
|
||||
|
|
||||
frage = 0; |
|
||||
|
|
||||
useranswer = 0; |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
UnityAssertEqualNumber((UNITY_INT)((100)), (UNITY_INT)((setGeld(1))), ( |
|
||||
|
|
||||
((void *)0) |
|
||||
|
|
||||
), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT); |
|
||||
|
|
||||
UnityAssertEqualNumber((UNITY_INT)((100)), (UNITY_INT)((geld)), ( |
|
||||
|
|
||||
((void *)0) |
|
||||
|
|
||||
), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
void test_setGeld_2(void) { |
|
||||
|
|
||||
|
|
||||
|
|
||||
runde = 0; |
|
||||
|
|
||||
|
|
||||
|
|
||||
UnityAssertEqualNumber((UNITY_INT)((300)), (UNITY_INT)((setGeld(3))), ( |
|
||||
|
|
||||
((void *)0) |
|
||||
|
|
||||
), (UNITY_UINT)(31), UNITY_DISPLAY_STYLE_INT); |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
void test_crandomNumber(void){ |
|
||||
|
|
||||
int result = crandomNumber(); |
|
||||
|
|
||||
do {if ((result >= 0 && result <= 9)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(38)));}} while(0); |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
@ -1,6 +0,0 @@ |
|||||
build/test/out/c/cmock.o: \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock.c \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock_internals.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h |
|
@ -1 +0,0 @@ |
|||||
build/test/out/c/test_casualQuiz.o: test/test_casualQuiz.c |
|
@ -1,4 +0,0 @@ |
|||||
build/test/out/c/test_casualQuiz_runner.o: \ |
|
||||
build/test/runners/test_casualQuiz_runner.c \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h |
|
@ -1 +0,0 @@ |
|||||
build/test/out/c/test_quizduell.o: test/test_quizduell.c |
|
@ -1,4 +0,0 @@ |
|||||
build/test/out/c/test_quizduell_runner.o: \ |
|
||||
build/test/runners/test_quizduell_runner.c \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h |
|
@ -1 +0,0 @@ |
|||||
build/test/out/c/test_timequiz.o: test/test_timequiz.c |
|
@ -1,4 +0,0 @@ |
|||||
build/test/out/c/test_timequiz_runner.o: \ |
|
||||
build/test/runners/test_timequiz_runner.c \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h |
|
@ -1,4 +0,0 @@ |
|||||
build/test/out/c/test_wwm.o: test/test_wwm.c \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ |
|
||||
src/wwm.h |
|
@ -1,3 +0,0 @@ |
|||||
build/test/out/c/test_wwm_runner.o: build/test/runners/test_wwm_runner.c \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h |
|
@ -1,4 +0,0 @@ |
|||||
build/test/out/c/unity.o: \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.c \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ |
|
||||
C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h |
|
@ -1 +0,0 @@ |
|||||
build/test/out/c/wwm.o: src/wwm.c src/wwm.h |
|
@ -1,89 +0,0 @@ |
|||||
#include "src/wwm.h" |
|
||||
#include "C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
void setUp(void) { |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
void tearDown(void) { |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
void test_setGeld_1(void) { |
|
||||
|
|
||||
|
|
||||
|
|
||||
runde = 0; |
|
||||
|
|
||||
geld = 0; |
|
||||
|
|
||||
frage = 0; |
|
||||
|
|
||||
useranswer = 0; |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
UnityAssertEqualNumber((UNITY_INT)((100)), (UNITY_INT)((setGeld(1))), ( |
|
||||
|
|
||||
((void *)0) |
|
||||
|
|
||||
), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT); |
|
||||
|
|
||||
UnityAssertEqualNumber((UNITY_INT)((100)), (UNITY_INT)((geld)), ( |
|
||||
|
|
||||
((void *)0) |
|
||||
|
|
||||
), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
void test_setGeld_2(void) { |
|
||||
|
|
||||
|
|
||||
|
|
||||
runde = 0; |
|
||||
|
|
||||
|
|
||||
|
|
||||
UnityAssertEqualNumber((UNITY_INT)((300)), (UNITY_INT)((setGeld(3))), ( |
|
||||
|
|
||||
((void *)0) |
|
||||
|
|
||||
), (UNITY_UINT)(31), UNITY_DISPLAY_STYLE_INT); |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
void test_crandomNumber(void){ |
|
||||
|
|
||||
int result = crandomNumber(); |
|
||||
|
|
||||
do {if ((result >= 0 && result <= 9)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(38)));}} while(0); |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
@ -1 +0,0 @@ |
|||||
--- [] |
|
@ -1 +0,0 @@ |
|||||
--- [] |
|
@ -1 +0,0 @@ |
|||||
--- [] |
|
@ -1,3 +0,0 @@ |
|||||
--- |
|
||||
- C:/Ruby30/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h |
|
||||
- src/wwm.h |
|
@ -1,14 +0,0 @@ |
|||||
--- |
|
||||
:source: |
|
||||
:path: test |
|
||||
:file: test_casualQuiz.c |
|
||||
:successes: [] |
|
||||
:failures: [] |
|
||||
:ignores: [] |
|
||||
:counts: |
|
||||
:total: 0 |
|
||||
:passed: 0 |
|
||||
:failed: 0 |
|
||||
:ignored: 0 |
|
||||
:stdout: [] |
|
||||
:time: 0.09232900000642985 |
|
@ -1,14 +0,0 @@ |
|||||
--- |
|
||||
:source: |
|
||||
:path: test |
|
||||
:file: test_quizduell.c |
|
||||
:successes: [] |
|
||||
:failures: [] |
|
||||
:ignores: [] |
|
||||
:counts: |
|
||||
:total: 0 |
|
||||
:passed: 0 |
|
||||
:failed: 0 |
|
||||
:ignored: 0 |
|
||||
:stdout: [] |
|
||||
:time: 0.07104519999120384 |
|
@ -1,14 +0,0 @@ |
|||||
--- |
|
||||
:source: |
|
||||
:path: test |
|
||||
:file: test_timequiz.c |
|
||||
:successes: [] |
|
||||
:failures: [] |
|
||||
:ignores: [] |
|
||||
:counts: |
|
||||
:total: 0 |
|
||||
:passed: 0 |
|
||||
:failed: 0 |
|
||||
:ignored: 0 |
|
||||
:stdout: [] |
|
||||
:time: 0.06864710000809282 |
|
@ -1,26 +0,0 @@ |
|||||
--- |
|
||||
:source: |
|
||||
:path: test |
|
||||
:file: test_wwm.c |
|
||||
:successes: |
|
||||
- :test: test_setGeld_1 |
|
||||
:line: 14 |
|
||||
:message: '' |
|
||||
:unity_test_time: 0 |
|
||||
- :test: test_setGeld_2 |
|
||||
:line: 27 |
|
||||
:message: '' |
|
||||
:unity_test_time: 0 |
|
||||
- :test: test_crandomNumber |
|
||||
:line: 36 |
|
||||
:message: '' |
|
||||
:unity_test_time: 0 |
|
||||
:failures: [] |
|
||||
:ignores: [] |
|
||||
:counts: |
|
||||
:total: 3 |
|
||||
:passed: 3 |
|
||||
:failed: 0 |
|
||||
:ignored: 0 |
|
||||
:stdout: [] |
|
||||
:time: 0.46659269998781383 |
|
@ -1,57 +0,0 @@ |
|||||
/* 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); |
|
||||
|
|
||||
|
|
||||
/*=======Mock Management=====*/ |
|
||||
static void CMock_Init(void) |
|
||||
{ |
|
||||
GlobalExpectCount = 0; |
|
||||
GlobalVerifyOrder = 0; |
|
||||
GlobalOrderError = NULL; |
|
||||
} |
|
||||
static void CMock_Verify(void) |
|
||||
{ |
|
||||
} |
|
||||
static void CMock_Destroy(void) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
/*=======Setup (stub)=====*/ |
|
||||
void setUp(void) {} |
|
||||
|
|
||||
/*=======Teardown (stub)=====*/ |
|
||||
void tearDown(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(); |
|
||||
} |
|
||||
|
|
||||
/*=======MAIN=====*/ |
|
||||
int main(void) |
|
||||
{ |
|
||||
UnityBegin("test_casualQuiz.c"); |
|
||||
|
|
||||
return UnityEnd(); |
|
||||
} |
|
@ -1,57 +0,0 @@ |
|||||
/* 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); |
|
||||
|
|
||||
|
|
||||
/*=======Mock Management=====*/ |
|
||||
static void CMock_Init(void) |
|
||||
{ |
|
||||
GlobalExpectCount = 0; |
|
||||
GlobalVerifyOrder = 0; |
|
||||
GlobalOrderError = NULL; |
|
||||
} |
|
||||
static void CMock_Verify(void) |
|
||||
{ |
|
||||
} |
|
||||
static void CMock_Destroy(void) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
/*=======Setup (stub)=====*/ |
|
||||
void setUp(void) {} |
|
||||
|
|
||||
/*=======Teardown (stub)=====*/ |
|
||||
void tearDown(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(); |
|
||||
} |
|
||||
|
|
||||
/*=======MAIN=====*/ |
|
||||
int main(void) |
|
||||
{ |
|
||||
UnityBegin("test_quizduell.c"); |
|
||||
|
|
||||
return UnityEnd(); |
|
||||
} |
|
@ -1,57 +0,0 @@ |
|||||
/* 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); |
|
||||
|
|
||||
|
|
||||
/*=======Mock Management=====*/ |
|
||||
static void CMock_Init(void) |
|
||||
{ |
|
||||
GlobalExpectCount = 0; |
|
||||
GlobalVerifyOrder = 0; |
|
||||
GlobalOrderError = NULL; |
|
||||
} |
|
||||
static void CMock_Verify(void) |
|
||||
{ |
|
||||
} |
|
||||
static void CMock_Destroy(void) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
/*=======Setup (stub)=====*/ |
|
||||
void setUp(void) {} |
|
||||
|
|
||||
/*=======Teardown (stub)=====*/ |
|
||||
void tearDown(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(); |
|
||||
} |
|
||||
|
|
||||
/*=======MAIN=====*/ |
|
||||
int main(void) |
|
||||
{ |
|
||||
UnityBegin("test_timequiz.c"); |
|
||||
|
|
||||
return UnityEnd(); |
|
||||
} |
|
@ -1,85 +0,0 @@ |
|||||
/* 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_setGeld_1(void); |
|
||||
extern void test_setGeld_2(void); |
|
||||
extern void test_crandomNumber(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_wwm.c"); |
|
||||
run_test(test_setGeld_1, "test_setGeld_1", 14); |
|
||||
run_test(test_setGeld_2, "test_setGeld_2", 27); |
|
||||
run_test(test_crandomNumber, "test_crandomNumber", 36); |
|
||||
|
|
||||
return UnityEnd(); |
|
||||
} |
|
@ -0,0 +1,206 @@ |
|||||
|
#include "quizduell.h" |
||||
|
#include <stdio.h> |
||||
|
#include <stdlib.h> |
||||
|
#include <string.h> |
||||
|
#include <ctype.h> |
||||
|
|
||||
|
int pruefeAntwort(QuizFrage frage, char antwort) { |
||||
|
return (frage.korrekteAntwort == antwort); |
||||
|
} |
||||
|
|
||||
|
QuizFrage erstelleFrage(const char* frage, const char* antwortA, const char* antwortB, const char* antwortC, const char* antwortD, char korrekteAntwort) { |
||||
|
QuizFrage neueFrage; |
||||
|
strcpy(neueFrage.frage, frage); |
||||
|
strcpy(neueFrage.antwortA, antwortA); |
||||
|
strcpy(neueFrage.antwortB, antwortB); |
||||
|
strcpy(neueFrage.antwortC, antwortC); |
||||
|
strcpy(neueFrage.antwortD, antwortD); |
||||
|
neueFrage.korrekteAntwort = korrekteAntwort; |
||||
|
return neueFrage; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
int spieleKategorie(Kategorie* kategorie) { |
||||
|
int punktzahl = 0; |
||||
|
int jokerVerwendet = 0; |
||||
|
|
||||
|
for (int i = 0; i < kategorie->anzahlFragen; i++) { |
||||
|
char benutzerAntwort[10]; |
||||
|
|
||||
|
printf("\nQuestion %d:\n%s", i + 1, kategorie->fragen[i].frage); |
||||
|
|
||||
|
char jokerAntwort[10]; |
||||
|
|
||||
|
do { |
||||
|
printf("\nA) %s\nB) %s\nC) %s\nD) %s\n", kategorie->fragen[i].antwortA, kategorie->fragen[i].antwortB, kategorie->fragen[i].antwortC, kategorie->fragen[i].antwortD); |
||||
|
|
||||
|
if (!jokerVerwendet) { |
||||
|
printf("\nDo you want to use the joker? (Y/N): "); |
||||
|
scanf("%s", jokerAntwort); |
||||
|
printf(jokerAntwort); |
||||
|
|
||||
|
if (toupper(jokerAntwort[0]) == 'Y') { |
||||
|
if (kategorie->joker > 0) { |
||||
|
kategorie->joker -= 1; |
||||
|
jokerVerwendet = 1; |
||||
|
printf("Joker inserted! Two incorrect answer options were deleted.\n"); |
||||
|
|
||||
|
char korrekteAntwort = kategorie->fragen[i].korrekteAntwort; |
||||
|
int gestrichen = 0; |
||||
|
|
||||
|
for (char option = 'A'; option <= 'D'; option++) { |
||||
|
if (option != korrekteAntwort && gestrichen < 2) { |
||||
|
switch (option) { |
||||
|
case 'A': |
||||
|
strcpy(kategorie->fragen[i].antwortA, "XXXXXX"); |
||||
|
gestrichen++; |
||||
|
break; |
||||
|
case 'B': |
||||
|
strcpy(kategorie->fragen[i].antwortB, "XXXXXX"); |
||||
|
gestrichen++; |
||||
|
break; |
||||
|
case 'C': |
||||
|
strcpy(kategorie->fragen[i].antwortC, "XXXXXX"); |
||||
|
gestrichen++; |
||||
|
break; |
||||
|
case 'D': |
||||
|
strcpy(kategorie->fragen[i].antwortD, "XXXXXX"); |
||||
|
gestrichen++; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Zeigt die Antworten erneut an |
||||
|
printf("\nA) %s\nB) %s\nC) %s\nD) %s\n", kategorie->fragen[i].antwortA, kategorie->fragen[i].antwortB, kategorie->fragen[i].antwortC, kategorie->fragen[i].antwortD); |
||||
|
|
||||
|
break; |
||||
|
|
||||
|
} |
||||
|
else { |
||||
|
printf("No Joker left. Choose a different Category.\n"); |
||||
|
} |
||||
|
} |
||||
|
else if (toupper(jokerAntwort[0]) == 'N') { |
||||
|
break; // Beendet die Schleife, wenn der Spieler keinen Joker verwenden möchte |
||||
|
} |
||||
|
else { |
||||
|
printf("Invalid input. Please type in 'Y'' for yes or 'N' for no.\n"); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
break; // Wenn der Joker bereits verwendet wurde, beendet die Schleife ohne nachzufragen |
||||
|
} |
||||
|
|
||||
|
printf("Your answer: "); |
||||
|
scanf("%s", benutzerAntwort); |
||||
|
|
||||
|
benutzerAntwort[0] = toupper(benutzerAntwort[0]); |
||||
|
getchar(); |
||||
|
|
||||
|
if (pruefeAntwort(kategorie->fragen[i], benutzerAntwort[0])) { |
||||
|
printf("Correct!\n"); |
||||
|
punktzahl++; |
||||
|
} |
||||
|
else { |
||||
|
printf("Wrong! The correct Answer is %c\n", kategorie->fragen[i].korrekteAntwort); |
||||
|
} |
||||
|
|
||||
|
} while (0); |
||||
|
} |
||||
|
return punktzahl; |
||||
|
} |
||||
|
|
||||
|
void zeigeVerfuegbareKategorien(Kategorie kategorien[]) { |
||||
|
printf("\nChoose a Category:\n"); |
||||
|
if (kategorien[0].fragen != NULL) printf("Mountains\n"); |
||||
|
if (kategorien[1].fragen != NULL) printf("Cooking\n"); |
||||
|
if (kategorien[2].fragen != NULL) printf("Sports\n"); |
||||
|
} |
||||
|
|
||||
|
void befreieKategorie(Kategorie* kategorie) { |
||||
|
free(kategorie->fragen); |
||||
|
kategorie->fragen = NULL; |
||||
|
kategorie->anzahlFragen = 0; |
||||
|
kategorie->joker = 0; |
||||
|
} |
||||
|
|
||||
|
void quizduell() { |
||||
|
printf("Welcome to the singleplayer quizduell!\n"); |
||||
|
|
||||
|
Kategorie kategorien[MAX_CATEGORIES]; |
||||
|
kategorien[0].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
||||
|
kategorien[0].fragen[0] = erstelleFrage("Whats the height of the Zugspitze?", "2482 Meter", "2867 Meter", "2962 Meter", "3173 Meter", 'C'); |
||||
|
kategorien[0].fragen[1] = erstelleFrage("In which Federal State is the Zugspitze?", "Bayern", "Baden-Wuerttemberg", "Hessen", "Thueringen", 'A'); |
||||
|
kategorien[0].fragen[2] = erstelleFrage("Which Mountain is the highest following after the Zugspitze?", "Grossglockner", "Watzmann", "Feldberg", "Meissner", 'B'); |
||||
|
kategorien[0].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY; |
||||
|
kategorien[0].joker = 1; |
||||
|
|
||||
|
kategorien[1].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
||||
|
kategorien[1].fragen[0] = erstelleFrage("Which Ingredient is used traditionally for Pesto?", "Tomatoes", "Basil", "Spinach", "Oregano", 'B'); |
||||
|
kategorien[1].fragen[1] = erstelleFrage("Which meal is known for its usage of rice?", "Lasagna", "Sushi", "Pizza", "Hamburger", 'B'); |
||||
|
kategorien[1].fragen[2] = erstelleFrage("Which color has a ripe banana?", "Red", "Green", "Yellow", "Orange", 'C'); |
||||
|
kategorien[1].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY; |
||||
|
kategorien[1].joker = 1; |
||||
|
|
||||
|
kategorien[2].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
||||
|
kategorien[2].fragen[0] = erstelleFrage("In which sport is the term 'home run' used?", "Soccer/Football", "Baseball", "Tennis", "Golf", 'B'); |
||||
|
kategorien[2].fragen[1] = erstelleFrage("How many players are there normally on the pitch in a soccer/football team?", "9", "11", "7", "5", 'B'); |
||||
|
kategorien[2].fragen[2] = erstelleFrage("What sport is played on a pitch and has a 'wicket'?", "Rugby", "Cricket", "American Football", "Hockey", 'B'); |
||||
|
kategorien[2].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY; |
||||
|
kategorien[2].joker = 1; |
||||
|
|
||||
|
while (1) { |
||||
|
char auswahl[50]; |
||||
|
|
||||
|
zeigeVerfuegbareKategorien(kategorien); |
||||
|
|
||||
|
printf("Your selection: "); |
||||
|
scanf("%s", auswahl); |
||||
|
|
||||
|
int auswahlIndex = -1; |
||||
|
|
||||
|
for (int i = 0; i < MAX_CATEGORIES; i++) { |
||||
|
if (kategorien[i].fragen != NULL && strcmp(auswahl, "Mountains") == 0) { |
||||
|
auswahlIndex = 0; |
||||
|
break; |
||||
|
} |
||||
|
else if (kategorien[i].fragen != NULL && strcmp(auswahl, "Cooking") == 0) { |
||||
|
auswahlIndex = 1; |
||||
|
break; |
||||
|
} |
||||
|
else if (kategorien[i].fragen != NULL && strcmp(auswahl, "Sports") == 0) { |
||||
|
auswahlIndex = 2; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (auswahlIndex != -1 && kategorien[auswahlIndex].fragen != NULL) { |
||||
|
int punkte = spieleKategorie(&kategorien[auswahlIndex]); |
||||
|
printf("\nPoints in this category: %d\n", punkte); |
||||
|
|
||||
|
befreieKategorie(&kategorien[auswahlIndex]); |
||||
|
} |
||||
|
|
||||
|
else { |
||||
|
|
||||
|
printf("Invalid selection.\n"); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
int verfuegbareKategorien = 0; |
||||
|
for (int i = 0; i < MAX_CATEGORIES; i++) { |
||||
|
if (kategorien[i].fragen != NULL) { |
||||
|
verfuegbareKategorien++; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (verfuegbareKategorien == 0) { |
||||
|
printf("No more available categories. Game over!\n"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
return; |
||||
|
|
||||
|
} |
||||
|
} |
@ -1,6 +1,31 @@ |
|||||
#ifndef QUIZDUELL_H |
#ifndef QUIZDUELL_H |
||||
#define QUIZDUELL_H |
#define QUIZDUELL_H |
||||
|
|
||||
|
#define MAX_FRAGE_LENGTH 100 |
||||
|
#define MAX_ANTWORT_LENGTH 50 |
||||
|
#define MAX_CATEGORIES 3 |
||||
|
#define MAX_QUESTIONS_PER_CATEGORY 3 |
||||
|
|
||||
|
typedef struct { |
||||
|
char frage[MAX_FRAGE_LENGTH]; |
||||
|
char antwortA[MAX_ANTWORT_LENGTH]; |
||||
|
char antwortB[MAX_ANTWORT_LENGTH]; |
||||
|
char antwortC[MAX_ANTWORT_LENGTH]; |
||||
|
char antwortD[MAX_ANTWORT_LENGTH]; |
||||
|
char korrekteAntwort; |
||||
|
} QuizFrage; |
||||
|
|
||||
|
typedef struct { |
||||
|
QuizFrage* fragen; |
||||
|
int anzahlFragen; |
||||
|
int joker; |
||||
|
} Kategorie; |
||||
|
|
||||
|
int pruefeAntwort(QuizFrage frage, char antwort); |
||||
|
QuizFrage erstelleFrage(const char* frage, const char* antwortA, const char* antwortB, const char* antwortC, const char* antwortD, char korrekteAntwort); |
||||
|
int spieleKategorie(Kategorie* kategorie); |
||||
|
void zeigeVerfuegbareKategorien(Kategorie kategorien[]); |
||||
|
void befreieKategorie(Kategorie* kategorie); |
||||
void quizduell(); |
void quizduell(); |
||||
|
|
||||
#endif // ende QUIZDUELL_H |
#endif // ende QUIZDUELL_H |
||||
|
@ -0,0 +1,190 @@ |
|||||
|
#ifdef TEST |
||||
|
|
||||
|
#include <string.h> |
||||
|
#include <stdlib.h> |
||||
|
#include "unity.h" |
||||
|
#include "quizduell.h" |
||||
|
|
||||
|
void setUp(void) {} |
||||
|
|
||||
|
void tearDown(void) {} |
||||
|
|
||||
|
void test_erstelleFrage(void) { |
||||
|
QuizFrage testFrage = erstelleFrage("Testfrage", "AntwortA", "AntwortB", "AntwortC", "AntwortD", 'A'); |
||||
|
|
||||
|
TEST_ASSERT_EQUAL_STRING("Testfrage", testFrage.frage); |
||||
|
TEST_ASSERT_EQUAL_STRING("AntwortA", testFrage.antwortA); |
||||
|
TEST_ASSERT_EQUAL_STRING("AntwortB", testFrage.antwortB); |
||||
|
TEST_ASSERT_EQUAL_STRING("AntwortC", testFrage.antwortC); |
||||
|
TEST_ASSERT_EQUAL_STRING("AntwortD", testFrage.antwortD); |
||||
|
TEST_ASSERT_EQUAL_CHAR('A', testFrage.korrekteAntwort); |
||||
|
} |
||||
|
|
||||
|
void test_CookingFragen(void) { |
||||
|
Kategorie kategorien[MAX_CATEGORIES]; |
||||
|
|
||||
|
kategorien[1].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
||||
|
|
||||
|
kategorien[1].fragen[0] = erstelleFrage("Which Ingredient is used traditionally for Pesto?", "Tomatoes", "Basil", "Spinach", "Oregano", 'B'); |
||||
|
kategorien[1].fragen[1] = erstelleFrage("Which meal is known for its usage of rice?", "Lasagna", "Sushi", "Pizza", "Hamburger", 'B'); |
||||
|
kategorien[1].fragen[2] = erstelleFrage("Which color has a ripe banana?", "Red", "Green", "Yellow", "Orange", 'C'); |
||||
|
|
||||
|
kategorien[1].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY; |
||||
|
kategorien[1].joker = 1; |
||||
|
|
||||
|
TEST_ASSERT_EQUAL_STRING("Which Ingredient is used traditionally for Pesto?", kategorien[1].fragen[0].frage); |
||||
|
TEST_ASSERT_EQUAL_STRING("Tomatoes", kategorien[1].fragen[0].antwortA); |
||||
|
TEST_ASSERT_EQUAL_STRING("Basil", kategorien[1].fragen[0].antwortB); |
||||
|
TEST_ASSERT_EQUAL_STRING("Spinach", kategorien[1].fragen[0].antwortC); |
||||
|
TEST_ASSERT_EQUAL_STRING("Oregano", kategorien[1].fragen[0].antwortD); |
||||
|
TEST_ASSERT_EQUAL_CHAR('B', kategorien[1].fragen[0].korrekteAntwort); |
||||
|
|
||||
|
|
||||
|
free(kategorien[1].fragen); |
||||
|
} |
||||
|
void test_MountainsFragen(void) { |
||||
|
Kategorie kategorien[MAX_CATEGORIES]; |
||||
|
|
||||
|
kategorien[0].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
||||
|
|
||||
|
kategorien[0].fragen[0] = erstelleFrage("Whats the height of the Zugspitze?", "2482 Meter", "2867 Meter", "2962 Meter", "3173 Meter", 'C'); |
||||
|
kategorien[0].fragen[1] = erstelleFrage("In which Federal State is the Zugspitze?", "Bayern", "Baden-Wuerttemberg", "Hessen", "Thueringen", 'A'); |
||||
|
kategorien[0].fragen[2] = erstelleFrage("Which Mountain is the highest following after the Zugspitze?", "Grossglockner", "Watzmann", "Feldberg", "Meissner", 'B'); |
||||
|
|
||||
|
kategorien[0].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY; |
||||
|
kategorien[0].joker = 1; |
||||
|
|
||||
|
TEST_ASSERT_EQUAL_STRING("Whats the height of the Zugspitze?", kategorien[0].fragen[0].frage); |
||||
|
TEST_ASSERT_EQUAL_STRING("2482 Meter", kategorien[0].fragen[0].antwortA); |
||||
|
TEST_ASSERT_EQUAL_STRING("2867 Meter", kategorien[0].fragen[0].antwortB); |
||||
|
TEST_ASSERT_EQUAL_STRING("2962 Meter", kategorien[0].fragen[0].antwortC); |
||||
|
TEST_ASSERT_EQUAL_STRING("3173 Meter", kategorien[0].fragen[0].antwortD); |
||||
|
TEST_ASSERT_EQUAL_CHAR('C', kategorien[0].fragen[0].korrekteAntwort); |
||||
|
|
||||
|
free(kategorien[0].fragen); |
||||
|
} |
||||
|
void test_createCategory2WithQuestions(void) { |
||||
|
Kategorie kategorien[MAX_CATEGORIES]; |
||||
|
|
||||
|
kategorien[2].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
||||
|
|
||||
|
kategorien[2].fragen[0] = erstelleFrage("In which sport is the term 'home run' used?", "Soccer/Football", "Baseball", "Tennis", "Golf", 'B'); |
||||
|
kategorien[2].fragen[1] = erstelleFrage("How many players are there normally on the pitch in a soccer/football team?", "9", "11", "7", "5", 'B'); |
||||
|
kategorien[2].fragen[2] = erstelleFrage("What sport is played on a pitch and has a 'wicket'?", "Rugby", "Cricket", "American Football", "Hockey", 'B'); |
||||
|
|
||||
|
kategorien[2].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY; |
||||
|
kategorien[2].joker = 1; |
||||
|
|
||||
|
TEST_ASSERT_EQUAL_STRING("In which sport is the term 'home run' used?", kategorien[2].fragen[0].frage); |
||||
|
TEST_ASSERT_EQUAL_STRING("Soccer/Football", kategorien[2].fragen[0].antwortA); |
||||
|
TEST_ASSERT_EQUAL_STRING("Baseball", kategorien[2].fragen[0].antwortB); |
||||
|
TEST_ASSERT_EQUAL_STRING("Tennis", kategorien[2].fragen[0].antwortC); |
||||
|
TEST_ASSERT_EQUAL_STRING("Golf", kategorien[2].fragen[0].antwortD); |
||||
|
TEST_ASSERT_EQUAL_CHAR('B', kategorien[2].fragen[0].korrekteAntwort); |
||||
|
|
||||
|
free(kategorien[2].fragen); |
||||
|
} |
||||
|
void test_befreieKategorie(void) { |
||||
|
Kategorie testKategorie; |
||||
|
testKategorie.fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
||||
|
testKategorie.anzahlFragen = 3; |
||||
|
testKategorie.joker = 1; |
||||
|
|
||||
|
befreieKategorie(&testKategorie); |
||||
|
|
||||
|
TEST_ASSERT_NULL(testKategorie.fragen); |
||||
|
TEST_ASSERT_EQUAL_INT(0, testKategorie.anzahlFragen); |
||||
|
TEST_ASSERT_EQUAL_INT(0, testKategorie.joker); |
||||
|
} |
||||
|
void test_pruefeAntwort_CorrectAnswer(void) { |
||||
|
QuizFrage frage = erstelleFrage("Test Question", "Option A", "Option B", "Option C", "Option D", 'A'); |
||||
|
TEST_ASSERT_EQUAL_INT(1, pruefeAntwort(frage, 'A')); |
||||
|
} |
||||
|
void test_pruefeAntwort_WrongAnswer(void) { |
||||
|
QuizFrage frage = erstelleFrage("Test Question", "Option A", "Option B", "Option C", "Option D", 'A'); |
||||
|
TEST_ASSERT_EQUAL_INT(0, pruefeAntwort(frage, 'B')); |
||||
|
} |
||||
|
void test_sportsCategoryInitialization(void) { |
||||
|
Kategorie kategorien[MAX_CATEGORIES]; |
||||
|
|
||||
|
kategorien[2].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
||||
|
|
||||
|
kategorien[2].fragen[0] = erstelleFrage("In which sport is the term 'home run' used?", "Soccer/Football", "Baseball", "Tennis", "Golf", 'B'); |
||||
|
kategorien[2].fragen[1] = erstelleFrage("How many players are there normally on the pitch in a soccer/football team?", "9", "11", "7", "5", 'B'); |
||||
|
kategorien[2].fragen[2] = erstelleFrage("What sport is played on a pitch and has a 'wicket'?", "Rugby", "Cricket", "American Football", "Hockey", 'B'); |
||||
|
kategorien[2].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY; |
||||
|
kategorien[2].joker = 1; |
||||
|
|
||||
|
TEST_ASSERT_NOT_NULL(kategorien[2].fragen); |
||||
|
TEST_ASSERT_EQUAL_STRING("In which sport is the term 'home run' used?", kategorien[2].fragen[0].frage); |
||||
|
TEST_ASSERT_EQUAL_STRING("Soccer/Football", kategorien[2].fragen[0].antwortA); |
||||
|
TEST_ASSERT_EQUAL_STRING("Baseball", kategorien[2].fragen[0].antwortB); |
||||
|
TEST_ASSERT_EQUAL_STRING("Tennis", kategorien[2].fragen[0].antwortC); |
||||
|
TEST_ASSERT_EQUAL_STRING("Golf", kategorien[2].fragen[0].antwortD); |
||||
|
TEST_ASSERT_EQUAL('B', kategorien[2].fragen[0].korrekteAntwort); |
||||
|
TEST_ASSERT_EQUAL_STRING("How many players are there normally on the pitch in a soccer/football team?", kategorien[2].fragen[1].frage); |
||||
|
TEST_ASSERT_EQUAL_STRING("9", kategorien[2].fragen[1].antwortA); |
||||
|
TEST_ASSERT_EQUAL_STRING("11", kategorien[2].fragen[1].antwortB); |
||||
|
TEST_ASSERT_EQUAL_STRING("7", kategorien[2].fragen[1].antwortC); |
||||
|
TEST_ASSERT_EQUAL_STRING("5", kategorien[2].fragen[1].antwortD); |
||||
|
TEST_ASSERT_EQUAL('B', kategorien[2].fragen[1].korrekteAntwort); |
||||
|
TEST_ASSERT_EQUAL_STRING("What sport is played on a pitch and has a 'wicket'?", kategorien[2].fragen[2].frage); |
||||
|
TEST_ASSERT_EQUAL_STRING("Rugby", kategorien[2].fragen[2].antwortA); |
||||
|
TEST_ASSERT_EQUAL_STRING("Cricket", kategorien[2].fragen[2].antwortB); |
||||
|
TEST_ASSERT_EQUAL_STRING("American Football", kategorien[2].fragen[2].antwortC); |
||||
|
TEST_ASSERT_EQUAL_STRING("Hockey", kategorien[2].fragen[2].antwortD); |
||||
|
TEST_ASSERT_EQUAL('B', kategorien[2].fragen[2].korrekteAntwort); |
||||
|
TEST_ASSERT_EQUAL(MAX_QUESTIONS_PER_CATEGORY, kategorien[2].anzahlFragen); |
||||
|
TEST_ASSERT_EQUAL(1, kategorien[2].joker); |
||||
|
|
||||
|
free(kategorien[2].fragen); |
||||
|
kategorien[2].fragen = NULL; |
||||
|
} |
||||
|
void test_categorySelection_Cooking(void) { |
||||
|
Kategorie kategorien[MAX_CATEGORIES]; |
||||
|
|
||||
|
char auswahl[50] = "Cooking"; |
||||
|
|
||||
|
int auswahlIndex = -1; |
||||
|
|
||||
|
for (int i = 0; i < MAX_CATEGORIES; i++) { |
||||
|
if (kategorien[i].fragen != NULL && strcmp(auswahl, "Mountains") == 0) { |
||||
|
auswahlIndex = 0; |
||||
|
break; |
||||
|
} |
||||
|
else if (kategorien[i].fragen != NULL && strcmp(auswahl, "Cooking") == 0) { |
||||
|
auswahlIndex = 1; |
||||
|
break; |
||||
|
} |
||||
|
else if (kategorien[i].fragen != NULL && strcmp(auswahl, "Sports") == 0) { |
||||
|
auswahlIndex = 2; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
TEST_ASSERT_EQUAL(1, auswahlIndex); |
||||
|
} |
||||
|
void test_categorySelection_Sports(void) { |
||||
|
Kategorie kategorien[MAX_CATEGORIES]; |
||||
|
|
||||
|
char auswahl[50] = "Sports"; |
||||
|
|
||||
|
int auswahlIndex = -1; |
||||
|
|
||||
|
for (int i = 0; i < MAX_CATEGORIES; i++) { |
||||
|
if (kategorien[i].fragen != NULL && strcmp(auswahl, "Mountains") == 0) { |
||||
|
auswahlIndex = 0; |
||||
|
break; |
||||
|
} |
||||
|
else if (kategorien[i].fragen != NULL && strcmp(auswahl, "Cooking") == 0) { |
||||
|
auswahlIndex = 1; |
||||
|
break; |
||||
|
} |
||||
|
else if (kategorien[i].fragen != NULL && strcmp(auswahl, "Sports") == 0) { |
||||
|
auswahlIndex = 2; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
TEST_ASSERT_EQUAL(2, auswahlIndex); |
||||
|
} |
||||
|
#endif //TEST |
Write
Preview
Loading…
Cancel
Save
Reference in new issue