From 966a44116ae379725776901d81b498f676e3253e Mon Sep 17 00:00:00 2001 From: Sophia Weber Date: Fri, 26 Jan 2024 18:56:20 +0100 Subject: [PATCH] Initial commit --- .gitignore | 3 ++ build-project.sh | 7 +++ project.yml | 101 +++++++++++++++++++++++++++++++++++++++++ src/helloWorld.c | 15 ++++++ src/helloWorld.h | 8 ++++ src/main.c | 4 ++ team.md | 6 +++ test/support/.gitkeep | 0 test/test_helloWorld.c | 32 +++++++++++++ 9 files changed, 176 insertions(+) create mode 100644 .gitignore create mode 100755 build-project.sh create mode 100644 project.yml create mode 100644 src/helloWorld.c create mode 100644 src/helloWorld.h create mode 100644 src/main.c create mode 100644 team.md create mode 100644 test/support/.gitkeep create mode 100644 test/test_helloWorld.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22c8fb5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vscode +build +*.out \ No newline at end of file diff --git a/build-project.sh b/build-project.sh new file mode 100755 index 0000000..15b40fc --- /dev/null +++ b/build-project.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if test -d build; then + rm -r build +fi +ceedling test:all +ceedling release +cp build/release/Rechner.out Rechner.out diff --git a/project.yml b/project.yml new file mode 100644 index 0000000..d2e054b --- /dev/null +++ b/project.yml @@ -0,0 +1,101 @@ +--- + +# Notes: +# Sample project C code is not presently written to produce a release artifact. +# As such, release build options are disabled. +# This sample, therefore, only demonstrates running a collection of unit tests. + +:project: + :use_exceptions: FALSE + :use_test_preprocessor: TRUE + :use_auxiliary_dependencies: TRUE + :build_root: build + :release_build: TRUE + :test_file_prefix: test_ + :which_ceedling: gem + :ceedling_version: 0.31.1 + :default_tasks: + - test:all + +:test_build: + :use_assembly: TRUE + +:release_build: + :output: Rechner.out + :use_assembly: FALSE + +:environment: + +:extension: + :executable: .out + +:paths: + :test: + - +:test/** + - -:test/support + :source: + - src/** + :support: + - test/support + :libraries: [] + +:defines: + # in order to add common defines: + # 1) remove the trailing [] from the :common: section + # 2) add entries to the :common: section (e.g. :test: has TEST defined) + :common: &common_defines [] + :test: + - *common_defines + - TEST + :test_preprocess: + - *common_defines + - TEST + +:cmock: + :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 + +# Add -gcov to the plugins list to make sure of the gcov plugin +# You will need to have gcov and gcovr both installed to make it work. +# For more information on these options, see docs in plugins/gcov +:gcov: + :reports: + - HtmlDetailed + :gcovr: + :html_medium_threshold: 75 + :html_high_threshold: 90 + +#:tools: +# Ceedling defaults to using gcc for compiling, linking, etc. +# As [:tools] is blank, gcc will be used (so long as it's in your system path) +# See documentation to configure a given toolchain for use + +# LIBRARIES +# These libraries are automatically injected into the build process. Those specified as +# common will be used in all types of builds. Otherwise, libraries can be injected in just +# tests or releases. These options are MERGED with the options in supplemental yaml files. +:libraries: + :placement: :end + :flag: "-l${1}" + :path_flag: "-L ${1}" + :system: [] # for example, you might list 'm' to grab the math library + :test: [] + :release: [] + +:plugins: + :load_paths: + - "#{Ceedling.load_path}" + :enabled: + - stdout_pretty_tests_report + - module_generator +... diff --git a/src/helloWorld.c b/src/helloWorld.c new file mode 100644 index 0000000..c0586a0 --- /dev/null +++ b/src/helloWorld.c @@ -0,0 +1,15 @@ +#include "helloWorld.h" + +uint8_t Jill = 0x00; +uint8_t Jung = 0xFF; +uint8_t Jukk = 0x00; +int8_t do_bit_man(int8_t position) +{ + if( ( position < 0 ) || ( position > 7 ) ) + { + //position should be 0 to 7. Because we are going to modify 8 bit value. + return -1; + } + + return 0; +} diff --git a/src/helloWorld.h b/src/helloWorld.h new file mode 100644 index 0000000..a27f377 --- /dev/null +++ b/src/helloWorld.h @@ -0,0 +1,8 @@ +#ifndef HELLOWORLD_H +#define HELLOWORLD_H + +#include + +int8_t do_bit_man(int8_t position); + +#endif // HELLOWORLD_H diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..cb22e48 --- /dev/null +++ b/src/main.c @@ -0,0 +1,4 @@ +#include "helloWorld.h" + +void main() { +} diff --git a/team.md b/team.md new file mode 100644 index 0000000..2fa5436 --- /dev/null +++ b/team.md @@ -0,0 +1,6 @@ +- Jan Heidekrüger, fdai7848 +- Inna Röhrig, fdai7851 +- Justin Trausch, fdai7720 +- Sophia Weber, fdai7828 +- Salma zouaghi , fdai7930 +- Dennis Sperzel, fdai7859 \ No newline at end of file diff --git a/test/support/.gitkeep b/test/support/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/test_helloWorld.c b/test/test_helloWorld.c new file mode 100644 index 0000000..da7abb5 --- /dev/null +++ b/test/test_helloWorld.c @@ -0,0 +1,32 @@ +#ifdef TEST + +#include "unity.h" + +#include "helloWorld.h" + +extern uint8_t Jill; +extern uint8_t Jung; +extern uint8_t Jukk; + +void setUp(void) +{ + Jill = 0x00; + Jung = 0xFF; + Jukk = 0x00; +} + +void tearDown(void) +{ +} + +void test_math_do_bit_man_0(void) +{ + int8_t result; + result = do_bit_man( 15 ); + TEST_ASSERT_EQUAL_INT8( -1, result ); + TEST_ASSERT_EQUAL_INT8( 0x00, Jill ); + TEST_ASSERT_EQUAL_INT8( 0xFF, Jung ); + TEST_ASSERT_EQUAL_INT8( 0x00, Jukk ); +} + +#endif // TEST