From c22a51bf6cd91f58afde14a013e97f1347bbe1da Mon Sep 17 00:00:00 2001 From: Sophia Weber Date: Sun, 28 Jan 2024 13:29:30 +0100 Subject: [PATCH] Implement Div find test --- src/inputHandling.c | 2 +- test/test_inputHandling.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/inputHandling.c b/src/inputHandling.c index 983e521..69c70ea 100644 --- a/src/inputHandling.c +++ b/src/inputHandling.c @@ -37,7 +37,7 @@ op detectFunctionOperator(char* formulaString, int length){ switch (formulaString[stringCount]){ case '+': return opAdd; case '-': return opSub; - case '/': return opDiv; + case '/':case ':': return opDiv; case '*': return opMult; case '^': return opExp; case '\0': return opEmpty; diff --git a/test/test_inputHandling.c b/test/test_inputHandling.c index e4f6be1..f68f20c 100644 --- a/test/test_inputHandling.c +++ b/test/test_inputHandling.c @@ -61,4 +61,14 @@ void test_inputHandling_findMultiFunctionType(void) TEST_ASSERT_TRUE(opMult == type); } +void test_inputHandling_findDivFunctionType(void) +{ + op type = opNotSupported; + type = detectFunctionOperator("4/5", 3); + TEST_ASSERT_TRUE(opDiv == type); + type = opNotSupported; + type = detectFunctionOperator("4:5", 3); + TEST_ASSERT_TRUE(opDiv == type); +} + #endif // TEST