Browse Source

Implement multi detected Test for getNumber Function

remotes/origin/Input_Handling
Sophia Weber 11 months ago
parent
commit
980d22cae4
  1. 22
      test/test_inputHandling.c

22
test/test_inputHandling.c

@ -99,6 +99,7 @@ void test_inputHandling_getNumbersAddFormular(void)
char* pnt = NULL;
char add[] = "4+5";
formula.functionsType = detectFunctionOperator(add,3);
TEST_ASSERT_TRUE(formula.functionsType == opAdd);
pnt = getNumbers(add, 3, &formula);
showStruct(&formula);
TEST_ASSERT_NULL(pnt);
@ -110,9 +111,24 @@ void test_inputHandling_getNumbersAddFormular(void)
void test_inputHandling_getNumbersSubFormular(void)
{
char* pnt = NULL;
char add[] = "4-5";
formula.functionsType = detectFunctionOperator(add,3);
pnt = getNumbers(add, 3, &formula);
char sub[] = "4-5";
formula.functionsType = detectFunctionOperator(sub,3);
TEST_ASSERT_TRUE(formula.functionsType == opSub);
pnt = getNumbers(sub, 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);
}
void test_inputHandling_getNumbersMultiFormular(void)
{
char* pnt = NULL;
char multi[] = "4*5";
formula.functionsType = detectFunctionOperator(multi,3);
TEST_ASSERT_TRUE(formula.functionsType == opMult);
pnt = getNumbers(multi, 3, &formula);
showStruct(&formula);
TEST_ASSERT_NULL(pnt);
TEST_ASSERT_EQUAL_DOUBLE(4.0, formula.inputNumbers[0]);

Loading…
Cancel
Save