Browse Source

Implement Div find test

remotes/origin/Input_Handling
Sophia Weber 11 months ago
parent
commit
c22a51bf6c
  1. 2
      src/inputHandling.c
  2. 10
      test/test_inputHandling.c

2
src/inputHandling.c

@ -37,7 +37,7 @@ op detectFunctionOperator(char* formulaString, int length){
switch (formulaString[stringCount]){ switch (formulaString[stringCount]){
case '+': return opAdd; case '+': return opAdd;
case '-': return opSub; case '-': return opSub;
case '/': return opDiv;
case '/':case ':': return opDiv;
case '*': return opMult; case '*': return opMult;
case '^': return opExp; case '^': return opExp;
case '\0': return opEmpty; case '\0': return opEmpty;

10
test/test_inputHandling.c

@ -61,4 +61,14 @@ void test_inputHandling_findMultiFunctionType(void)
TEST_ASSERT_TRUE(opMult == type); 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 #endif // TEST
Loading…
Cancel
Save