From 818e8f96079f17fadf81ad2ec057125cf4c1e062 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 14:09:05 +0100 Subject: [PATCH 01/18] =?UTF-8?q?Erstellen=20der=20Header-Datei=20f=C3=BCr?= =?UTF-8?q?=20decbinary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.h | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/decbinary.h diff --git a/src/decbinary.h b/src/decbinary.h new file mode 100644 index 0000000..ea7f546 --- /dev/null +++ b/src/decbinary.h @@ -0,0 +1,8 @@ +// +// Created by innar on 08.02.2024. +// + +#ifndef LINKES_TWIX_DECBINARY_H +#define LINKES_TWIX_DECBINARY_H + +#endif //LINKES_TWIX_DECBINARY_H From ce5ff4136396461e41ed4fab8de4827377c9f4aa Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 14:15:08 +0100 Subject: [PATCH 02/18] =?UTF-8?q?Erstellen=20der=20Datei=20c.=20f=C3=BCr?= =?UTF-8?q?=20decbinary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/decbinary.c diff --git a/src/decbinary.c b/src/decbinary.c new file mode 100644 index 0000000..40593f5 --- /dev/null +++ b/src/decbinary.c @@ -0,0 +1,3 @@ +// +// Created by innar on 08.02.2024. +// From 90ebff26b400fa6eb9f119a6372dbcc1e9590ca3 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 14:17:25 +0100 Subject: [PATCH 03/18] =?UTF-8?q?Erstellen=20der=20Testdatei=20f=C3=BCr=20?= =?UTF-8?q?decbinary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test_decbinary.c | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/test_decbinary.c diff --git a/src/test_decbinary.c b/src/test_decbinary.c new file mode 100644 index 0000000..40593f5 --- /dev/null +++ b/src/test_decbinary.c @@ -0,0 +1,3 @@ +// +// Created by innar on 08.02.2024. +// From d853e97d245df9e97eb8616322ccdb1f78d22ecb Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 18:31:03 +0100 Subject: [PATCH 04/18] =?UTF-8?q?include=20Standardbibliothek=20hinzugef?= =?UTF-8?q?=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/decbinary.c b/src/decbinary.c index 40593f5..10b222c 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -1,3 +1,2 @@ -// -// Created by innar on 08.02.2024. -// +#include + From 04c944c6dab784da680443ea43e0a3b7c9944ee2 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 18:38:28 +0100 Subject: [PATCH 05/18] =?UTF-8?q?include=20decbinary=20Header-File=20hinzu?= =?UTF-8?q?gef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test_decbinary.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test_decbinary.c b/src/test_decbinary.c index 40593f5..88c50b7 100644 --- a/src/test_decbinary.c +++ b/src/test_decbinary.c @@ -1,3 +1 @@ -// -// Created by innar on 08.02.2024. -// +#include "decbinary.h" From 88756e026dbd09fcda2433908918809e5ed5f284 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 18:46:44 +0100 Subject: [PATCH 06/18] include decbinary Header-File zu Hauptprogramm --- src/decbinary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decbinary.c b/src/decbinary.c index 10b222c..672b2f6 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -1,2 +1,2 @@ #include - +#include "decbinary.h" From 7cca931cff45551cd064d46d1e0948dba8109eab Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 18:51:55 +0100 Subject: [PATCH 07/18] =?UTF-8?q?Hinzuf=C3=BCgen=20der=20int=20Dezimalbin?= =?UTF-8?q?=C3=A4r-Funktion=20in=20Header-File?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/decbinary.h b/src/decbinary.h index ea7f546..0e7b298 100644 --- a/src/decbinary.h +++ b/src/decbinary.h @@ -1,8 +1,8 @@ -// -// Created by innar on 08.02.2024. -// #ifndef LINKES_TWIX_DECBINARY_H #define LINKES_TWIX_DECBINARY_H +int dezimal_zu_binär(int dezimalzahl); + + #endif //LINKES_TWIX_DECBINARY_H From 95da14f3e89a201869e1a7752a611997e5351688 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 18:56:39 +0100 Subject: [PATCH 08/18] =?UTF-8?q?refactoring:=20Benennung=20der=20Bin?= =?UTF-8?q?=C3=A4rfunktion=20angepasst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decbinary.h b/src/decbinary.h index 0e7b298..7c5b5ff 100644 --- a/src/decbinary.h +++ b/src/decbinary.h @@ -2,7 +2,7 @@ #ifndef LINKES_TWIX_DECBINARY_H #define LINKES_TWIX_DECBINARY_H -int dezimal_zu_binär(int dezimalzahl); +int decimal_to_binary(int dezimalzahl); #endif //LINKES_TWIX_DECBINARY_H From ea71a3f921c9001561ba0591e8352fef6ad229c0 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 19:02:35 +0100 Subject: [PATCH 09/18] =?UTF-8?q?Hinzuf=C3=BCgen=20der=20Bin=C3=A4rfunktio?= =?UTF-8?q?n=20f=C3=BCr=20int=20ins=20Hauptprogramm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/decbinary.c b/src/decbinary.c index 672b2f6..00ff176 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -1,2 +1,4 @@ #include #include "decbinary.h" + +int dezimal_zu_binär(int dezimalzahl); From 0a5d9b0f2c68b0a8a35531cc506bf1f8b940ad19 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 19:06:52 +0100 Subject: [PATCH 10/18] =?UTF-8?q?Variable=20int=20bin=C3=A4rzahl=20ins=20H?= =?UTF-8?q?auptprogramm=20hizugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/decbinary.c b/src/decbinary.c index 00ff176..d2b840c 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -2,3 +2,7 @@ #include "decbinary.h" int dezimal_zu_binär(int dezimalzahl); + +{ +int binärzahl[32]; +} \ No newline at end of file From d041582b245850c378f8fe9bbe3a149bf625cd26 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 19:11:35 +0100 Subject: [PATCH 11/18] =?UTF-8?q?Initialisierung=20der=20Z=C3=A4hlervariab?= =?UTF-8?q?le=20f=C3=BCr=20bin=C3=A4rzahl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/decbinary.c b/src/decbinary.c index d2b840c..aff5c71 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -3,6 +3,6 @@ int dezimal_zu_binär(int dezimalzahl); -{ + int binärzahl[32]; -} \ No newline at end of file +int i = 0; From f2b9da84ddf60053665e1067c943d9b22ec0bfa5 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 19:28:16 +0100 Subject: [PATCH 12/18] =?UTF-8?q?Hinzuf=C3=BCgen=20der=20Schleife=20zur=20?= =?UTF-8?q?Umwandlung=20der=20Dezimalzahl=20in=20Bin=C3=A4rform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/decbinary.c b/src/decbinary.c index aff5c71..f015dbf 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -1,8 +1,14 @@ #include #include "decbinary.h" -int dezimal_zu_binär(int dezimalzahl); +int dezimal_zu_binär(int dezimalzahl) { -int binärzahl[32]; -int i = 0; + int binärzahl[32]; + int i = 0; + + while (dezimalzahl > 0) { + } + + return i; +} \ No newline at end of file From 693607211fc1d813a09d568780093c48fa27b482 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 19:47:22 +0100 Subject: [PATCH 13/18] =?UTF-8?q?Hinzuf=C3=BCgen=20der=20Berechnung=20des?= =?UTF-8?q?=20Bin=C3=A4rrests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/decbinary.c b/src/decbinary.c index f015dbf..55e179b 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -8,6 +8,7 @@ int dezimal_zu_binär(int dezimalzahl) { int i = 0; while (dezimalzahl > 0) { + binärzahl[i] = dezimalzahl % 2; } return i; From 9544c46b3cc04d5ad92a696ab0627623aeeb4f4d Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 20:05:36 +0100 Subject: [PATCH 14/18] =?UTF-8?q?Hinzuf=C3=BCgen=20von=20Dezimalzahl-Divis?= =?UTF-8?q?ion=20und=20Index-Inkrementierung=20in=20der=20Umwandlungsschle?= =?UTF-8?q?ife?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/decbinary.c b/src/decbinary.c index 55e179b..cc3b003 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -9,6 +9,8 @@ int dezimal_zu_binär(int dezimalzahl) { while (dezimalzahl > 0) { binärzahl[i] = dezimalzahl % 2; + dezimalzahl /= 2; + i++; } return i; From 9c1924263a1e048330f52730f9f9e93c894bac66 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 20:12:40 +0100 Subject: [PATCH 15/18] =?UTF-8?q?refactoring:=20Vereinfachung=20der=20Bin?= =?UTF-8?q?=C3=A4rumwandlungsschleife?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/decbinary.c b/src/decbinary.c index cc3b003..1f1d951 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -8,9 +8,8 @@ int dezimal_zu_binär(int dezimalzahl) { int i = 0; while (dezimalzahl > 0) { - binärzahl[i] = dezimalzahl % 2; + binärzahl[i++] = dezimalzahl % 2; dezimalzahl /= 2; - i++; } return i; From d271cce8d49673a77962ecb722aadfa91d9e7cc0 Mon Sep 17 00:00:00 2001 From: INNA Date: Thu, 8 Feb 2024 20:23:44 +0100 Subject: [PATCH 16/18] =?UTF-8?q?refactoring:=20Einheitliche=20Namensanpas?= =?UTF-8?q?sung=20der=20Bin=C3=A4rfunktion=20f=C3=BCr=20int=20wie=20aus=20?= =?UTF-8?q?Header-File?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decbinary.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/decbinary.c b/src/decbinary.c index 1f1d951..fcf1b3b 100644 --- a/src/decbinary.c +++ b/src/decbinary.c @@ -1,7 +1,7 @@ #include #include "decbinary.h" -int dezimal_zu_binär(int dezimalzahl) { +int decimal_to_binary(int dezimalzahl) { int binärzahl[32]; @@ -13,4 +13,5 @@ int dezimal_zu_binär(int dezimalzahl) { } return i; -} \ No newline at end of file +} + From a15428c294c650995e892969d8f1ca4e6e27f59e Mon Sep 17 00:00:00 2001 From: INNA Date: Fri, 9 Feb 2024 14:05:37 +0100 Subject: [PATCH 17/18] =?UTF-8?q?Implementierung=20von=20setUp=20f=C3=BCr?= =?UTF-8?q?=20decbinary=20Testdatei?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test_decbinary.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test_decbinary.c b/src/test_decbinary.c index 88c50b7..bf9c15b 100644 --- a/src/test_decbinary.c +++ b/src/test_decbinary.c @@ -1 +1,6 @@ #include "decbinary.h" + + +void setUp(void) +{ +} From a49472693dc730577172517f49172ab05c2dfcd8 Mon Sep 17 00:00:00 2001 From: INNA Date: Fri, 9 Feb 2024 14:42:25 +0100 Subject: [PATCH 18/18] =?UTF-8?q?Test=20Dezimal=20in=20Bin=C3=A4r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test_decbinary.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test_decbinary.c b/src/test_decbinary.c index bf9c15b..747220c 100644 --- a/src/test_decbinary.c +++ b/src/test_decbinary.c @@ -1,6 +1,18 @@ -#include "decbinary.h" +#ifdef TEST +#include "decbinary.h" +#include "unity.h" void setUp(void) { } + +void test_decimal_1(void) +{ + int result, expected = 10; + result = decimal_to_binary(2); + + TEST_ASSERT_EQUAL_INT(expected, result); +} + +#endif //TEST \ No newline at end of file