From c05d58f22aaf6ee161ad625a0f774a1704277fd5 Mon Sep 17 00:00:00 2001 From: Sophia Weber Date: Sun, 28 Jan 2024 14:07:39 +0100 Subject: [PATCH] Implement add detected Test for getNumber Function --- project.yml | 1 + test/test_inputHandling.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/project.yml b/project.yml index cfbdf24..11236c5 100644 --- a/project.yml +++ b/project.yml @@ -47,6 +47,7 @@ :test: - *common_defines - TEST + - UNITY_INCLUDE_DOUBLE :test_preprocess: - *common_defines - TEST diff --git a/test/test_inputHandling.c b/test/test_inputHandling.c index 7ac418d..ac97c3d 100644 --- a/test/test_inputHandling.c +++ b/test/test_inputHandling.c @@ -93,4 +93,17 @@ void test_inputHandling_getNumbersNoFormular(void) pnt = getNumbers(halloWelt, 10, &formula); TEST_ASSERT_NULL(pnt); } + +void test_inputHandling_getNumbersAddFormular(void) +{ + char* pnt = NULL; + char add[] = "4+5"; + formula.functionsType = detectFunctionOperator(add,3); + pnt = getNumbers(add, 3, &formula); + showStruct(&formula); + TEST_ASSERT_NULL(pnt); + TEST_ASSERT_EQUAL_DOUBLE(4.0, formula.inputNumbers[0]); + TEST_ASSERT_EQUAL_DOUBLE(5.0, formula.inputNumbers[1]); + TEST_ASSERT_EQUAL_INT(2, formula.arrayLength); +} #endif // TEST